Francois Gouget : testbot/SetWinLocale: Windows may use an alternate display language.

Alexandre Julliard julliard at winehq.org
Wed Feb 2 16:36:10 CST 2022


Module: tools
Branch: master
Commit: 476e2f95aab9e8c677a08e5a665532f6a1923831
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=476e2f95aab9e8c677a08e5a665532f6a1923831

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Feb  2 15:05:05 2022 +0100

testbot/SetWinLocale: Windows may use an alternate display language.

For instance intl.cpl fails to set it to en-CA while the Powershell
APIs automatically convert it to en-GB. Take this into account before
checking that the locale modifications succeeded.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/bin/SetWinLocale     |  7 +++++++
 testbot/bin/SetWinLocale.ps1 | 15 +++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale
index 78c8384..0d4c305 100755
--- a/testbot/bin/SetWinLocale
+++ b/testbot/bin/SetWinLocale
@@ -543,6 +543,9 @@ if (defined $Usage)
   print "                               Set-WinSystemLocale for the relevant locales.\n";
   print "  --mui MUI      Specifies the display language (see --defaults).\n";
   print "                 . Only takes effect after a log out + log in.\n";
+  print "                 . Windows sometimes uses a different locale string. For\n";
+  print "                   instance setting the display language to English (Canada) sets\n";
+  print "                   this to en-GB instead of en-CA.\n";
   print "                 . Windows 10 GUI: Time & language -> Language -> Windows\n";
   print "                   display language.\n";
   print "                 . APIs: GetSystemPreferredUILanguages() (--sys-copy case),\n";
@@ -862,6 +865,10 @@ sub SetWinLocales($$$$$$$$)
       $OptSystem = "en-US";
       $LCIDSystem = "0409";
     }
+    elsif ($Line =~ /^Windows uses (.*) for the MUI language/)
+    {
+      $OptMUI = $1; # for the final check
+    }
   }
 }
 
diff --git a/testbot/bin/SetWinLocale.ps1 b/testbot/bin/SetWinLocale.ps1
index 2ab286d..ed8fa29 100644
--- a/testbot/bin/SetWinLocale.ps1
+++ b/testbot/bin/SetWinLocale.ps1
@@ -189,6 +189,7 @@ function SetCodePages($Value)
 }
 
 $SWC_Success = $True
+$SWC_MUI = $null
 
 function SetWinCulture([string]$Locale, [string]$CountryId, [string]$System, [string]$UTF8, [string]$MUI, [string]$KeyboardId, [bool]$SysCopy, [bool]$DefCopy)
 {
@@ -217,7 +218,16 @@ function SetWinCulture([string]$Locale, [string]$CountryId, [string]$System, [st
     }
   }
   if ($UTF8 -eq "force") { SetCodePages(65001) }
-  if ($MUI) { Set-WinUILanguageOverride $MUI }
+  if ($MUI)
+  {
+    Set-WinUILanguageOverride $MUI
+    $WinMUI = Get-ItemProperty -Path $HKCU_DESKTOP -Name "PreferredUILanguagesPending" -ErrorAction SilentlyContinue
+    $global:SWC_MUI = $WinMUI.PreferredUILanguagesPending
+    if ($SWC_MUI -ne $MUI)
+    {
+      Write-Output "Windows uses $SWC_MUI for the MUI language instead of $MUI"
+    }
+  }
   if ($KeyboardId) { Set-WinDefaultInputMethodOverride $KeyboardId }
   if ($SysCopy -or $DefCopy)
   {
@@ -282,7 +292,8 @@ function SetLocales($Argv)
     Write-Output "Falling back to intl.cpl"
   }
 
-  WriteIntlCplConfig $Locale $CountryId $System $MUI $KeyboardId $SysCopy $DefCopy >"$Name0.xml"
+  if ($SWC_MUI -eq $null) { $global:SWC_MUI = $MUI }
+  WriteIntlCplConfig $Locale $CountryId $System $SWC_MUI $KeyboardId $SysCopy $DefCopy >"$Name0.xml"
   RunIntlCpl "$Name0.xml"
   Remove-Item -Path "$Name0.xml"
 




More information about the wine-cvs mailing list