Module: tools Branch: master Commit: b745774ef8c4e24e310c5837a45dec79e957c032 URL: https://source.winehq.org/git/tools.git/?a=commit;h=b745774ef8c4e24e310c5837...
Author: Francois Gouget fgouget@codeweavers.com Date: Fri Nov 23 16:21:06 2018 +0100
testbot: Tweak the locale display names.
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@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 a80f809..6783c51 100644 --- a/testbot/lib/WineTestBot/Utils.pm +++ b/testbot/lib/WineTestBot/Utils.pm @@ -109,10 +109,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; }