Add more hacks to correct CLDR data

For Russian:
- Convert AM/PM which are badly formatted in CLDR to replace it by the proper
  cyrillic
- Add a dependency on Text::Iconv so non unicode get the proper encoding for
  AM/PM
- fix the date format having 'r.,' and convert it to 'r.' (also fixed in Bulgarian)

For All:
- Use complete Day of Week instead of the abbreviated one

Reported by:	ache
This commit is contained in:
Baptiste Daroussin 2016-05-29 22:27:42 +00:00
parent f8789c6b84
commit 70f0a8136c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300975

View File

@ -5,6 +5,7 @@ use strict;
use File::Copy;
use XML::Parser;
use Tie::IxHash;
use Text::Iconv;
use Data::Dumper;
use Getopt::Long;
use Digest::SHA qw(sha1_hex);
@ -69,6 +70,7 @@ my %callback = (
cformat => \&callback_cformat,
dtformat => \&callback_dtformat,
cbabmon => \&callback_abmon,
cbampm => \&callback_ampm,
data => undef,
);
@ -183,7 +185,7 @@ if ($TYPE eq "timedef") {
"t_fmt" => "s",
"d_fmt" => "s",
"c_fmt" => "<cformat<d_t_fmt<s",
"am_pm" => "as",
"am_pm" => "<cbampm<am_pm<as",
"d_fmt" => "s",
"d_t_fmt" => "<dtformat<d_t_fmt<s",
"altmon" => "<altmon<mon<as",
@ -195,12 +197,31 @@ if ($TYPE eq "timedef") {
make_makefile();
}
sub callback_ampm {
my $s = shift;
my $nl = $callback{data}{l} . "_" . $callback{data}{c};
my $enc = $callback{data}{e};
my $converter = Text::Iconv->new("utf-8", "$enc");
if ($nl eq 'ru_RU') {
if ($enc eq 'UTF-8') {
$s = 'дп;пп';
} else {
$s = $converter->convert("дп;пп");
}
}
return $s;
}
sub callback_cformat {
my $s = shift;
my $nl = $callback{data}{l} . "_" . $callback{data}{c};
$s =~ s/\.,/\./;
$s =~ s/ %Z//;
$s =~ s/ %z//;
$s =~ s/^"(%B %e, )/"%a, $1/;
$s =~ s/^"(%e %B )/"%a $1/;
$s =~ s/^"(%B %e, )/"%A, $1/;
$s =~ s/^"(%e %B )/"%A $1/;
return $s;
};
@ -211,8 +232,9 @@ sub callback_dtformat {
if ($nl eq 'ja_JP') {
$s =~ s/(> )(%H)/$1%A $2/;
}
$s =~ s/^"(%B %e, )/"%a, $1/;
$s =~ s/^"(%e %B )/"%a $1/;
$s =~ s/\.,/\./;
$s =~ s/^"(%B %e, )/"%A, $1/;
$s =~ s/^"(%e %B )/"%A $1/;
return $s;
};