bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble with C++ sources about 'using' keyword and conflicting direc


From: Bruno Haible
Subject: Re: Trouble with C++ sources about 'using' keyword and conflicting directions between manual and FAQ
Date: Thu, 23 Mar 2023 14:34:14 +0100

Anadon wrote:
> $ xgettext -C -f src/primes-cli.in.cpp
> xgettext: error while opening "// using madlib::primes;" for reading:
> No such file or directory

"xgettext --help" says:

  -f, --files-from=FILE       get list of input files from FILE

You are saying that your .cpp file is a *list of files* ?

> ```
> #include <libintl.h>
> #define _(String) gettext (String)
> #define gettext_noop(String) String
> #define N_(String) gettext_noop (String)
> ```
> 
> which is different from the FAQ which says to use
> https://www.gnu.org/software/gettext/FAQ.html#integrating_howto
> ```
> #include <locale.h>
> #include "gettext.h"
> #define _(string) gettext (string)
> ...
> setlocale (LC_ALL, "");
> bindtextdomain (PACKAGE, LOCALEDIR);
> textdomain (PACKAGE);
> ```
> 
> What am I misinterpreting?  How do I get this all to work?

<libintl.h> is more or less equivalent to <locale.h> + "gettext.h".
The difference is that the latter
  - considers an ENABLE_NLS macro,
  - defines a few extra macros for use with contexts,
  - is only allowed in GPL-compatible packages, for license reasons.

gettext_noop and N_ are explained in
https://www.gnu.org/software/gettext/manual/html_node/Special-cases.html

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]