Omit the country name when the default is obvious and shorten some exceedingly long ones.
Signed-off-by: Francois Gouget fgouget@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; }
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 ---
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; }