[vdr] [ANNOUNCE] VDR developer version 1.5.7

Ludwig Nussel ludwig.nussel at suse.de
Sun Aug 19 15:45:45 CEST 2007


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;
              ++_nl_msg_cat_cntr;
            }

cu
Ludwig

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




More information about the vdr mailing list