bug-gnulib
[Top][All Lists]
Advanced

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

Re: Default Windows locale for localename.c


From: Eli Zaretskii
Subject: Re: Default Windows locale for localename.c
Date: Mon, 12 Mar 2018 22:50:56 +0200

[Please CC me on the responses, as I'm not subscribed to this list.]

> From: address@hidden
> Date: Mon, 12 Mar 2018 23:23:21 +0300
> 
> >    const char *
> >    gl_locale_name (int category, const char *categoryname)
> >    {
> >      const char *retval;
> > 
> >      retval = gl_locale_name_thread (category, categoryname);
> >      if (retval != NULL)
> >        return retval;
> > 
> >      retval = gl_locale_name_posix (category, categoryname);
> >      if (retval != NULL)
> >        return retval;
> > 
> >      return gl_locale_name_default ();
> >    }
> > 
> > GetThreadLocale is called from gl_locale_name_default, which is the
> > last resort.  Before that, the function calls gl_locale_name_thread,
> > which on MS-Windows calls setlocale, as you wanted.
> > 
> > So I'm not sure what problem did you have and why.  Or maybe I'm
> > missing something.
> 
> I've re-traced this, here's how it works:
> 
> libintl_dcigettext (domainname=0x45e3718 "gedit", address@hidden, 
> address@hidden <__FUNCTION__.74302+47> "", 
> address@hidden, address@hidden, address@hidden, 
> address@hidden)
> at gettext-0.19.7/gettext-tools/../gettext-runtime/intl/dcigettext.c:667
> 
> guess_category_value (categoryname=0x61ed714d "LC_MESSAGES", category=1729)
> at gettext-0.19.7/gettext-tools/../gettext-runtime/intl/dcigettext.c:1561
> 
> _nl_locale_name_posix (category=1729, categoryname=0x61ed714d "LC_MESSAGES")
> at gettext-0.19.7/gettext-tools/../gettext-runtime/intl/localename.c:2815

This shows that guess_category_value calls gl_locale_name_posix
directly, instead of calling gl_locale_name.  So the question now
becomes why does gettext do that, and whether it should do something
different at least on MS-Windows.

Also note that LC_MESSAGES is not supported by the Windows setlocale,
so either gettext should use some other category, or it will have to
invent stuff out of thin air, something I don't recommend.

> My Windows installation is in English (i.e. this is the language of the 
> installer and the UI language for all applications and system software), but 
> i 
> have Russian regional settings (time, date, weekday names, currency, number 
> formatting). Because of this any program using gettext is in Russian, unless 
> i 
> deliberately set LANG or LC_*.

Which in general sounds quite reasonable to me, btw, given the
description of your setup.

And what does setlocale(LC_ALL,NULL) return on that system?



reply via email to

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