This is the mail archive of the
mailing list for the glibc project.
[RFC][PATCH] Multiple locales: Use the correct date and time formats (bug 10496, 23724).
- From: Rafal Luzynski <digitalfreak at lingonborough dot com>
- To: libc-alpha at sourceware dot org
- Date: Fri, 2 Nov 2018 12:11:09 +0100 (CET)
- Subject: [RFC][PATCH] Multiple locales: Use the correct date and time formats (bug 10496, 23724).
I need an advice. Recently I've been working on a change which
initially seemed to be a simple one-liner but eventually turned
out to be updating 80 locales. The change fixes the 12-hour time
formats, adding the AM/PM indicator and changing the hour format.
The locales mostly include those using Arabic language, from India,
and from the region of Eritrea, Ethiopia and Somalia.
My question is: should I treat the CLDR database literally and
change the time formats like "%I:%M:%S" to "%l:%M:%S" whenever CLDR
provides the time format "h:mm:ss"? I spotted this difference while
importing the time formats from CLDR in order to find those which
should use the AM/PM indicator.
The difference is that "%I" is a zero-padded hour number while "%l"
is a space-padded hour number; in CLDR format "h" is an hour number
using as many digits as necessary (no additional padding mentioned).
My doubt is because the original complaint here was about missing the
AM/PM indicator, nobody complained about the clock using the zero-padded
I am afraid that the change is minor and irrelevant and most people's
answer even from the involved countries is "I don't know/I don't care".
So if the glibc community does not provide any sustained objection I will
prepare and eventually commit this change.
As a sample here please find attached a patch for Albanian language.
I'd like to fix this locale as a separate patch because this also
fixes the date formats and it cannot be separated from the time formats.
If accepted I will commit this patch and move to other locales.
I am consulting this change with the people from Albania and India but
I don't know anyone speaking Arabic or living in Eritrea, Ethiopia
From 3ad4684e4546d89d85c9434090b3950db95e34de Mon Sep 17 00:00:00 2001
From: Rafal Luzynski <firstname.lastname@example.org>
Date: Tue, 9 Oct 2018 01:15:33 +0200
Subject: [PATCH] sq_AL: Use the correct date and time formats (bug 10496,
Albanian locale uses the 12-hour clock but some time formats did not
use any AM/PM indicator making the time ambiguous. This commit adds
"%p" wherever it was missing.
It also sets the correct date format because the old "%Y-%b-%d" produced
rather weird results like "2018-Sht-28".
All time formats come from CLDR but as few changes have been introduced
by this commit as possible. Some articles from MSDN and other available
online sources have been also taken into account.
* localedata/locales/sq_AL (t_fmt): Set to "%l:%M:%S.%p %Z".
(d_t_fmt): Set to "%a %-d %b %Y %l:%M:%S.%p".
(date_fmt): Add, set to "%a %-d %b %Y %l:%M:%S.%p %Z".
(d_fmt): Set to "%-d.%-m.%y".
localedata/locales/sq_AL | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/localedata/locales/sq_AL b/localedata/locales/sq_AL
index 9cec37a..a90251f 100644
@@ -303,16 +303,19 @@ mon "janar";/
% Appropriate date and time representation
-d_t_fmt "%Y-%b-%d %I.%M.%S.%p %Z"
+d_t_fmt "%a %-d %b %Y %l:%M:%S.%p"
+% Appropriate date representation for date(1)
+date_fmt "%a %-d %b %Y %l:%M:%S.%p %Z"
% Appropriate date representation
% Appropriate time representation
-t_fmt "%I.%M.%S. %Z"
+t_fmt "%l:%M:%S.%p %Z"
% Appropriate 12 h time representation (%r)
-t_fmt_ampm "%I.%M.%S.%p %Z"
+t_fmt_ampm "%l:%M:%S.%p %Z"