summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2007-04-20 02:23:30 (GMT)
committerKevin B Kenny <kennykb@acm.org>2007-04-20 02:23:30 (GMT)
commit41da80ee66a3a7325bde6e0e8e661a066a932c2b (patch)
treee0126d39453c1ccf075ec3d566184e702106c624
parent7ea39f0edbf37288e5738891d6c8b405bf19dd34 (diff)
downloadtcl-41da80ee66a3a7325bde6e0e8e661a066a932c2b.zip
tcl-41da80ee66a3a7325bde6e0e8e661a066a932c2b.tar.gz
tcl-41da80ee66a3a7325bde6e0e8e661a066a932c2b.tar.bz2
* doc/clock.n: Corrected a silly error (transposed 'uppercase'
and 'lowercase' in clock.n. [Bug 1656002] Clarified that [clock scan] does not recognize a locale's alternative calendar. * library/clock.tcl: Corrected an error in skipping over the %Ey field on input. * library/msgs/ja.msg: * tools/loadICU.tcl: Corrected several localisation faults in the Japanese locale (most notably, incorrect dates for the Emperors' eras). [Bug 1637471]. Many thanks to SourceForge user 'nyademo' for pointing this out and developing a fix. * generic/tclPathObj.c: Corrected a 'const'ness fault that caused bitter complaints from MSVC.
-rw-r--r--ChangeLog11
-rw-r--r--doc/clock.n5
-rw-r--r--generic/tclPathObj.c5
-rw-r--r--library/clock.tcl5
-rwxr-xr-xlibrary/msgs/ja.msg27
-rw-r--r--tests/clock.test77
-rwxr-xr-xtools/loadICU.tcl18
7 files changed, 110 insertions, 38 deletions
diff --git a/ChangeLog b/ChangeLog
index 4921a25..993c5c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,17 @@
* doc/clock.n: Corrected a silly error (transposed 'uppercase'
and 'lowercase' in clock.n. [Bug 1656002]
+ Clarified that [clock scan] does not recognize a locale's
+ alternative calendar.
+ * library/clock.tcl: Corrected an error in skipping over the
+ %Ey field on input.
+ * library/msgs/ja.msg:
+ * tools/loadICU.tcl: Corrected several localisation faults in
+ the Japanese locale (most notably, incorrect dates for the
+ Emperors' eras). [Bug 1637471]. Many thanks to SourceForge
+ user 'nyademo' for pointing this out and developing a fix.
+ * generic/tclPathObj.c: Corrected a 'const'ness fault that
+ caused bitter complaints from MSVC.
2007-04-19 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
diff --git a/doc/clock.n b/doc/clock.n
index 247fe2c..53eefcf 100644
--- a/doc/clock.n
+++ b/doc/clock.n
@@ -383,8 +383,9 @@ combined and used to determine the date. If more than one complete
set is present, the one at the rightmost position in the string is
used. The year is presumed to lie in the range 1938 to 2037 inclusive.
.IP [5]
-If the string entirely lacks any specification for the year,
-but contains a set of format groups specifying month and day of month,
+If the string entirely lacks any specification for the year
+(or contains the year only on the locale's alternative calendar)
+and contains a set of format groups specifying month and day of month,
day of year, or week of year and day of week, those groups are
combined and used to determine the date. If more than one complete
set is present, the one at the rightmost position in the string is
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index 35a6e37..174ac22 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclPathObj.c,v 1.60 2007/04/17 14:49:53 dkf Exp $
+ * RCS: @(#) $Id: tclPathObj.c,v 1.61 2007/04/20 02:23:31 kennykb Exp $
*/
#include "tclInt.h"
@@ -1648,7 +1648,8 @@ Tcl_FSGetTranslatedStringPath(
if (transPtr != NULL) {
int len;
- const char *result, *orig;
+ const char* orig;
+ char *result;
orig = Tcl_GetStringFromObj(transPtr, &len);
result = (char *) ckalloc((unsigned)(len+1));
diff --git a/library/clock.tcl b/library/clock.tcl
index 682b019..dfc5d73 100644
--- a/library/clock.tcl
+++ b/library/clock.tcl
@@ -13,7 +13,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: clock.tcl,v 1.42 2007/04/17 20:33:27 kennykb Exp $
+# RCS: @(#) $Id: clock.tcl,v 1.43 2007/04/20 02:23:31 kennykb Exp $
#
#----------------------------------------------------------------------
@@ -1893,7 +1893,6 @@ proc ::tcl::clock::ParseClockScanFormat {formatString locale} {
}
foreach { regex lookup } [UniquePrefixRegexp $d] break
append re (?: $regex )
-
}
E {
set l {}
@@ -1915,7 +1914,7 @@ proc ::tcl::clock::ParseClockScanFormat {formatString locale} {
foreach {regex lookup} \
[LocaleNumeralMatcher $locale] break
append re $regex
- incr fieldCount
+ incr captureCount
}
default {
append re %E
diff --git a/library/msgs/ja.msg b/library/msgs/ja.msg
index 7bab236..2767665 100755
--- a/library/msgs/ja.msg
+++ b/library/msgs/ja.msg
@@ -16,20 +16,6 @@ namespace eval ::tcl::clock {
"\u6728\u66dc\u65e5"\
"\u91d1\u66dc\u65e5"\
"\u571f\u66dc\u65e5"]
- ::msgcat::mcset ja MONTHS_ABBREV [list \
- "1"\
- "2"\
- "3"\
- "4"\
- "5"\
- "6"\
- "7"\
- "8"\
- "9"\
- "10"\
- "11"\
- "12"\
- ""]
::msgcat::mcset ja MONTHS_FULL [list \
"1\u6708"\
"2\u6708"\
@@ -42,18 +28,17 @@ namespace eval ::tcl::clock {
"9\u6708"\
"10\u6708"\
"11\u6708"\
- "12\u6708"\
- ""]
+ "12\u6708"]
::msgcat::mcset ja BCE "\u7d00\u5143\u524d"
::msgcat::mcset ja CE "\u897f\u66a6"
::msgcat::mcset ja AM "\u5348\u524d"
::msgcat::mcset ja PM "\u5348\u5f8c"
::msgcat::mcset ja DATE_FORMAT "%Y/%m/%d"
::msgcat::mcset ja TIME_FORMAT "%k:%M:%S"
+ ::msgcat::mcset ja TIME_FORMAT_12 "%P %I:%M:%S"
::msgcat::mcset ja DATE_TIME_FORMAT "%Y/%m/%d %k:%M:%S %z"
- ::msgcat::mcset ja LOCALE_NUMERALS "\u3007 \u4e00 \u4e8c \u4e09 \u56db \u4e94 \u516d \u4e03 \u516b \u4e5d \u5341 \u5341\u4e00 \u5341\u4e8c \u5341\u4e09 \u5341\u56db \u5341\u4e94 \u5341\u516d \u5341\u4e03 \u5341\u516b \u5341\u4e5d \u4e8c\u5341 \u5eff\u4e00 \u5eff\u4e8c \u5eff\u4e09 \u5eff\u56db \u5eff\u4e94 \u5eff\u516d \u5eff\u4e03 \u5eff\u516b \u5eff\u4e5d \u4e09\u5341 \u5345\u4e00 \u5345\u4e8c \u5345\u4e09 \u5345\u56db \u5345\u4e94 \u5345\u516d \u5345\u4e03 \u5345\u516b \u5345\u4e5d \u56db\u5341 \u56db\u5341\u4e00 \u56db\u5341\u4e8c \u56db\u5341\u4e09 \u56db\u5341\u56db \u56db\u5341\u4e94 \u56db\u5341\u516d \u56db\u5341\u4e03 \u56db\u5341\u516b \u56db\u5341\u4e5d \u4e94\u5341 \u4e94\u5341\u4e00 \u4e94\u5341\u4e8c \u4e94\u5341\u4e09 \u4e94\u5341\u56db \u4e94\u5341\u4e94 \u4e94\u5341\u516d \u4e94\u5341\u4e03 \u4e94\u5341\u516b \u4e94\u5341\u4e5d \u516d\u5341 \u516d\u5341\u4e00 \u516d\u5341\u4e8c \u516d\u5341\u4e09 \u516d\u5341\u56db \u516d\u5341\u4e94 \u516d\u5341\u516d \u516d\u5341\u4e03 \u516d\u5341\u516b \u516d\u5341\u4e5d \u4e03\u5341 \u4e03\u5341\u4e00 \u4e03\u5341\u4e8c \u4e03\u5341\u4e09 \u4e03\u5341\u56db \u4e03\u5341\u4e94 \u4e03\u5341\u516d \u4e03\u5341\u4e03 \u4e03\u5341\u516b \u4e03\u5341\u4e5d \u516b\u5341 \u516b\u5341\u4e00 \u516b\u5341\u4e8c \u516b\u5341\u4e09 \u516b\u5341\u56db \u516b\u5341\u4e94 \u516b\u5341\u516d \u516b\u5341\u4e03 \u516b\u5341\u516b \u516b\u5341\u4e5d \u4e5d\u5341 \u4e5d\u5341\u4e00 \u4e5d\u5341\u4e8c \u4e5d\u5341\u4e09 \u4e5d\u5341\u56db \u4e5d\u5341\u4e94 \u4e5d\u5341\u516d \u4e5d\u5341\u4e03 \u4e5d\u5341\u516b \u4e5d\u5341\u4e5d"
- ::msgcat::mcset ja LOCALE_DATE_FORMAT "%EY\u5e74%B%Od\u65e5"
- ::msgcat::mcset ja LOCALE_TIME_FORMAT "%OH\u6642%OM\u5206%OS\u79d2"
- ::msgcat::mcset ja LOCALE_DATE_TIME_FORMAT "%A %EY\u5e74%B%Od\u65e5%OH\u6642%OM\u5206%OS\u79d2 %z"
- ::msgcat::mcset ja LOCALE_ERAS "\u007b-9223372036854775808 \u897f\u66a6 0\u007d \u007b-3060979200 \u660e\u6cbb 1867\u007d \u007b-1812153600 \u5927\u6b63 1911\u007d \u007b-1357603200 \u662d\u548c 1925\u007d \u007b568512000 \u5e73\u6210 1987\u007d"
+ ::msgcat::mcset ja LOCALE_DATE_FORMAT "%EY\u5e74%m\u6708%d\u65e5"
+ ::msgcat::mcset ja LOCALE_TIME_FORMAT "%H\u6642%M\u5206%S\u79d2"
+ ::msgcat::mcset ja LOCALE_DATE_TIME_FORMAT "%EY\u5e74%m\u6708%d\u65e5 (%a) %H\u6642%M\u5206%S\u79d2 %z"
+ ::msgcat::mcset ja LOCALE_ERAS "\u007b-9223372036854775808 \u897f\u66a6 0\u007d \u007b-3061011600 \u660e\u6cbb 1867\u007d \u007b-1812186000 \u5927\u6b63 1911\u007d \u007b-1357635600 \u662d\u548c 1925\u007d \u007b600220800 \u5e73\u6210 1988\u007d"
}
diff --git a/tests/clock.test b/tests/clock.test
index 2006029..b3ffa9c 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: clock.test,v 1.74 2007/04/15 18:59:34 kennykb Exp $
+# RCS: @(#) $Id: clock.test,v 1.75 2007/04/20 02:23:34 kennykb Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -36444,6 +36444,81 @@ test clock-57.1 {clock scan - abbreviated options} {
clock scan 1970-01-01 -f %Y-%m-%d -g true
} 0
+test clock-58.1 {clock l10n - Japanese localisation} {*}{
+ -setup {
+ proc backslashify { string } {
+
+ set retval {}
+ foreach char [split $string {}] {
+ scan $char %c ccode
+ if { $ccode >= 0x0020 && $ccode < 0x007f
+ && $char ne "\{" && $char ne "\}" && $char ne "\["
+ && $char ne "\]" && $char ne "\\" && $char ne "\$" } {
+ append retval $char
+ } else {
+ append retval \\u [format %04x $ccode]
+ }
+ }
+ return $retval
+ }
+ }
+ -body {
+ set trouble {}
+ foreach {date jdate} [list \
+ 1872-12-31 \u897f\u66a61872\u5e7412\u670831\u65e5 \
+ 1873-01-01 \u660e\u6cbb06\u5e7401\u670801\u65e5 \
+ 1912-07-29 \u660e\u6cbb45\u5e7407\u670829\u65e5 \
+ 1912-07-30 \u5927\u6b6301\u5e7407\u670830\u65e5 \
+ 1926-12-24 \u5927\u6b6315\u5e7412\u670824\u65e5 \
+ 1926-12-25 \u662d\u548c01\u5e7412\u670825\u65e5 \
+ 1989-01-07 \u662d\u548c64\u5e7401\u670807\u65e5 \
+ 1989-01-08 \u5e73\u621001\u5e7401\u670808\u65e5 \
+ ] {
+ set status [catch {
+ set secs [clock scan $date \
+ -timezone +0900 \
+ -locale ja_JP \
+ -format %Y-%m-%d]
+ set jda [clock format $secs \
+ -timezone +0900 \
+ -locale ja_JP \
+ -format %Ex]
+ } result]
+ if {$status != 0} {
+ append trouble \n $date " gives error " $result
+ } elseif {$jda ne $jdate} {
+ append trouble \n $date " converts to " \
+ [backslashify $jda] " and should be " \
+ [backslashify $jdate]
+ }
+ # There is no code for scanning dates on the locale's
+ # alternative calendar.
+ continue
+ set status [catch {
+ set secs [clock scan $jdate \
+ -timezone +0900 \
+ -locale ja_JP \
+ -format %Ex]
+ set da [clock format $secs \
+ -timezone +0900 \
+ -locale ja_JP \
+ -format %Y-%m-%d]
+ } result]
+ if {$status != 0} {
+ append trouble \n [backslashify $jdate] " gives error " $result
+ } elseif {$da ne $date} {
+ append trouble \n [backslashify $jdate] " converts to " \
+ $da " and should be " $date
+ }
+ }
+ set trouble
+ }
+ -cleanup {
+ rename backslashify {}
+ }
+ -result {}
+}
+
# cleanup
namespace delete ::testClock
diff --git a/tools/loadICU.tcl b/tools/loadICU.tcl
index ab72f3c..da0e134 100755
--- a/tools/loadICU.tcl
+++ b/tools/loadICU.tcl
@@ -26,7 +26,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: loadICU.tcl,v 1.2 2005/10/03 14:38:08 kennykb Exp $
+# RCS: @(#) $Id: loadICU.tcl,v 1.3 2007/04/20 02:23:35 kennykb Exp $
#
#----------------------------------------------------------------------
@@ -61,22 +61,22 @@ foreach zt $zhDigits {
# Set format overrides for various locales.
set format(zh,LOCALE_NUMERALS) $zhNumbers
-set format(ja,LOCALE_NUMERALS) $zhNumbers
set format(ja,LOCALE_ERAS) [list \
[list -9223372036854775808 \u897f\u66a6 0 ] \
- [list -3060979200 \u660e\u6cbb 1867] \
- [list -1812153600 \u5927\u6b63 1911] \
- [list -1357603200 \u662d\u548c 1925] \
- [list 568512000 \u5e73\u6210 1987]]
+ [list -3061011600 \u660e\u6cbb 1867] \
+ [list -1812186000 \u5927\u6b63 1911] \
+ [list -1357635600 \u662d\u548c 1925] \
+ [list 600220800 \u5e73\u6210 1988]]
set format(zh,LOCALE_DATE_FORMAT) "\u516c\u5143%Y\u5e74%B%Od\u65E5"
-set format(ja,LOCALE_DATE_FORMAT) "%EY\u5e74%B%Od\u65E5"
+set format(ja,LOCALE_DATE_FORMAT) "%EY\u5e74%m\u6708%d\u65E5"
set format(ko,LOCALE_DATE_FORMAT) "%Y\ub144%B%Od\uc77c"
set format(zh,LOCALE_TIME_FORMAT) "%OH\u65f6%OM\u5206%OS\u79d2"
-set format(ja,LOCALE_TIME_FORMAT) "%OH\u6642%OM\u5206%OS\u79d2"
+set format(ja,LOCALE_TIME_FORMAT) "%H\u6642%M\u5206%S\u79d2"
set format(ko,LOCALE_TIME_FORMAT) "%H\uc2dc%M\ubd84%S\ucd08"
set format(zh,LOCALE_DATE_TIME_FORMAT) "%A %Y\u5e74%B%Od\u65E5%OH\u65f6%OM\u5206%OS\u79d2 %z"
-set format(ja,LOCALE_DATE_TIME_FORMAT) "%A %EY\u5e74%B%Od\u65E5%OH\u6642%OM\u5206%OS\u79d2 %z"
+set format(ja,LOCALE_DATE_TIME_FORMAT) "%EY\u5e74%m\u6708%d\u65E5 (%a) %H\u6642%M\u5206%S\u79d2 %z"
set format(ko,LOCALE_DATE_TIME_FORMAT) "%A %Y\ub144%B%Od\uc77c%H\uc2dc%M\ubd84%S\ucd08 %z"
+set format(ja,TIME_FORMAT_12) {%P %I:%M:%S}
# The next set of format overrides were obtained from the glibc
# localization strings.