diff options
author | ume <ume@FreeBSD.org> | 2016-06-19 03:44:32 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2016-06-19 03:44:32 +0000 |
commit | ba73a9e6514c95236c4f7b7b65336c567e2538ba (patch) | |
tree | 8bcd6a968f0471eb24121e4d59b5facf3cba695d /tools | |
parent | edc65efd22d0ece48ac338be57dc1d733565eccb (diff) | |
download | FreeBSD-src-ba73a9e6514c95236c4f7b7b65336c567e2538ba.zip FreeBSD-src-ba73a9e6514c95236c4f7b7b65336c567e2538ba.tar.gz |
- Prefer to use %d over %e where the day of the month should be zero
filled.
- Since %e means the day of the month as well, regard %e as same as %d
in md_order.
Reported by: vangyzen
Approved by: re (gjb)
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/tools/locale/tools/cldr2def.pl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/tools/locale/tools/cldr2def.pl b/tools/tools/locale/tools/cldr2def.pl index 2dbdf2c..11a1092 100755 --- a/tools/tools/locale/tools/cldr2def.pl +++ b/tools/tools/locale/tools/cldr2def.pl @@ -68,6 +68,7 @@ my %callback = ( mdorder => \&callback_mdorder, altmon => \&callback_altmon, cformat => \&callback_cformat, + dformat => \&callback_dformat, dtformat => \&callback_dtformat, cbabmon => \&callback_abmon, cbampm => \&callback_ampm, @@ -183,10 +184,9 @@ if ($TYPE eq "timedef") { "abday" => "as", "day" => "as", "t_fmt" => "s", - "d_fmt" => "s", + "d_fmt" => "<dformat<d_fmt<s", "c_fmt" => "<cformat<d_t_fmt<s", "am_pm" => "<cbampm<am_pm<as", - "d_fmt" => "s", "d_t_fmt" => "<dtformat<d_t_fmt<s", "altmon" => "<altmon<mon<as", "md_order" => "<mdorder<d_fmt<s", @@ -225,6 +225,14 @@ sub callback_cformat { return $s; }; +sub callback_dformat { + my $s = shift; + + $s =~ s/(%m(<SOLIDUS>|[-.]))%e/$1%d/; + $s =~ s/%e((<SOLIDUS>|[-.])%m)/%d$1/; + return $s; +}; + sub callback_dtformat { my $s = shift; my $nl = $callback{data}{l} . "_" . $callback{data}{c}; @@ -241,7 +249,8 @@ sub callback_dtformat { sub callback_mdorder { my $s = shift; return undef if (!defined $s); - $s =~ s/[^dm]//g; + $s =~ s/[^dem]//g; + $s =~ s/e/d/g; return $s; }; |