From: John Marino Date: Sun, 8 Nov 2015 16:47:44 +0000 (+0100) Subject: cldr2def: Pad CJK short months X-Git-Tag: v4.5.0~138 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/fb572e12d4eae3f415ca6a464aecbd14bdbde4ce cldr2def: Pad CJK short months Since 2001, FreeBSD has padded the first 9 abbreviated month names with a space for the CJK locales. This allows them to line up. This alternation will return the padding to avoid a regression for users (and avoid having to hand-edit the source files) --- diff --git a/share/timedef/ja_JP.SJIS.src b/share/timedef/ja_JP.SJIS.src index 7a9030b704..3c96a378ab 100644 --- a/share/timedef/ja_JP.SJIS.src +++ b/share/timedef/ja_JP.SJIS.src @@ -4,15 +4,15 @@ # ----------------------------------------------------------------------------- # # Short month names -1ŒŽ -2ŒŽ -3ŒŽ -4ŒŽ -5ŒŽ -6ŒŽ -7ŒŽ -8ŒŽ -9ŒŽ + 1ŒŽ + 2ŒŽ + 3ŒŽ + 4ŒŽ + 5ŒŽ + 6ŒŽ + 7ŒŽ + 8ŒŽ + 9ŒŽ 10ŒŽ 11ŒŽ 12ŒŽ diff --git a/share/timedef/ja_JP.UTF-8.src b/share/timedef/ja_JP.UTF-8.src index f713bbbf7e..ea2fcbe2d3 100644 --- a/share/timedef/ja_JP.UTF-8.src +++ b/share/timedef/ja_JP.UTF-8.src @@ -4,15 +4,15 @@ # ----------------------------------------------------------------------------- # # Short month names -1月 -2月 -3月 -4月 -5月 -6月 -7月 -8月 -9月 + 1月 + 2月 + 3月 + 4月 + 5月 + 6月 + 7月 + 8月 + 9月 10月 11月 12月 diff --git a/share/timedef/ja_JP.eucJP.src b/share/timedef/ja_JP.eucJP.src index 9b527aadd0..f98c832b91 100644 --- a/share/timedef/ja_JP.eucJP.src +++ b/share/timedef/ja_JP.eucJP.src @@ -4,15 +4,15 @@ # ----------------------------------------------------------------------------- # # Short month names -1·î -2·î -3·î -4·î -5·î -6·î -7·î -8·î -9·î + 1·î + 2·î + 3·î + 4·î + 5·î + 6·î + 7·î + 8·î + 9·î 10·î 11·î 12·î diff --git a/share/timedef/ko_KR.UTF-8.src b/share/timedef/ko_KR.UTF-8.src index 30da57ee8a..cce1aa7b67 100644 --- a/share/timedef/ko_KR.UTF-8.src +++ b/share/timedef/ko_KR.UTF-8.src @@ -4,15 +4,15 @@ # ----------------------------------------------------------------------------- # # Short month names -1월 -2월 -3월 -4월 -5월 -6월 -7월 -8월 -9월 + 1월 + 2월 + 3월 + 4월 + 5월 + 6월 + 7월 + 8월 + 9월 10월 11월 12월 diff --git a/share/timedef/ko_KR.eucKR.src b/share/timedef/ko_KR.eucKR.src index 71ddca544f..c72ae4bd87 100644 --- a/share/timedef/ko_KR.eucKR.src +++ b/share/timedef/ko_KR.eucKR.src @@ -4,15 +4,15 @@ # ----------------------------------------------------------------------------- # # Short month names -1¿ù -2¿ù -3¿ù -4¿ù -5¿ù -6¿ù -7¿ù -8¿ù -9¿ù + 1¿ù + 2¿ù + 3¿ù + 4¿ù + 5¿ù + 6¿ù + 7¿ù + 8¿ù + 9¿ù 10¿ù 11¿ù 12¿ù diff --git a/share/timedef/zh_Hans_CN.GB2312.src b/share/timedef/zh_Hans_CN.GB2312.src index 89f2ee6072..8fb3026f1a 100644 --- a/share/timedef/zh_Hans_CN.GB2312.src +++ b/share/timedef/zh_Hans_CN.GB2312.src @@ -4,15 +4,15 @@ # ----------------------------------------------------------------------------- # # Short month names -#1TB -#2TB -#3TB -#4TB -#5TB -#6TB -#7TB -#8TB -#9TB +!!#1TB +!!#2TB +!!#3TB +!!#4TB +!!#5TB +!!#6TB +!!#7TB +!!#8TB +!!#9TB #1#0TB #1#1TB #1#2TB diff --git a/share/timedef/zh_Hans_CN.GBK.src b/share/timedef/zh_Hans_CN.GBK.src index 02f30f3f8f..af4552b5be 100644 --- a/share/timedef/zh_Hans_CN.GBK.src +++ b/share/timedef/zh_Hans_CN.GBK.src @@ -4,15 +4,15 @@ # ----------------------------------------------------------------------------- # # Short month names -1Ô -2Ô -3Ô -4Ô -5Ô -6Ô -7Ô -8Ô -9Ô + 1Ô + 2Ô + 3Ô + 4Ô + 5Ô + 6Ô + 7Ô + 8Ô + 9Ô 10Ô 11Ô 12Ô diff --git a/share/timedef/zh_Hans_CN.UTF-8.src b/share/timedef/zh_Hans_CN.UTF-8.src index 1d56b0002b..2b54f711af 100644 --- a/share/timedef/zh_Hans_CN.UTF-8.src +++ b/share/timedef/zh_Hans_CN.UTF-8.src @@ -4,15 +4,15 @@ # ----------------------------------------------------------------------------- # # Short month names -1月 -2月 -3月 -4月 -5月 -6月 -7月 -8月 -9月 + 1月 + 2月 + 3月 + 4月 + 5月 + 6月 + 7月 + 8月 + 9月 10月 11月 12月 diff --git a/share/timedef/zh_Hans_CN.eucCN.src b/share/timedef/zh_Hans_CN.eucCN.src index c2be94162b..39884d344c 100644 --- a/share/timedef/zh_Hans_CN.eucCN.src +++ b/share/timedef/zh_Hans_CN.eucCN.src @@ -4,15 +4,15 @@ # ----------------------------------------------------------------------------- # # Short month names -£±Ô -£²Ô -£³Ô -£´Ô -£µÔ -£¶Ô -£·Ô -£¸Ô -£¹Ô +¡¡£±Ô +¡¡£²Ô +¡¡£³Ô +¡¡£´Ô +¡¡£µÔ +¡¡£¶Ô +¡¡£·Ô +¡¡£¸Ô +¡¡£¹Ô £±£°Ô £±£±Ô £±£²Ô diff --git a/share/timedef/zh_Hant_HK.Big5HKSCS.src b/share/timedef/zh_Hant_HK.Big5HKSCS.src index f280f23612..af4ce1e19c 100644 --- a/share/timedef/zh_Hant_HK.Big5HKSCS.src +++ b/share/timedef/zh_Hant_HK.Big5HKSCS.src @@ -4,15 +4,15 @@ # ----------------------------------------------------------------------------- # # Short month names -1¤ë -2¤ë -3¤ë -4¤ë -5¤ë -6¤ë -7¤ë -8¤ë -9¤ë + 1¤ë + 2¤ë + 3¤ë + 4¤ë + 5¤ë + 6¤ë + 7¤ë + 8¤ë + 9¤ë 10¤ë 11¤ë 12¤ë diff --git a/share/timedef/zh_Hant_HK.UTF-8.src b/share/timedef/zh_Hant_HK.UTF-8.src index 0200c96538..9fa990c578 100644 --- a/share/timedef/zh_Hant_HK.UTF-8.src +++ b/share/timedef/zh_Hant_HK.UTF-8.src @@ -4,15 +4,15 @@ # ----------------------------------------------------------------------------- # # Short month names -1月 -2月 -3月 -4月 -5月 -6月 -7月 -8月 -9月 + 1月 + 2月 + 3月 + 4月 + 5月 + 6月 + 7月 + 8月 + 9月 10月 11月 12月 diff --git a/share/timedef/zh_Hant_TW.Big5.src b/share/timedef/zh_Hant_TW.Big5.src index 650dce70b2..7f19a1fbf3 100644 --- a/share/timedef/zh_Hant_TW.Big5.src +++ b/share/timedef/zh_Hant_TW.Big5.src @@ -4,15 +4,15 @@ # ----------------------------------------------------------------------------- # # Short month names -¢°¤ë -¢±¤ë -¢²¤ë -¢³¤ë -¢´¤ë -¢µ¤ë -¢¶¤ë -¢·¤ë -¢¸¤ë +¡@¢°¤ë +¡@¢±¤ë +¡@¢²¤ë +¡@¢³¤ë +¡@¢´¤ë +¡@¢µ¤ë +¡@¢¶¤ë +¡@¢·¤ë +¡@¢¸¤ë ¢°¢¯¤ë ¢°¢°¤ë ¢°¢±¤ë diff --git a/share/timedef/zh_Hant_TW.UTF-8.src b/share/timedef/zh_Hant_TW.UTF-8.src index 973ee17909..654df5bbb7 100644 --- a/share/timedef/zh_Hant_TW.UTF-8.src +++ b/share/timedef/zh_Hant_TW.UTF-8.src @@ -4,15 +4,15 @@ # ----------------------------------------------------------------------------- # # Short month names -1月 -2月 -3月 -4月 -5月 -6月 -7月 -8月 -9月 + 1月 + 2月 + 3月 + 4月 + 5月 + 6月 + 7月 + 8月 + 9月 10月 11月 12月 diff --git a/tools/tools/locale/tools/cldr2def.pl b/tools/tools/locale/tools/cldr2def.pl index c2d59ce349..2924dc39f5 100644 --- a/tools/tools/locale/tools/cldr2def.pl +++ b/tools/tools/locale/tools/cldr2def.pl @@ -66,6 +66,7 @@ my %callback = ( mdorder => \&callback_mdorder, altmon => \&callback_altmon, cformat => \&callback_cformat, + cbabmon => \&callback_abmon, data => undef, ); @@ -173,7 +174,7 @@ if ($TYPE eq "msgdef") { if ($TYPE eq "timedef") { %keys = ( - "abmon" => "as", + "abmon" => " "as", "abday" => "as", "day" => "as", @@ -226,6 +227,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)>/ || + ($_ =~ /^"/ && $_ !~ /^"(||)/)) + { + $_ =~ s/^"/"/; + } + push @cleaned, $_; + } + return join(";",@cleaned); + } + return $s; +} + ############################ sub get_unidata {