summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2004-03-31 18:50:58 (GMT)
committerdgp <dgp@users.sourceforge.net>2004-03-31 18:50:58 (GMT)
commita5bbdfa18dfbb3c9ac04bbfd70c9e21658d7f171 (patch)
tree949bbdd0ae4ecebf06e3c0d68aea7900bd84be3d
parent32dcd4b9f5a45163c2a1e017cf0f8146da00fe29 (diff)
downloadtcl-a5bbdfa18dfbb3c9ac04bbfd70c9e21658d7f171.zip
tcl-a5bbdfa18dfbb3c9ac04bbfd70c9e21658d7f171.tar.gz
tcl-a5bbdfa18dfbb3c9ac04bbfd70c9e21658d7f171.tar.bz2
* doc/msgcat.n: Clarified message catalog file encodings. [Bug 811457]
* library/msgcat/msgcat.tcl ([mcset], [ConvertLocale], [Init]): Corrected [mcset] to be able to successfully set a translation to the empty string. [mcset $loc $src {}] was incorrectly set the $loc translation of $src back to $src. Also changed [ConvertLocale] to minimally require a non-empty "language" part in the locale value. If not, an error raised prompts [Init] to keep looking for a valid locale value, or ultimately fall back on the "C" locale. [Bug 811461]. * library/msgcat/pkgIndex.tcl: Bump to msgcat 1.3.2.
-rw-r--r--ChangeLog11
-rw-r--r--doc/msgcat.n2
-rw-r--r--library/msgcat/msgcat.tcl13
3 files changed, 17 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 38bd5b0..e892310 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,14 @@
2004-03-31 Don Porter <dgp@users.sourceforge.net>
- * library/msgcat/msgcat.tcl ([mcset]): Corrected [mcset] to be able
- * library/msgcat/pkgIndex.tcl: to successfully set a translation to
+ * doc/msgcat.n: Clarified message catalog file encodings. [Bug 811457]
+ * library/msgcat/msgcat.tcl ([mcset], [ConvertLocale], [Init]):
+ Corrected [mcset] to be able to successfully set a translation to
the empty string. [mcset $loc $src {}] was incorrectly set the
- $loc translation of $src back to $src. Bump to msgcat 1.3.2.
+ $loc translation of $src back to $src. Also changed [ConvertLocale]
+ to minimally require a non-empty "language" part in the locale value.
+ If not, an error raised prompts [Init] to keep looking for a valid
+ locale value, or ultimately fall back on the "C" locale. [Bug 811461].
+ * library/msgcat/pkgIndex.tcl: Bump to msgcat 1.3.2.
2004-03-31 Donal K. Fellows <donal.k.fellows@man.ac.uk>
diff --git a/doc/msgcat.n b/doc/msgcat.n
index 1c11f17..f7ba2fc 100644
--- a/doc/msgcat.n
+++ b/doc/msgcat.n
@@ -102,7 +102,7 @@ the language specifications returned by \fB::msgcat::mcpreferences\fR
(note that these are all lowercase), extended by the file
extension ``.msg''. Each matching file is
read in order, assuming a UTF-8 encoding. The file contents are
-then evaluated as a Tcl script. This means that non-Latin characters
+then evaluated as a Tcl script. This means that Unicode characters
may be present in the message file either directly in their UTF-8
encoded form, or by use of the backslash-u quoting recognized by Tcl
evaluation. The number of message files which matched the specification
diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl
index 2180129..044dcbb 100644
--- a/library/msgcat/msgcat.tcl
+++ b/library/msgcat/msgcat.tcl
@@ -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: msgcat.tcl,v 1.17.2.2 2004/03/31 01:55:21 dgp Exp $
+# RCS: @(#) $Id: msgcat.tcl,v 1.17.2.3 2004/03/31 18:51:01 dgp Exp $
package require Tcl 8.2
# When the version number changes, be sure to update the pkgIndex.tcl file,
@@ -397,8 +397,10 @@ proc msgcat::ConvertLocale {value} {
# (@(.*))? # Match (optional) "modifier"; starts with @
# $ # Match all the way to the end
# } $value -> language _ territory _ codeset _ modifier
- regexp {^([^_.@]*)(_([^.@]*))?([.]([^@]*))?(@(.*))?$} $value \
- -> language _ territory _ codeset _ modifier
+ if {![regexp {^([^_.@]+)(_([^.@]*))?([.]([^@]*))?(@(.*))?$} $value \
+ -> language _ territory _ codeset _ modifier]} {
+ return -code error "invalid locale '$value': empty language part"
+ }
set ret $language
if {[string length $territory]} {
append ret _$territory
@@ -417,8 +419,9 @@ proc msgcat::Init {} {
foreach varName {LC_ALL LC_MESSAGES LANG} {
if {[info exists ::env($varName)]
&& ![string equal "" $::env($varName)]} {
- mclocale [ConvertLocale $::env($varName)]
- return
+ if {![catch {mclocale [ConvertLocale $::env($varName)]}]} {
+ return
+ }
}
}
#