3

I'm trying to make my application support multiple languages. I've made some satellite assemblies and now I want to test what the app will look like when run on a French machine, for example.

In [Control Panel->Regional And Language Options] I can select French (France) in the Regional Options tab, and I can select French (France) in the Advanced tab.

But this is not enough to make my application think it's French.

If I add this code to the start of my main function,

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
    CultureInfo^ ci1 = Thread::CurrentThread->CurrentCulture;
    CultureInfo^ ci2 = Thread::CurrentThread->CurrentUICulture;

then ci1->Name is fr-FR but ci2->Name is en-US.

And unfortunately for me, for the French satellite assembly to be used, the CurrentUICulture is the one that needs to be fr-FR.

I don't want to set the CurrentUICulture to the same one as the CurrentCulture in code - I want to change the default one using the Control Panel or something.

I've seen many posts on t'internet about how to detect an event when the CurrentUICulture is changed, just nothing that tells me how to change it!

demoncodemonkey
  • 11,730
  • 10
  • 61
  • 103

3 Answers3

2

This may or may not be possible, depending on your Windows installation. See the "Implicitly Setting the CurrentUICulture Property" section at http://msdn.microsoft.com/en-us/library/441487wx(v=vs.100).aspx for details. For additional information concerning the behaviour on various Windows versions, see http://msdn.microsoft.com/en-us/library/dd374098(VS.85).aspx.

Nicole Calinoiu
  • 20,843
  • 2
  • 44
  • 49
2

Please see How To Change the language used to display menus and dialogs in MUI:

Windows MUI makes it easy for users to change the user interface (menus and dialogs) into the language that best suits them. Up to 33 different languages can be installed on the machine by an administrator (any user with administrative privileges) using the muisetup.exe program.

.NET's CurrentUICulture reflects this setting.

Andrew Hare
  • 344,730
  • 71
  • 640
  • 635
0

The answer has changed a bit for Windows 8 (these steps were done on 8.1).

You should be able to change your display language to another language in Control Panel > Clock, Language, and Region > Language. Notice the "should."

I had a hell of a time changing the CurrentUICulture in my console app. To change it, I ended up:

  • changing the language to to Japanese
  • downloading and installing the language pack (all from inside the Lanuage menu: cool!)
  • moving Japanese up to the top of the "Language Preferences"
  • then in "Change date, time, or number formats"
    • > Formats: changing "Format" to Japanese
    • > Location: changing "Home location" to Japan
    • > Administrative: changing "Current language for non-Unicode programs" to Japanese
  • still in Administrative the "Copy settings" showed Current user: Display Language as English
    • on a coworker's machine the Display Language wasn't the same as the default CurrentUICulture, so there's probably still more to the story
  • I'd rebooted several times before this, but now with each setting on Japan/Japanese I rebooted

And finally, finally CurrentUICulture was no longer English! I'm not sure which step solved the problem, but the reboot was necessary.

CurrentCulture is actually pretty easy to change. The earlier Format step will change it when you hit OK/Apply, no reboot, confusion, or cursing required!

Carl Walsh
  • 6,100
  • 2
  • 46
  • 50