This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

1.7.7: Localization does not follow the language of the OS


I would like to make an application which uses gettext-based
internationalization, and which (by default) inherits the language settings
from the operating system. For instance, 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. According to the setlocale manpage (in Linux), that
should set the locale "according to  the  environment  variables".
I'd expect the environment variables to reflect the system's localization
settings, and they do in Linux. In fact, I don't know of any other way of
retrieving the system's localization settings.

Unfortunately, the environment variables in my Cygwin 1.7.7 installation
do not seem to reflect the language setting of windows. The only
localization-related variable is LANG, which is set to "C.UTF-8".

For reproducing/testing, I suggest to use GNU Hello version 2.2
(http://www.gnu.org/software/hello/hello.html), just as I did, in the
following way:

tar -xvjf hello-2.2.tar.bz2
cd hello-2.2/
./configure
make
make install
hello

On my Dutch windows system, this prints the English "Hello, world!".

The make install is necessary to make localization possible, because
GNU hello only looks for the translation files in their installation
directory.

To check that the LANG variable is the only problem:
export LANG="nl_NL.UTF-8"
hello

This correctly prints the Dutch "Hallo, wereld!".

Can you please tell me and others how to make an internationalized
application in Cygwin that behaves as described in the first paragraph?
I couldn't find an answer to this in the FAQ, the User's Guide, the
mailing lists or Google.

Note: My Cygwin 1.7.7 installation was created by upgrading from a 1.5
installation. In fact, my problem only exists after the upgrade.
I checked the dlls on which hello.exe depends:
cygwin1.dll (31-8-2010)
cygintl-8.dll (3-4-2009)
cygiconv-2.dll (23-12-2009)
cyggcc-s-1.dll (15-8-2010)
They all seem to be the versions that come with version 1.7.7. For more
complete system information: the output of cygcheck -s -v -r > cygcheck.out
can be found in the attachment.

Attachment: cygcheck.out
Description: Binary data

--
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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]