[tools] testbot/SetWinLocale: Accept underscores in the locale names.

Francois Gouget fgouget at codeweavers.com
Tue Dec 21 09:38:29 CST 2021


Also avoid undefined value errors if the locale value is missing.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/bin/SetWinLocale | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale
index 947c1e0d1..d9a9e0340 100755
--- a/testbot/bin/SetWinLocale
+++ b/testbot/bin/SetWinLocale
@@ -279,14 +279,16 @@ sub CheckValue($$)
 sub CheckLocale($$)
 {
   my ($Option, $Value) = @_;
+
   $Value = CheckValue($Option, $Value);
-  if ($Value !~ /^(?:[a-z]{2})-(?:Latn-)?(?:[A-Z]{2})$/)
-  {
-    Error("'$Value' is not a valid $Option locale\n");
-    $Usage = 2;
-    return undef;
-  }
-  return $Value;
+  return undef if (!defined $Value);
+
+  $Value =~ s/_/-/g;
+  return $Value if ($Value =~ /^(?:[a-z]{2})-(?:Latn-)?(?:[A-Z]{2})$/);
+
+  Error("'$Value' is not a valid $Option locale\n");
+  $Usage = 2;
+  return undef;
 }
 
 my ($OptHostName, $OptReboot);
-- 
2.30.2




More information about the wine-devel mailing list