Francois Gouget : testbot/SetWinLocale: Accept underscores in the locale names.

Alexandre Julliard julliard at winehq.org
Tue Dec 21 15:01:35 CST 2021


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Dec 21 16:38:29 2021 +0100

testbot/SetWinLocale: Accept underscores in the locale names.

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

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

---

 testbot/bin/SetWinLocale | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale
index 7ddbded..4ecc0cb 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);




More information about the wine-cvs mailing list