Klaus Schmidinger wrote:
> On 08/19/07 12:43, Anssi Hannula wrote:
> > Anssi Hannula wrote:
> > It seems that it *does* work, i.e. LANGUAGE=de, LANGUAGE=fr, LANGUAGE=fi 
> > will work even if there is no such locale at all.
> > 
> > I copied a .mo file into /usr/share/locale/testtest/LC_MESSAGES/, which 
> > certainly is not a valid locale, and using LANGUAGE=testtest it was 
> > correctly used! :)
> Looks good. However, after some tests it would appear as if only the
> very first setenv() call actually changes anything. Subsequent calls
> have no further effect, and gettext() always returns the language
> that was selected in the very first call to setenv().

The gettext info page says:

     But there is one little hook.  The code for gcc-2.7.0 and up
     provides some optimization.  This optimization normally prevents
     the calling of the `dcgettext' function as long as no new catalog
     is loaded.  But if `dcgettext' is not called the program also
     cannot find the `LANGUAGE' variable be changed (*note Optimized 
     gettext::).  A solution for this is very easy.  Include the
     following code in the language switching function.

            /* Change language.  */
            setenv ("LANGUAGE", "fr", 1);

            /* Make change known.  */
              extern int  _nl_msg_cat_cntr;


 (o_   Ludwig Nussel
 //\   SUSE LINUX Products GmbH, Development
 V_/_  http://www.suse.de/

vdr mailing list

Reply via email to