Re: Localization issues



On Wed, 29 Dec 2010 17:11:47 +0530
Lourembam Lenin <leninlou gmail com> wrote:
I have a text in English which i want to convert it into French.

The sequence that i followed are as under:

   1. generate all the text using xgettext command in terminal,
creating .pot file
   2. creating .po file from .pot file
   3. creating .mo file from .po file

I have copy the .mo file in "/usr/share/locale/fr/LC_MESSAGES"

here is my code for main.c file:

int main()

{

    setlocale(LC_ALL,"");
    bindtextdomain("main","/usr/share/locale");
    textdomain("main");
    printf( gettext("Hello world\n"));
    return (0);
}

But when i execute the program, french version is not printed on
terminal after changing the language to french.

You shouldn't copy your po file by hand: if your program is
gettextize'd then 'make install' will do it for you, with the correct
name.  In your case, if you were to copy it by hand you would need to
name it main.po, which is a very odd name.  Bind to a more sensible name
instead.

You might also want to call bind_textdomain_codeset() depending on what
codeset you are using.

For managing your translation files, I should use intltools.

Chris



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