[PATCH v2] testbot: Tweak the locale display names.

Francois Gouget fgouget at codeweavers.com
Fri Nov 23 09:21:06 CST 2018


Omit the country name when the default is obvious and shorten some
exceedingly long ones.
Manually decode the Konkani language name since code2language() does not
seem to know about it.
Show the locale modifier if any to distinguish between cyrillic and
latin versions of some languages.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---

Added some more tweaks...

 testbot/lib/WineTestBot/Utils.pm | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/testbot/lib/WineTestBot/Utils.pm b/testbot/lib/WineTestBot/Utils.pm
index dbba1c9965..08c687830f 100644
--- a/testbot/lib/WineTestBot/Utils.pm
+++ b/testbot/lib/WineTestBot/Utils.pm
@@ -117,10 +117,26 @@ sub BuildEMailRecipient($$)
 sub LocaleName($)
 {
   my ($Locale) = @_;
+  $Locale ||= "en_US"; # default
 
-  if ($Locale =~ /^([a-z]+)_([A-Z]+)(?:\.|$)/)
+  if ($Locale =~ /^([a-z]+)_([A-Z]+)(?:\.[A-Z0-9-]+)?(?:@([a-z]+))?$/)
   {
-    return (code2language($1) || $1) .":". (code2country($2) || $2);
+    my ($Lang, $Country, $Modifier) = ($1, $2, $3);
+    my $Name = $Lang eq "kok" ? "Konkani" :
+               (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";
+    }
+
+    $Name .= " ($Modifier)" if ($Modifier);
+    return $Name;
   }
   return $Locale;
 }
-- 
2.19.1



More information about the wine-devel mailing list