Hi everyone,
I’m not able to translate my program by the gettext utility.
I surrounded the strings with ‘_(msg)’ characters.
I get the .pot file and I’ve translated the strings.
Then I put the output files in this folders:
# ls -lR locales/
locales/:
total 12
drwxr-xr-x 3 root root 4096 Oct 2 14:40 en
drwxr-xr-x 3 root root 4096 Oct 2 14:44 es
-rw-r--r-- 1 root root 2290 Oct 2 15:25 lux.pot
locales/en:
total 8
drwxr-xr-x 2 root root 4096 Oct 2 14:41 LC_MESSAGES
-rw-r--r-- 1 root root 2309 Oct 2 15:29 lux.po
locales/en/LC_MESSAGES:
total 4
-rw-r--r-- 1 root root 517 Oct 2 15:29 lux.mo
locales/es:
total 8
drwxr-xr-x 2 root root 4096 Oct 2 14:45 LC_MESSAGES
-rw-r--r-- 1 root root 1906 Sep 29 14:01 lux.po
locales/es/LC_MESSAGES:
total 4
-rw-r--r-- 1 root root 372 Oct 2 14:45 lux.mo
I added the following code:
setlocale(LC_ALL, "");
const char *textdomainstr = "lux";
const char *textdomaindir = getenv("TEXTDOMAINDIR");
if (textdomaindir)
{
printf("> text in '%s'\n", textdomaindir);
bindtextdomain(textdomainstr, textdomaindir);
}
printf("> textdomain '%s'\n", textdomainstr);
textdomain(textdomainstr);
printf("> LANG: '%s'\n", getenv("LANG"));
and I run the program with the following cl command:
LD_LIBRARY_PATH=/opt/oracle/instantclient_19_19/ TEXTDOMAINDIR=./locales LANG=en ./lux
The application is not translated with en language. In my output debug I see:
> text in './locales'
> textdomain 'lux'
> LANG: 'en'
and after some other output:
(process:30261): Gtk-WARNING **: 15:32:27.794: Locale not supported by C library.
Using the fallback 'C' locale.
I don’t understand which should be the structure/distribution of the messages into the folder - found other forms …
Should be the call to gtk_init() done after or before that lines?
Any idea?
Thanks!