[PATCH] testbot: Tweak the locale names.

Francois Gouget fgouget at codeweavers.com
Wed Nov 21 19:13:44 CST 2018


Omit the country name when the default is obvious and shorten some
exceedingly long ones.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/lib/WineTestBot/Utils.pm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/testbot/lib/WineTestBot/Utils.pm b/testbot/lib/WineTestBot/Utils.pm
index e3c049b91b..47e21dab35 100644
--- a/testbot/lib/WineTestBot/Utils.pm
+++ b/testbot/lib/WineTestBot/Utils.pm
@@ -113,10 +113,23 @@ sub BuildEMailRecipient($$)
 sub LocaleName($)
 {
   my ($Locale) = @_;
+  $Locale ||= "en_US"; # default
 
   if ($Locale =~ /^([a-z]+)_([A-Z]+)(?:\.|$)/)
   {
-    return (code2language($1) || $1) .":". (code2country($2) || $2);
+    my ($Lang, $Country) = ($1, $2);
+    my $Name = code2language($Lang) || $Lang;
+    $Name =~ s/ \(.*$//;
+
+    if (uc($Lang) ne $Country)
+    {
+      my $CountryName = $Country eq "US" ? "USA" :
+                        $Country eq "GB" ? "Great Britain" :
+                        (code2country($Country) || $Country);
+      $CountryName =~ s/(?:, | \().*$//;
+      $Name .= ":$CountryName";
+    }
+    return $Name;
   }
   return $Locale;
 }
-- 
2.19.1




More information about the wine-devel mailing list