1.7.7: Localization does not follow the language of the OS

Bruno Haible bruno@clisp.org
Fri Jan 28 23:18:00 GMT 2011


Replying to <http://www.cygwin.com/ml/cygwin/2011-01/msg00119.html>:

> I have a Dutch windows version, so
> on my PC the application should automatically set its language to Dutch.
> I want to release this application to users with different language
> preferences, and on their PCs the application should automatically adapt
> to their OS language settings.
> 
> I think that doing setlocale(LC_ALL, ""); on application initialization
> should do the trick.

Yes it does - assuming you use a libintl from gettext version >= 0.18,
and assuming that you have a #include <libintl.h> in the source file that
invokes setlocale (LC_ALL, "").

This was implemented in gettext 0.18. Citing the NEWS file:

  * Runtime behaviour:
    - On MacOS X and Windows systems, <libintl.h> now extends setlocale() and
      newlocale() so that their determination of the default locale considers
      the choice the user has made in the system control panels.

I don't know which gettext version is used in cygwin 1.7.7. You can look it
up through "grep LIBINTL_VERSION /usr/include/libintl.h".

But note that libintl provides only text message translation. Other locale
services, such as number formatting or collation, are implemented in libc.
For these please follow the documentation, cf.
  <http://www.cygwin.com/ml/cygwin/2011-01/msg00129.html>

Bruno

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list