title: Setting the language and region settings in a Windows Docker Container
body: <p>I'm creating a docker container based on the <code>mcr.microsoft.com/dotnet/framework/runtime:4.8</code> base image. </p>
  
  <p>This image is set to <code>en_US</code>, meaning that all the Windows language and region settings and default location is set to United States. </p>
  
  <p>What I need to do is to change this to <code>en_GB</code> and change the location to <code>United Kindom</code> for the default user because I have a .Net application which has a dependency on a 3rd party library that uses this to output data to Excel. However nothing I've tried seems to be able to change the language and region settings thus far. </p>
  
  <p>Things I have tried so far: </p>
  
  <ol>
  <li>Attempted to use the <code>intl.cpl</code> International Settings to import the settings and update the default user: </li>
  </ol>
  
  <pre><code># Set Locale and language 
  &amp; $env:SystemRoot\System32\control.exe "intl.cpl,,/f:`"UKRegion.xml`""
  
  # Set Languages/culture
  Set-Culture en-GB
  </code></pre>
  
  <p>Contents of UKRegion.xml: </p>
  
  <pre><code>&lt;gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend"&gt;
      &lt;!--User List--&gt;
      &lt;gs:UserList&gt;
          &lt;gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/&gt; 
      &lt;/gs:UserList&gt;
  
      &lt;!-- user locale --&gt;
      &lt;gs:UserLocale&gt; 
          &lt;gs:Locale Name="en-GB" SetAsCurrent="true"/&gt; 
      &lt;/gs:UserLocale&gt;
  
      &lt;!-- system locale --&gt;
      &lt;gs:SystemLocale Name="en-GB"/&gt;
      &lt;!-- GeoID --&gt;
  
      &lt;gs:LocationPreferences&gt;
          &lt;gs:GeoID Value="242"/&gt;
      &lt;/gs:LocationPreferences&gt;
  
      &lt;gs:MUILanguagePreferences&gt;
          &lt;gs:MUILanguage Value="en-GB"/&gt;
          &lt;gs:MUIFallback Value="en-US"/&gt;
      &lt;/gs:MUILanguagePreferences&gt;
  
      &lt;!-- input preferences --&gt;
      &lt;gs:InputPreferences&gt;
          &lt;!--en-GB--&gt;
          &lt;gs:InputLanguageID Action="add" ID="0809:00000809" Default="true"/&gt; 
      &lt;/gs:InputPreferences&gt;
  &lt;/gs:GlobalizationServices&gt;
  </code></pre>
  
  <ol start="2">
  <li>Setting the values before starting the application in a <code>powershell</code> script: </li>
  </ol>
  
  <pre><code>Set-WinSystemLocale -SystemLocale en-GB
  Set-WinHomeLocation -GeoId 242
  Set-WinUserLanguageList -LanguageList (New-WinUserLanguageList -Language en-GB) -Force
  Set-Location -Path "C:\\AppFolder"
  .\AppExe.exe
  </code></pre>
  
  <p>After setting up the container and attaching I can see that <code>Get-WinHomeLocation</code> has updated, <code>Get-WinUserLanguageList</code> shows <code>en_GB</code> as an option, however the default language for windows from <code>Get-WinSystemLocale</code> still returns <code>en-US</code></p>
  
  <p>I also considered building my own base image from the en-GB Windows Server Core base image and running the framework setup that Microsoft runs to create the Framework runtime 4.8 image, but Microsoft don't seem to publish an en-GB base image! </p>
  
  <p>Has anyone else come across this? How did you resolve it? Any other suggestions?</p>