This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] Alternative digits in date/time
- From: Hamed Malek <hamed at bamdad dot org>
- To: libc-alpha <libc-alpha at sources dot redhat dot com>
- Date: Wed, 23 Mar 2005 14:55:34 +0430
- Subject: [PATCH] Alternative digits in date/time
I send this patch again with a screenshot of what we will get by using
this trick in date and time:
http://www.bamdad.org/~hamed/glibc/ldate.png
And the description in my previous mail:
The Single Unix Specification added 'O' modifier for displaying
alternative numeric symbols. This can be used for displaying localized
digits in date/time format. All needed specifiers support it in date and
time except 'Y' (year in four digits). 'O' range is 0 to 99.
This small patch lets us to precede this modifier by 'C' (century
number) to replace it with four digits year by putting %OC%Oy instead of
%Y.
Attached is the strftime patch with needed modifications in fa_IR.
Hamed
--- libc/time/strftime_l.c.orig 2005-03-07 17:18:02.608570646 +0330
+++ libc/time/strftime_l.c 2005-01-25 14:17:26.000000000 +0330
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -879,8 +879,6 @@
#endif
case L_('C'):
- if (modifier == L_('O'))
- goto bad_format;
if (modifier == L_('E'))
{
#if HAVE_STRUCT_ERA_ENTRY
@@ -1432,4 +1430,3 @@
#if defined _LIBC && !defined COMPILE_WIDE
weak_alias (__strftime_l, strftime_l)
#endif
-
--- libc/localedata/locales/fa_IR.orig 2005-03-07 17:08:19.974752967 +0330
+++ libc/localedata/locales/fa_IR 2005-03-07 17:09:20.816877081 +0330
@@ -10,8 +10,8 @@
% Fax: +98 21 6019568
% Language: fa
% Territory: IR
-% Revision: 2.4
-% Date: 2004-09-04
+% Revision: 3.0
+% Date: 2005-01-24
% Users: general
% Repertoiremap:
% Charset: UTF-8
@@ -28,28 +28,31 @@
fax "+98 21 6019568"
language "Persian"
territory "Iran"
-revision "2.3"
-date "2004-03-16"
+revision "3.0"
+date "2005-01-24"
%
-category "fa_IR:2004";LC_IDENTIFICATION
-category "fa_IR:2004";LC_CTYPE
-category "fa_IR:2004";LC_COLLATE
-category "fa_IR:2004";LC_TIME
-category "fa_IR:2004";LC_NUMERIC
-category "fa_IR:2004";LC_MONETARY
-category "fa_IR:2004";LC_MESSAGES
-category "fa_IR:2004";LC_PAPER
-category "fa_IR:2004";LC_NAME
-category "fa_IR:2004";LC_ADDRESS
-category "fa_IR:2004";LC_TELEPHONE
+category "fa_IR:2005";LC_IDENTIFICATION
+category "fa_IR:2005";LC_CTYPE
+category "fa_IR:2005";LC_COLLATE
+category "fa_IR:2005";LC_TIME
+category "fa_IR:2005";LC_NUMERIC
+category "fa_IR:2005";LC_MONETARY
+category "fa_IR:2005";LC_MESSAGES
+category "fa_IR:2005";LC_PAPER
+category "fa_IR:2005";LC_NAME
+category "fa_IR:2005";LC_ADDRESS
+category "fa_IR:2005";LC_TELEPHONE
END LC_IDENTIFICATION
LC_CTYPE
copy "i18n"
+% Persian uses the alternate digits U+06F0..U+06F9
outdigit <U06F0>..<U06F9>
+% This is used in the scanf family of functions to read Persian numbers
+% using "%Id" and such.
map to_inpunct; /
(<U0030>,<U06F0>); /
(<U0031>,<U06F1>); /
@@ -64,6 +67,8 @@
(<U002E>,<U066B>); /
(<U002C>,<U066C>)
+% This is used in the printf family of functions to write Persian floating
+% point numbers using "%If" and such.
map to_outpunct; /
(<U002E>,<U066B>); /
(<U002C>,<U066C>)
@@ -76,7 +81,7 @@
% kinds), BEH, PEH, TEH, JEEM, TCHEH, HAH, KHAH, DAL, THAL, REH, ZAIN, JEH,
% SEEN, SHEEN, SAD, DAD, TAH, ZAH, AIN, GHAIN, FEH, QAF, KAF, GAF, LAM,
% MEEM, NOON, WAW, HEH, YEH.
-% The various kind of HAMZA are sorted as ALEF WITH HAMZA ABOVE, ALEF WITH
+% The various kinds of HAMZA are sorted as ALEF WITH HAMZA ABOVE, ALEF WITH
% HAMZA BELOW, WAW WITH HAMZA ABOVE, YEH WITH HAMZA ABOVE.
collating-symbol <AHY> % accent hamza over yeh
@@ -122,7 +127,7 @@
<heh>
<yeh>
-% Persian uses fatha, kasra, damma, fathatan, kasratan, dammatan order.
+% Persian uses this order: Fatha, Kasra, Damma, Fathatan, Kasratan, Dammatan.
reorder-after <U066D>
<U064E> IGNORE;IGNORE;IGNORE;<U064E> %<fatha_no>
@@ -148,7 +153,7 @@
<U0655> IGNORE;IGNORE;IGNORE;<U0655> %<hamzabelow_no>
<U0670> IGNORE;IGNORE;IGNORE;<U0670> %<supalef_no>
-% Persian digits are sorted before Arabic ones: they are the basic forms.
+% The Persian digits are sorted before the Arabic ones: they are the basic forms.
reorder-after <U0660>
<U06F0> <0>;<BAS>;<MIN>;IGNORE
<U0660> <0>;<PCL>;<MIN>;IGNORE
@@ -264,7 +269,7 @@
mon_thousands_sep "<U066C>"
mon_grouping 3
positive_sign ""
-negative_sign "<U002D>"
+negative_sign "<U2212>"
int_frac_digits 0
frac_digits 0
% The following positioning is based on Unicode 3.0 bidirectional algorithm,
@@ -292,14 +297,72 @@
END LC_NUMERIC
LC_TIME
-abday "<U06CC><U002E>";"<U062F><U002E>";"<U0633><U002E>";/
- "<U0686><U002E>";"<U067E><U002E>";"<U062C><U002E>";/
- "<U0634><U002E>"
-day "<U06CC><U06A9><U200C><U0634><U0646><U0628><U0647>";/
+% Alternative digits are used for Persian numerals in date and time. This is
+% a hack, until a new prefix is defined for alternative digits.
+alt_digits "<U06F0><U06F0>";"<U06F0><U06F1>";/
+ "<U06F0><U06F2>";"<U06F0><U06F3>";/
+ "<U06F0><U06F4>";"<U06F0><U06F5>";/
+ "<U06F0><U06F6>";"<U06F0><U06F7>";/
+ "<U06F0><U06F8>";"<U06F0><U06F9>";/
+ "<U06F1><U06F0>";"<U06F1><U06F1>";/
+ "<U06F1><U06F2>";"<U06F1><U06F3>";/
+ "<U06F1><U06F4>";"<U06F1><U06F5>";/
+ "<U06F1><U06F6>";"<U06F1><U06F7>";/
+ "<U06F1><U06F8>";"<U06F1><U06F9>";/
+ "<U06F2><U06F0>";"<U06F2><U06F1>";/
+ "<U06F2><U06F2>";"<U06F2><U06F3>";/
+ "<U06F2><U06F4>";"<U06F2><U06F5>";/
+ "<U06F2><U06F6>";"<U06F2><U06F7>";/
+ "<U06F2><U06F8>";"<U06F2><U06F9>";/
+ "<U06F3><U06F0>";"<U06F3><U06F1>";/
+ "<U06F3><U06F2>";"<U06F3><U06F3>";/
+ "<U06F3><U06F4>";"<U06F3><U06F5>";/
+ "<U06F3><U06F6>";"<U06F3><U06F7>";/
+ "<U06F3><U06F8>";"<U06F3><U06F9>";/
+ "<U06F4><U06F0>";"<U06F4><U06F1>";/
+ "<U06F4><U06F2>";"<U06F4><U06F3>";/
+ "<U06F4><U06F4>";"<U06F4><U06F5>";/
+ "<U06F4><U06F6>";"<U06F4><U06F7>";/
+ "<U06F4><U06F8>";"<U06F4><U06F9>";/
+ "<U06F5><U06F0>";"<U06F5><U06F1>";/
+ "<U06F5><U06F2>";"<U06F5><U06F3>";/
+ "<U06F5><U06F4>";"<U06F5><U06F5>";/
+ "<U06F5><U06F6>";"<U06F5><U06F7>";/
+ "<U06F5><U06F8>";"<U06F5><U06F9>";/
+ "<U06F6><U06F0>";"<U06F6><U06F1>";/
+ "<U06F6><U06F2>";"<U06F6><U06F3>";/
+ "<U06F6><U06F4>";"<U06F6><U06F5>";/
+ "<U06F6><U06F6>";"<U06F6><U06F7>";/
+ "<U06F6><U06F8>";"<U06F6><U06F9>";/
+ "<U06F7><U06F0>";"<U06F7><U06F1>";/
+ "<U06F7><U06F2>";"<U06F7><U06F3>";/
+ "<U06F7><U06F4>";"<U06F7><U06F5>";/
+ "<U06F7><U06F6>";"<U06F7><U06F7>";/
+ "<U06F7><U06F8>";"<U06F7><U06F9>";/
+ "<U06F8><U06F0>";"<U06F8><U06F1>";/
+ "<U06F8><U06F2>";"<U06F8><U06F3>";/
+ "<U06F8><U06F4>";"<U06F8><U06F5>";/
+ "<U06F8><U06F6>";"<U06F8><U06F7>";/
+ "<U06F8><U06F8>";"<U06F8><U06F9>";/
+ "<U06F9><U06F0>";"<U06F9><U06F1>";/
+ "<U06F9><U06F2>";"<U06F9><U06F3>";/
+ "<U06F9><U06F4>";"<U06F9><U06F5>";/
+ "<U06F9><U06F6>";"<U06F9><U06F7>";/
+ "<U06F9><U06F8>";"<U06F9><U06F9>"
+% Persian doesn't have abbreviations for weekdays and month names, so
+% "abday" is the same as "day" and "abmon" is the same as "mon"
+abday "<U06CC><U06A9><U0634><U0646><U0628><U0647>";/
"<U062F><U0648><U0634><U0646><U0628><U0647>";/
"<U0633><U0647><U200C><U0634><U0646><U0628><U0647>";/
"<U0686><U0647><U0627><U0631><U0634><U0646><U0628><U0647>";/
- "<U067E><U0646><U062C><U200C><U0634><U0646><U0628><U0647>";/
+ "<U067E><U0646><U062C><U0634><U0646><U0628><U0647>";/
+ "<U062C><U0645><U0639><U0647>";/
+ "<U0634><U0646><U0628><U0647>"
+day "<U06CC><U06A9><U0634><U0646><U0628><U0647>";/
+ "<U062F><U0648><U0634><U0646><U0628><U0647>";/
+ "<U0633><U0647><U200C><U0634><U0646><U0628><U0647>";/
+ "<U0686><U0647><U0627><U0631><U0634><U0646><U0628><U0647>";/
+ "<U067E><U0646><U062C><U0634><U0646><U0628><U0647>";/
"<U062C><U0645><U0639><U0647>";/
"<U0634><U0646><U0628><U0647>"
mon "<U0698><U0627><U0646><U0648><U06CC><U0647>";/
@@ -314,33 +377,68 @@
"<U0627><U0643><U062A><U0628><U0631>";/
"<U0646><U0648><U0627><U0645><U0628><U0631>";/
"<U062F><U0633><U0627><U0645><U0628><U0631>"
-abmon "<U0698><U0627><U0646>";"<U0641><U0648><U0631>";/
- "<U0645><U0627><U0631>";"<U0622><U0648><U0631>";/
- "<U0645><U0640><U0647>";"<U0698><U0648><U0646>";/
- "<U0698><U0648><U06CC>";"<U0627><U0648><U062A>";/
- "<U0633><U067E><U062A>";"<U0627><U0643><U062A>";/
- "<U0646><U0648><U0627>";"<U062F><U0633><U0627>"
-am_pm "<U0635><U0628><U062D>";"<U0639><U0635><U0631>"
-d_t_fmt "<U202B><U0025><U0041><U0020><U0025><U0065><U0020><U0025>/
-<U0042><U0020><U0025><U0059><U060C><U0020><U0025><U0049><U003A>/
-<U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0070><U202C>"
-d_fmt "<U0025><U0059><U002F><U0025><U006D><U002F><U0025><U0064>"
-t_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
-t_fmt_ampm "<U202B><U0025><U0049><U003A><U0025><U004D><U003A><U0025>/
-<U0053><U0020><U0025><U0070><U202C>"
-%date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065><U0020>/
-%<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025>/
-%<U005A><U0020><U0025><U0059>"
+abmon "<U0698><U0627><U0646><U0648><U06CC><U0647>";/
+ "<U0641><U0648><U0631><U06CC><U0647>";/
+ "<U0645><U0627><U0631><U0633>";/
+ "<U0622><U0648><U0631><U06CC><U0644>";/
+ "<U0645><U0647>";/
+ "<U0698><U0648><U0626><U0646>";/
+ "<U0698><U0648><U0626><U06CC><U0647>";/
+ "<U0627><U0648><U062A>";/
+ "<U0633><U067E><U062A><U0627><U0645><U0628><U0631>";/
+ "<U0627><U0643><U062A><U0628><U0631>";/
+ "<U0646><U0648><U0627><U0645><U0628><U0631>";/
+ "<U062F><U0633><U0627><U0645><U0628><U0631>"
+% Persian deos not have the 12-hour format
+am_pm "";""
+t_fmt_ampm ""
+%
+% Appropriate date representation (%x)
+% "%OC%Oy/%Om/%Od"
+d_fmt "<U0025><U004F><U0043><U0025><U004F><U0079><U002F>/
+<U0025><U004F><U006D><U002F>/
+<U0025><U004F><U0064>"
+%
+% Appropriate time representation (%X)
+% "%OH:%OM:%OS"
+t_fmt "<U0025><U004F><U0048><U003A>/
+<U0025><U004F><U004D><U003A>/
+<U0025><U004F><U0053>"
+%
+% FIXME: need to add "HAMZA ABOVE" after January, February, May, July when used
+% before a year
+%
+% Appropriate date and time representation (%c)
+% "<RLE>%A %Oe %B %OC%Oy<ARABIC COMMA> %OH:%OM:%OS<PDF>"
+d_t_fmt "<U202B><U0025><U0041><U0020>/
+<U0025><U004F><U0065><U0020>/
+<U0025><U0042><U0020>/
+<U0025><U004F><U0043><U0025><U004F><U0079><U060C><U0020>/
+<U0025><U004F><U0048><U003A>/
+<U0025><U004F><U004D><U003A>/
+<U0025><U004F><U0053><U202C>"
+%
+% Appropriate date representation (date(1))
+% "<RLE>%A %Oe %B %OC%Oy<ARABIC COMMA> <SEEN><ALEF><AIN><TEH> %OH:%OM:%OS (%Z)<PDF>"
+date_fmt "<U202B><U0025><U0041><U0020>/
+<U0025><U004F><U0065><U0020>/
+<U0025><U0042><U0020>/
+<U0025><U004F><U0043><U0025><U004F><U0079><U060C><U0020>/
+<U0633><U0627><U0639><U062A><U0020>/
+<U0025><U004F><U0048><U003A>/
+<U0025><U004F><U004D><U003A>/
+<U0025><U004F><U0053><U0020>/
+<U0028><U0025><U005A><U0029><U202C>"
first_weekday 7
first_workday 7
cal_direction 3
-%week 7;19971206;4
-%time_zone "???"
END LC_TIME
LC_MESSAGES
-yesexpr "<U005E><U005B><U0079><U0059><U0628><U0066><U005D><U002E><U002A>"
-noexpr "<U005E><U005B><U006E><U004E><U062E><U0646><U006F><U005D><U002E><U002A>"
+% This is "^[yY<ALEF MADDA><BEH>Hf].*"
+yesexpr "<U005E><U005B><U0079><U0059><U0622><U0628><U0048><U0066><U005D><U002E><U002A>"
+% This is "^[nN<KHAH><NOON>ok].*"
+noexpr "<U005E><U005B><U006E><U004E><U062E><U0646><U006F><U006B><U005D><U002E><U002A>"
END LC_MESSAGES
LC_PAPER
@@ -348,18 +446,6 @@
width 210
END LC_PAPER
-LC_TELEPHONE
-tel_int_fmt "<U202A><U002B><U0025><U0063><U0020><U0025><U0061><U0020>/
-<U0025><U006C><U202C>"
-tel_dom_fmt "<U202A><U0025><U0041><U2012><U0025><U006C><U202C>"
-int_select "<U0030><U0030>"
-int_prefix "<U0039><U0038>"
-END LC_TELEPHONE
-
-LC_MEASUREMENT
-measurement 1
-END LC_MEASUREMENT
-
LC_NAME
name_gen ""
name_miss "<U062E><U0627><U0646><U0645>"
@@ -371,7 +457,6 @@
END LC_NAME
LC_ADDRESS
-% FIXME
postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
@@ -388,3 +473,16 @@
lang_term "<U0066><U0061><U0073>"
lang_lib "<U0070><U0065><U0072>"
END LC_ADDRESS
+
+LC_TELEPHONE
+tel_int_fmt "<U202A><U002B><U0025><U0063><U0020><U0025><U0061><U0020>/
+<U0025><U006C><U202C>"
+tel_dom_fmt "<U202A><U0025><U0041><U2012><U0025><U006C><U202C>"
+int_select "<U0030><U0030>"
+int_prefix "<U0039><U0038>"
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+measurement 1
+END LC_MEASUREMENT
+