From owner-svn-src-head@freebsd.org Sun Nov 8 19:08:40 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E588A29CEE; Sun, 8 Nov 2015 19:08:40 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5BE81F32; Sun, 8 Nov 2015 19:08:39 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tA8J8crO067525; Sun, 8 Nov 2015 19:08:38 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tA8J8cs4067524; Sun, 8 Nov 2015 19:08:38 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201511081908.tA8J8cs4067524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 8 Nov 2015 19:08:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290554 - head/tools/tools/locale/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2015 19:08:40 -0000 Author: bapt Date: Sun Nov 8 19:08:38 2015 New Revision: 290554 URL: https://svnweb.freebsd.org/changeset/base/290554 Log: 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 Modified: head/tools/tools/locale/tools/cldr2def.pl Modified: head/tools/tools/locale/tools/cldr2def.pl ============================================================================== --- head/tools/tools/locale/tools/cldr2def.pl Sun Nov 8 18:48:35 2015 (r290553) +++ head/tools/tools/locale/tools/cldr2def.pl Sun Nov 8 19:08:38 2015 (r290554) @@ -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" => " "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)>/ || + ($_ =~ /^"/ && $_ !~ /^"(||)/)) + { + $_ =~ s/^"/"/; + } + push @cleaned, $_; + } + return join(";",@cleaned); + } + return $s; +} + ############################ sub get_unidata {