0

I tried to change the OS's language preferences. And indeed, when I go to Control Panel I see my changes.

However, it doesn't really change something. Only when I go manually and change it in the Control Panel it changes it.

Those settings will influnce the header "Accept-Language" in the HTTP requests. I want that programically all websites will treat me as an American. So, I tried to change it manually: Control Panel-->Clock Language and Region-->Language, and then I put "English" on the top of it. It changes it, but when I do it programically as descripted it doesn't notify Windows.

        RegistryKey key = Registry.CurrentUser.OpenSubKey(@"ControlPanel\International\User Profile", true);
        string[] lang = { "fr", "en-US" };
        key.SetValue("Languages", lang, RegistryValueKind.MultiString);

Appreciate your help.

ketan
  • 19,129
  • 42
  • 60
  • 98
M. Jason
  • 11
  • 4
  • 1
    All you've done is change the setting data, you need to notify Windows that the settings have changed. – Lloyd Feb 25 '16 at 15:57

1 Answers1

0

After the settings has been applied the user has to log off and log in to apply the changes.

This is my code changing the OS language:

var registryKey = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
var language = {"en-US"};
registryKey .SetValue("PreferredUILanguagesPending", language, RegistryValueKind.MultiString);

Hope this helps!

Ferhat Sayan
  • 216
  • 1
  • 4
  • 19
  • First, thank you. You didn't really understood my point. I just want that English will be on top of my layout languages. So, when I go to www.example.com for instance it will understand I'm American. – M. Jason Feb 25 '16 at 16:35
  • I see. Just looked myself into the registry. Have you tried removing the "fr". So just use: `var language = {"en-US"}`. Let me know, if this works! – Ferhat Sayan Feb 25 '16 at 16:41
  • Nope. and you can only change its order – M. Jason Feb 25 '16 at 16:59