i have a project in C++ 2005 that requires the session locale to be changed based on the user, e.g. English to German. SetLocale works fine for most languages but not all. One language that I need to be able to switch to fails..
Does anyone know why this is limited and/or if there is a work around?
Alas, the C++ Standard does not specify locales -- that's an operating system thing. Some versions of the STL give you some nice locales. AFAIK, there is also no standardized way to figure out what locales are available to you.
Actually there are standard calls in the Visual C++ to allow you to change the session language, e.g. the app allows a user to input information in French for one session, German for a second session and Russian in a third.
The problem is that some languages, and the codes are clearly documented, have a codepage value of 0 (zero). Some of these languages need to be set for the session but are rejected because a zero codepage is not handled in the code.
I need a workaround to programmatically change to these 0 (zero) codepage languages.
Why your app don't use Unicode anyway ?
Don't bother with locales ... If you want to detect user locale for showing personalized text there is windows APIs to do it.
I posted this also to MSDN forums and they were able to duplicate the problem as it exists in VC++ 2005. They also pointed out that this issue had been corrected in VC++ 2010.
Of course, my problem is I need to keep working in 2005 for now...