bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Using gettext for runtime translations


From: Torsten Bronger
Subject: Re: Using gettext for runtime translations
Date: Tue, 12 Apr 2005 15:03:26 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

Hallöchen!

Bruno Haible <address@hidden> writes:

> Torsten Bronger wrote:
>
>> For Texinfo (actually makeinfo), we need to translate things like
>> "see section" or "node" to various languages.  The language is
>> *not* determined by the locale but by a parameter in the input
>> file.  The best way would be (for German as an example)
>>
>> translation = super_gettext("see ", "de");
>>
>> However, this doesn't exist (yet?).
>
> You are already aware of
>   http://lists.gnu.org/archive/html/bug-texinfo/2003-12/msg00023.html
> and
>   http://lists.gnu.org/archive/html/bug-gnu-utils/2004-09/msg00057.html

Yes, the first via recommendation of Karl Berry, the second via
Google.  There is also a feature request on Savannah that goes in a
very similar direction.

> Something like this will be supported in gettext 0.15:
>
>   gl_locale_t locale = gl_newlocale ("de_DE", NULL);
>   translation = gl_dgettext ("texinfo", "see ", locale);

This is certainly an improvement.

> [...]
>
>> Is this also true if one uses setlocale()?  Is setenv better than
>> setlocale for some reason?
>
> If you use setlocale() without using setenv(), code that uses gettext()
> will not work on non-glibc platforms.

Ah, I see, thank you.  And is there a difference between LANG and
LANGUAGE, only as far as *portability* is concerned?

> [...]
>
> When you use gettext(), "ll_CC" works on all non-glibc systems,
> and on all glibc systems on which the "ll_CC" locale is actually
> installed.
>
> With the gettext 0.15 API gl_dgettext(), "ll_CC" will work on all
> systems, regardless whether a "ll_CC" locale is installed.

Great.

> "de" alone doesn't work as a locale name. The only place where it works
> is in the LANGUAGE environment variable.

Is LANGUAGE to prefer in favour of LANG?  (For example regarding
portability.)

>> Is there a decent fallback mechanism or do I have to mimic one?
>
> I don't understand. What do you mean exactly?

For example, "January" is "Januar" in German, but "Jänner" in
Austrian German.  So an Austrian Texinfo author could select the
IANA language code "de-AT" for his document.

However, if Texinfo doesn't support Austrian (yet), there won't be a
file in the "de_AT" locale directory.  Does the new gettext then
look for it in "de_DE"?

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus





reply via email to

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