I'd like to be able to change the Region and Language settings of the operating system (Windows 7) from a C# program. I'm not against executing command-line commands but I've only gotten as far as discovering how to launch the Region and Language dialog: control /name Microsoft.RegionAndLanguage
This is a language localisation problem where Control
s like DateTimePicker
can only use the Windows Region and Language settings (see here for details); however updating the operating system to conform to the application's language settings extends beyond this and is ultimately the desired goal.
Suggestions and/or workarounds would be appreciated.
Click the Start button, and then click Control Panel. Click Clock, Language, and Region, and then click Regional and Language Options. The Regional and Language Options dialog box appears. On the Formats tab, under Current format, click Customize this format.
To change the system region settings on Windows 11, use these steps: Open Settings. Click on Time & language. Click the Language & region page on the right side.
The only solution I managed to implement was to modify the registry. In Windows 7, when the language is changed, a new entry is added to the Registry in the subkey: HKEY_CURRENT_USER\Control Panel\Desktop
. This key will contain the entry PreferredUILanguagesPending
of type REG_MULTI_SZ
and its value will determine the UI language. For the change to be applied the current user needs to log off and log in again. This can be done using the following code:
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
string[] lang = {"en-ZA"};
key.SetValue("PreferredUILanguagesPending", lang, RegistryValueKind.MultiString);
The language pack needs to be installed before it can be set. For a list of language packs check here or here. When more than 1 language pack is installed option to change the UI language will appear in Control Panel > Region and Language > Keyboards and Languages > Display language
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With