From owner-freebsd-current@freebsd.org Sat Jun 18 09:10:49 2016 Return-Path: Delivered-To: freebsd-current@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 B3057A77717 for ; Sat, 18 Jun 2016 09:10:49 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from mail.mahoroba.org (ent.mahoroba.org [IPv6:2001:2f0:104:8010::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "asuka.mahoroba.org", Issuer "ca.mahoroba.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BC1502AD5; Sat, 18 Jun 2016 09:10:48 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from vsuiko.mahoroba.org (vsuiko.mahoroba.org [IPv6:2001:2f0:104:8010:a00:27ff:feb0:c2e]) (user=ume mech=DIGEST-MD5 bits=0) by mail.mahoroba.org (8.15.2/8.15.2) with ESMTPSA/inet6 id u5I9AbDS024030 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Sat, 18 Jun 2016 18:10:42 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Sat, 18 Jun 2016 18:10:00 +0900 Message-ID: From: Hajimu UMEMOTO To: Eric van Gyzen Cc: Baptiste Daroussin , freebsd-current@freebsd.org Subject: Re: Date formatting with en_US locale In-Reply-To: <6d8f5e72-b3ab-9aa6-4fb6-1986b7b4f19b@FreeBSD.org> References: <499d8ddd-06c8-5184-68cb-4be19764b318@FreeBSD.org> <20160526144944.GD977@ivaldir.etoilebsd.net> <20160526151508.GE977@ivaldir.etoilebsd.net> <6d8f5e72-b3ab-9aa6-4fb6-1986b7b4f19b@FreeBSD.org> User-Agent: xcite1.60> Wanderlust/2.15.9 (Almost Unreal) Emacs/24.5 Mule/6.0 (HANACHIRUSATO) X-Operating-System: FreeBSD 10.3-STABLE X-PGP-Key: http://www.mahoroba.org/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Sat_Jun_18_18:10:00_2016-1" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6 (mail.mahoroba.org [IPv6:2001:2f0:104:8010::1]); Sat, 18 Jun 2016 18:10:42 +0900 (JST) X-Virus-Scanned: clamav-milter 0.99.2 at asuka.mahoroba.org X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on asuka.mahoroba.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jun 2016 09:10:49 -0000 --Multipart_Sat_Jun_18_18:10:00_2016-1 Content-Type: text/plain; charset=US-ASCII Hi, vangyzen> Above, I mentioned two issues. The other one is, the date format for vangyzen> en_US pads the month with a zero, but the day with a space. So, June 7 is: vangyzen> 06/ 7/16 vangyzen> That looks weird. It should pad both with zeros. I'd be happy to fix vangyzen> it, but I don't see how: There isn't an "xformat" callback in the vangyzen> cldr2def.pl script, and it's not clear how to add one. If you can vangyzen> explain, I'll do it. If you can fix it, I'll be grateful. ;) Does the attached patch fix your issue? Though there are many locales it should be fixed, I've included only en_US one, in this time. Sincerely, --Multipart_Sat_Jun_18_18:10:00_2016-1 Content-Type: text/x-patch; type=patch; charset=US-ASCII Content-Disposition: attachment; filename="x_fmt-zerofill.diff" Content-Transfer-Encoding: 7bit Index: share/timedef/en_US.UTF-8.src =================================================================== --- share/timedef/en_US.UTF-8.src (revision 302002) +++ share/timedef/en_US.UTF-8.src (working copy) @@ -53,7 +53,7 @@ %I:%M:%S %p # # x_fmt -%m/%e/%y +%m/%d/%y # # c_fmt %A, %B %e, %Y at %I:%M:%S %p @@ -80,7 +80,7 @@ December # # md_order -m +md # # ampm_fmt %I:%M:%S %p Index: tools/tools/locale/tools/cldr2def.pl =================================================================== --- tools/tools/locale/tools/cldr2def.pl (revision 302002) +++ tools/tools/locale/tools/cldr2def.pl (working copy) @@ -68,6 +68,7 @@ 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 @@ "abday" => "as", "day" => "as", "t_fmt" => "s", - "d_fmt" => "s", + "d_fmt" => " " " "s", "d_t_fmt" => " " "|[-.]))%e/$1%d/; + $s =~ s/%e((|[-.])%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_mdorder { my $s = shift; return undef if (!defined $s); - $s =~ s/[^dm]//g; + $s =~ s/[^dem]//g; + $s =~ s/e/d/g; return $s; }; --Multipart_Sat_Jun_18_18:10:00_2016-1 Content-Type: text/plain; charset=US-ASCII -- Hajimu UMEMOTO ume@mahoroba.org ume@FreeBSD.org http://www.mahoroba.org/~ume/ --Multipart_Sat_Jun_18_18:10:00_2016-1--