Is there a way to access the locale used by gettext under windows ?

Posted by phtrivier on Stack Overflow See other posts from Stack Overflow or by phtrivier
Published on 2010-05-02T15:49:23Z Indexed on 2010/05/02 15:57 UTC
Read the original article Hit count: 248

Filed under:
|
|
|

I have a program where i18n is handled by gettext. The program works fine, however for some reason I need to know the name of the locale used by gettext at runtime (something like 'fr_FR') under win32.

I looked into gettext sources, and there is a quite frightening function that computes it on all platforms (gl_locale_name, in a C file called "localename.h/c"). However, this file does not seem to be installed alongside gettext or libintl, so I can't seem to call the function. Is there another function provided by gettext to get this value ? Or in another package (boost, glib, anything ?)

(On a related note, there is a thing called std::locale in the C++ standard library, and according to the doc calling std::locale("") should create a locale with the settings of the system, unless I am mistaken ... but then the name is 'C' under windows. Is it a viable way of getting the locale name ? What I am doing wrong ?)

© Stack Overflow or respective owner

Related posts about c++

Related posts about c