Published in Articles on by Michiel van Oosterhout ~ 7 min read

The Settings app in Windows 11 has a Language & region page. The settings on this page affect a lot of applications in Windows, even command-line programs (e.g. Windows Command Processor's built-in dir command's display of date and time). We can use Windows PowerShell to make changes to these settings. But before do, we should understand what it is that we are changing.

(Don't care? Then skip to the code!)

Locale

Let's first answer the question asked by George Costanza in the image below: the Dutch are a people native to the Netherlands, a country that is also colloquially called Holland. Dutch is the official language of both the Netherlands and Belgium (a country to the south of the Netherlands). There are some differences in the Dutch language between these countries. This is kind of similar to the way the English language differs between the United Kingdom and the United States (e.g. lift vs. elevator).

"Then who are the Dutch?"
"Then who are the Dutch?" George Costanza, Seinfeld

These differences mean that a Windows built-in feature like spellchecking must be able to distinguish between multiple variations of a single language. For this Windows has the concept of locale, a combination of language and country or region, e.g. Dutch (Netherlands) or Dutch (Belgium).

Locale identifier

We can use a language tag to refer to a locale more succinctly. For example, the language tags nl-NL and nl-BE correspond to the examples given at the end of the previous section. But historically Windows has used the locale identifier (LCID) to refer to locales. This is a 16-bit value; the lower 8 bits holds the value for the language, the upper 8 bits hold the value for the region 1. For example, en-US is 9 (English) + 1 (United States) * 1024 = 1033. nl-NL and nl-BE are 19 (Dutch) + 1 (the Netherlands) * 1024 = 1043 and 19 (Dutch) + 2 (Belgium) * 1024 = 2067 respectively.

Country or region Upper 8 bits Language Lower 8 bits Locale ID
United States 1 English 9 1033
Netherlands 1 Dutch 19 1043
Belgium 2 Dutch 19 2067

Sometimes you may see a locale ID displayed as a hexadecimal value, e.g. 409 for English (United States).

Keyboard layout

English can be easily written using the traditional US keyboard layout. But other languages benefit from different layouts. The Turkish alphabet for example, includes ç, ğ, ı, ö, ş, and ü, so writing Turkish is easier when using the Turkish Q keyboard layout. Keys mapped to [ and ] in the US layout are mapped to ğ and ü in the Turkish layout. In the Turkish layout the right Alt key is then also modifier that, when pressed, changes the mapping for some keys. So holding the modifier key and pressing the 8 or 9 keys inputs [ and ] respectively.

Windows includes many different keyboard layouts 2. Any keyboard layout can be associated with any locale in Windows. But normally you'd associate a keyboard layout with the locale it was designed for. So for example United States-International layout with English (United Stated), Dutch with Dutch (Netherlands), and Belgian (Comma) with Dutch (Belgium).

When more than one language and/or more than one keyboard layout is available, Windows shows the input switcher in the taskbar. This can be used to switch the language (for spellchecking) and keyboard layout (how the keys you press are mapped to input).

Regional formats

A regional format refers to the way dates, times, and numbers are displayed by Windows. For example, 2 o'clock in the afternoon of the 31st of Januari 2023 can be displayed in several ways 3. Here are some examples:

  • 1/31/2023 2:00 PM English (United States)
  • 31-1-2023 14:00 Dutch (Netherland)
  • 31.01.2023 14:00 German (Germany)

The dir command in Windows Command Processor will display the date and time of every file and directory using the current regional format.

Windows 11 language & region settings

Language

The first section of the Language & region page is titled Language. Here, the first setting allows us to change the Windows display language. This setting changes the default language used by Windows, for example in the Settings app itself, or in Windows Explorer. The languages listed below this setting determine the available choices for the display language.

Windows 11 language & region settings
Windows 11 language & region settings

Languages added to Windows have features, which can be individually selected when adding the language. The basic typing feature supports the spellchecker (Highlight misspelled words and Autocorrect misspelled words). The language pack feature makes the language available as a Windows display language. (There are more features, but we will not discuss them here.)

Each language also has its own Keyboards setting, a list of keyboard layouts associated with the language.

Region

The Country or region setting is related to content (e.g. news, weather). The Regional format setting's available options depend on the languages added to Windows (but not on their selected features).

Using Windows PowerShell

As stated in the introduction, we can automating the language, keyboard layout, region, and regional format settings using Windows PowerShell.

Language

The Windows PowerShell script below replaces the list of languages with a single language with two languages, and associates the same keyboard layout with both languages.

# Ensure we can use the types in the International module
Import-Module International

# Define two locale IDs
$languageEnglish = 9
$regionUnitedStates = 1
$localeEnglishUnitedStates = $languageEnglish + ($regionUnitedStates -shl 10)

$languageDutch = 19
$regionNetherlands = 1
$localeDutchNetherlands = $languageDutch + ($regionNetherlands -shl 10)

# Define the keyboard layout
$variantApple = 0xa000
$layoutDutchApple = $localeDutchNetherlands + ($variantApple -shl 16)

# Define the input methods (locale + keyboard layout)
$inputEnglishUnitedStatesDutchApple = "{0:X4}:{1:X8}" -f $localeEnglishUnitedStates,$layoutDutchApple
$inputDutchNetherlandsDutchApple = "{0:X4}:{1:X8}" -f $localeDutchNetherlands,$layoutDutchApple

# Create a list of languages, starting with English (United States)
$languages = New-WinUserLanguageList -Language "en-US"
$languages[0].InputMethodTips.Clear()
$languages[0].InputMethodTips.Add($inputEnglishUnitedStatesDutchApple)

# Add Dutch (Netherlands)
$language = [Microsoft.InternationalSettings.Commands.WinUserLanguage]::new("nl-NL")
$language.InputMethodTips.Clear()
$language.InputMethodTips.Add($inputDutchNetherlandsDutchApple)
$language.Spellchecking = $True
$languages.Add($language)

# Set the Windows language
Set-WinUserLanguageList -Force -LanguageList $languages

The new language list is created with a single entry for English (United States) (en-US), and a single input language keyboard layout is associated with this entry: Dutch (Apple) (0409:A0000413, note the first part of this value is the locale ID corresponding to en-US).

Then the entry Dutch (Netherlands) is added, associated with the same keyboard layout. Although we set the Spellchecking property to true, this does not seem to result in the Basic typing feature being installed. It turns out such features must be installed using DISM.exe 4:

(DISM.exe requires an elevated command-line shell session.)

DISM.exe /Online /add-capability /CapabilityName:Language.Basic~~~nl-nl~0.0.1.0

The status of the language feature can be queried as well:

DISM.exe /Online /Get-CapabilityInfo /CapabilityName:Language.Basic~~~en-US~0.0.1.0

(Note that we use a language tag to create new entries for this list, but that we need to use locale ID values for the InputMethodTips.)

Windows 11 input switcher
Windows 11 input switcher

Region

The Windows PowerShell script below adjusts both region settings:

# Define the region we want to set
$netherlands = 0xB0

# Set the country or region setting
Set-WinHomeLocation -GeoId $netherlands

# Set the regional format setting
Set-Culture -CultureInfo "nl-NL"

The geographical ID of every supported region is listed in the Table of Geographical Locations. This change may require a restart.

Summary

There are many aspects to Windows' language and region settings, and understanding how they relate will help you write the Windows PowerShell script to set up your system correctly for your unique combination of location, language, and keyboard layout.


  1. See Language Identifiers ↩︎

  2. See Windows keyboard layouts for interactive visual layouts, Default Input Profiles (Input Locales) in Windows, and the keys under the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts key in the Windows registry for the full list of supported layouts on your system. ↩︎

  3. See Date format by country on Wikipedia for an overview. ↩︎

  4. See Features On Demand ↩︎