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;
See for instance the Armenian locale (hy).
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/SetWinLocale | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale index 654ec46a41..f725e30fd7 100755 --- a/testbot/bin/SetWinLocale +++ b/testbot/bin/SetWinLocale @@ -661,13 +661,17 @@ sub GetWinKeyboardIds($) }
# Look for the locale's keyboard id(s). + my %WinLayouts; foreach my $VName (keys %$Values) { - next if ($VName !~ /^[0-9A-F]{4}:/); - $WinKeyboardIds{$Locale} = [$VName]; - last; + # The value is the keyboard layout's preference order + $WinLayouts{hex($Values->{$VName})} = $VName if ($VName =~ /^[0-9A-F]{4}:/); + } + $WinKeyboardIds{$Locale} = %WinLayouts ? [] : $Keyboards{$Locale}; + foreach my $Index (sort { $a cmp $b } keys %WinLayouts) + { + push @{$WinKeyboardIds{$Locale}}, $WinLayouts{$Index}; } - $WinKeyboardIds{$Locale} ||= $Keyboards{$Locale}; if (!$WinKeyboardIds{$Locale}) { FatalError("could not find the $Locale LCID and keyboard ids. Maybe the locale is not installed?\n");