[Top][All Lists]

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

Re: gettext

From: Bruno Haible
Subject: Re: gettext
Date: Mon, 15 Apr 2002 14:20:57 +0200 (CEST)

Vlada von Strasnic writes:
> even if i compile the program from sources and ./configure
> detects NLS , it compiles , i do "make install" and it doesn't work !!!

Here are a few things that you can check, in order to determine the
cause of the problem:

  - Try the command "locale", to see which is the locale that the system uses.
  - Check your environment variables LC_ALL, LC_CTYPE, LC_MESSAGES,
    LANG, LANGUAGE against the description in the ABOUT-NLS file.
  - Use the 'strace' utility to see which files are accessed by your
  - Does your program's main() function start out with
      setlocale(LC_ALL,"") ?
  - The gettext package's testsuite verifies that translations work.
    Does "make check" of gettext pass on your system?

> This is the problem. I would be satisfied if just one message from 100
> was translated. But there is not even one, because NLS somehow doesn't
> work. So i would like to know 
>         how can i find out , how nls support is compiled into the
>                 program ???

The command "nm program | grep gettext" will show you whether the
program uses the gettext function at all.

>         why my programs work , when i compile them just with gcc file.c 
>                 ( without any -l -I )
>         if the program, that realizes LC_ALL=some_language , can also
>                 realize, that it cannot that language !!!!

What do you mean here?

> Program just says
> bindtextdomain(..)  and doesn't receive any information back : 
>         - if the directory that was argument to bindtextdomain is usable

It is usable if "ls -l <directory>/*/LC_MESSAGES/<my_program_name>.mo"
contains some files.

>         - what catalogs are installed there

ls will tell you.

>         - if the language , that is requested by LC_ALL or some other
>                 variable is really there ...

Use "locale | grep LC_MESSAGES" and the above ls command.

>         - if program tries to translate some message, it doesn't really know 
>                 if it really get translated ...

It can do so by comparing the result of gettext(msgid) with msgid
using ==.

>                 And if requested more than 
>                 one language , you have no way to realize into what
>                 language, it had been really translated !!!!!!!

Yes. If you are a multilingual person and have declared multiple
languages in your LANGUAGE environment variable, the gettext function
will make a best-effort. The program around doesn't need to know into
which language the message has been translated; only you as the user
will bother about it.

> This means that its kept magic.

I see. You want some logging message that output some information to

> There is one more:
>  Structure of catalogs is this:
>         ../locale/cs/LC_MESSAGES/my_program_name.mo
>         ../       de/           /..
>         ../       sk/           /..
>         ../                     /..
>  What if my country has several dialects ???

Dialects are usually abbreviated using suffixes of the locale
name. For example, de_AT stands for Austrian (a dialect of German),
and Bavarian (another dialect of German) could be abbreviated

> How can i write several catalogs for one country.
>         ../locale/cs_official/LC_MESSAGES/my_program_name.mo
>         ../locale/cs_morava/LC_MESSAGES/my_program_name.mo
>         ../locale/cs_praha/LC_MESSAGES/my_program_name.mo

Nearly. More precisely, the @ sign is used as separator by convention:


This syntax is supported by gettext in the sense that the user who
sets LANGUAGE="cs" will only get "cs" translations (no variants), but
the user who sets LANGUAGE="address@hidden" will get messages from the
address@hidden and cs catalogs, the first one taking priority over the


reply via email to

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