summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-11-08 19:08:38 +0000
committerbapt <bapt@FreeBSD.org>2015-11-08 19:08:38 +0000
commitfd480a439a72378055112be1edc03136a8ca2056 (patch)
treef6eabc98c8bb53f9bc1da6309e1aba5b0bf10386
parent32f0ed67b358127d8ec92f7615d13f8fed0dad9f (diff)
downloadFreeBSD-src-fd480a439a72378055112be1edc03136a8ca2056.zip
FreeBSD-src-fd480a439a72378055112be1edc03136a8ca2056.tar.gz
Modify the tool that generates the locales so that the generated CJK locales
are padded as expected by the users Submitted by: marino Obtained from: DragonflyBSD
-rwxr-xr-xtools/tools/locale/tools/cldr2def.pl28
1 files changed, 27 insertions, 1 deletions
diff --git a/tools/tools/locale/tools/cldr2def.pl b/tools/tools/locale/tools/cldr2def.pl
index c2d59ce..4d59fad 100755
--- a/tools/tools/locale/tools/cldr2def.pl
+++ b/tools/tools/locale/tools/cldr2def.pl
@@ -1,4 +1,5 @@
#!/usr/local/bin/perl -wC
+# $FreeBSD$
use strict;
use File::Copy;
@@ -66,6 +67,7 @@ my %callback = (
mdorder => \&callback_mdorder,
altmon => \&callback_altmon,
cformat => \&callback_cformat,
+ cbabmon => \&callback_abmon,
data => undef,
);
@@ -173,7 +175,7 @@ if ($TYPE eq "msgdef") {
if ($TYPE eq "timedef") {
%keys = (
- "abmon" => "as",
+ "abmon" => "<cbabmon<abmon<as",
"mon" => "as",
"abday" => "as",
"day" => "as",
@@ -226,6 +228,30 @@ sub callback_altmon {
return $s;
}
+sub callback_abmon {
+ # for specified CJK locales, pad result with a space to enable
+ # columns to line up (style established in FreeBSD in 2001)
+ my $s = shift;
+ my $nl = $callback{data}{l} . "_" . $callback{data}{c};
+
+ if ($nl eq 'ja_JP' || $nl eq 'ko_KR' || $nl eq 'zh_CN' ||
+ $nl eq 'zh_HK' || $nl eq 'zh_TW') {
+ my @monthnames = split(";", $s);
+ my @cleaned;
+ foreach (@monthnames)
+ {
+ if ($_ =~ /^"<(two|three|four|five|six|seven|eight|nine)>/ ||
+ ($_ =~ /^"<one>/ && $_ !~ /^"<one>(<zero>|<one>|<two>)/))
+ {
+ $_ =~ s/^"/"<space>/;
+ }
+ push @cleaned, $_;
+ }
+ return join(";",@cleaned);
+ }
+ return $s;
+}
+
############################
sub get_unidata {
OpenPOWER on IntegriCloud