Add another hack to add weekday to date format to more locales

While here only initialize the iconv converter when needed
This commit is contained in:
Baptiste Daroussin 2016-07-23 11:24:05 +00:00
parent 1d981d8ef5
commit c61bec5792
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=303218

View File

@ -201,12 +201,12 @@ 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 {
my $converter = Text::Iconv->new("utf-8", "$enc");
$s = $converter->convert("дп;пп");
}
}
@ -220,6 +220,7 @@ sub callback_cformat {
$s =~ s/\.,/\./;
$s =~ s/ %Z//;
$s =~ s/ %z//;
$s =~ s/^"%e\./%A %e/;
$s =~ s/^"(%B %e, )/"%A, $1/;
$s =~ s/^"(%e %B )/"%A $1/;
return $s;
@ -241,6 +242,7 @@ sub callback_dtformat {
$s =~ s/(> )(%H)/$1%A $2/;
}
$s =~ s/\.,/\./;
$s =~ s/^"%e\./%A %e/;
$s =~ s/^"(%B %e, )/"%A, $1/;
$s =~ s/^"(%e %B )/"%A $1/;
return $s;