Jean-Marc Lasgouttes wrote:
What about something like
...
Looking at the sources of intl/localename.c, it ought to work.
Michael, could you try this out? _nl_locale_name calls GetThreadLocale
and translates the win32 locales to POSIX-like ones.
Jean-Marc,
you tried to fix a language recognition problem but that is not the
issue. Our problem is that gettext (MinGW, --with-included-gettext)
doesn't really care about what we do in messages.C. It seems to check
LC_MESSAGES et al. by itself.
Here comes a minimal patch for the Windows platform. It just captures
two NULL values returned from setlocale and uses the output of gettext
no matter whether we were able to set the locale or not.
Comments? It should (hopefully) not affect behaviour on other platforms.
BTW: According to the man pages, gettext ALWAYS returns a reasonable
string. There is no real need to check for NULL.
Michael
Index: messages.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/messages.C,v
retrieving revision 1.25
diff -r1.25 messages.C
92,93c92,95
< if ( lang_.empty() )
< lang_ = setlocale(LC_MESSAGES, NULL);
---
> if ( lang_.empty() ) {
> char const * lc_msgs = setlocale(LC_MESSAGES, NULL);
> lang_ = lc_msgs ? lc_msgs : "";
> }
120,121c122,124
< char const * works = setlocale(LC_MESSAGES, lang_.c_str());
< if (!works)
---
> char const * lc_msgs = setlocale(LC_MESSAGES, lang_.c_str());
> #ifndef _WIN32
> if (!lc_msgs)
122a126
> #endif
124c128,130
< string oldCTYPE = setlocale(LC_CTYPE, NULL);
---
> char const * lc_ctype = setlocale(LC_CTYPE, NULL);
> string oldCTYPE = lc_ctype ? lc_ctype : "";
>
139c145
< string translated(works ? msg : m);
---
> string translated(msg ? msg : m);