Author: bapt Date: Sun May 29 22:27:42 2016 New Revision: 300975 URL: https://svnweb.freebsd.org/changeset/base/300975
Log: 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 Modified: head/tools/tools/locale/tools/cldr2def.pl Modified: head/tools/tools/locale/tools/cldr2def.pl ============================================================================== --- head/tools/tools/locale/tools/cldr2def.pl Sun May 29 20:54:16 2016 (r300974) +++ head/tools/tools/locale/tools/cldr2def.pl Sun May 29 22:27:42 2016 (r300975) @@ -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; }; _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"