Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/SetWinLocale | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale index 42a106b77d..654ec46a41 100755 --- a/testbot/bin/SetWinLocale +++ b/testbot/bin/SetWinLocale @@ -170,6 +170,7 @@ my %Countries = ( "ZA" => 209, # South Africa );
+# Map the locale identifier to the Windows keyboard id my %Keyboards = ( "af-ZA" => ["0436:00000409"], # Afrikaans - South Africa "ar-EG" => ["0c01:00000401"], # Arabic - Egypt @@ -253,6 +254,13 @@ my %Keyboards = ( "zh-TW" => ["0404:00000404"], # Chinese - Taiwan );
+# Some Windows locale names are different and do not match the usual format +my %LocaleInfoKeys = ( + "mn-CN" => "mn-Mong", + "mn-MN" => "mn-Mong-MN", + "zh-CN" => "zh-Hans-CN", +); +
# # Command line processing @@ -642,15 +650,17 @@ sub GetWinKeyboardIds($) { my ($Locale) = @_;
- # Look for that locale's keyboard id. - # Its first component is the locale's LCID. - my $Values = RegGetValues("$HKCU_USER_PROFILE\$Locale", "*:*"); + # The locale information is sometimes stored in a key with a non-standard + # name, despite the standard locale name being used everywhere else! + my $Key = $LocaleInfoKeys{$Locale} || $Locale; + my $Values = RegGetValues("$HKCU_USER_PROFILE\$Key", "*:*"); if (!%$Values) { - my $Lang = $Locale; - $Lang =~ s/-.*$//; - $Values = RegGetValues("$HKCU_USER_PROFILE\$Lang", "*:*"); + $Key =~ s/-.*$//; + $Values = RegGetValues("$HKCU_USER_PROFILE\$Key", "*:*"); } + + # Look for the locale's keyboard id(s). foreach my $VName (keys %$Values) { next if ($VName !~ /^[0-9A-F]{4}:/); @@ -663,6 +673,7 @@ sub GetWinKeyboardIds($) FatalError("could not find the $Locale LCID and keyboard ids. Maybe the locale is not installed?\n"); }
+ # The first component of the keyboard id is the locale's LCID. my $WinLCID = uc($WinKeyboardIds{$Locale}->[0]); $WinLCID =~ s/:.*$//; $WinLCIDs{$Locale} = $WinLCID;