[tools 2/2] testbot/SetWinLocale: Windows may use an alternate display language.
Francois Gouget
fgouget at codeweavers.com
Wed Feb 2 08:05:05 CST 2022
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>
---
This is also why the TestBot's Windows VMs used ar-EG instead of ar-MA
like the Debian VMs. Now either would work.
---
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 78c838465f..0d4c305ceb 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 a79d3c92fd..e6025216bf 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"
--
2.30.2
More information about the wine-devel
mailing list