3

I have created a localized fr_FR_Locale.mo files from fr_FR.po.

I have used sgettext, msginit and msgfmt command from terminal.

I have changed my local to french(fr_FR.utf8).

But when i execute my code i am not getting what i am expecting. Here is my call:

setlocale(LC_ALL,"");
bindtextdomain("locale",LC_INTL);
bind_textdomain_codeset("locale", "UTF-8");
textdomain("locale");
printf(gettext("Hello world!"));   

Here the output should be some thing non english, but i am getting same English words.

boom
  • 5,856
  • 24
  • 61
  • 96

1 Answers1

0

Perhaps your mo-file isn't found. I don't know what LC_INTL means or where you installed your mo-file. But let's say you installed it as /usr/local/share/locale/fr/LC_MESSAGES/MyApp.mo, the code should look like:

setlocale(LC_ALL,"");
bindtextdomain("MyApp","/usr/local/share/locale");
bind_textdomain_codeset("MyApp","UTF-8");
textdomain("MyApp");
Fabel
  • 1,711
  • 14
  • 36