summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-05-28 07:18:42 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-05-28 07:18:42 (GMT)
commitff256dde107faf2fff2f4ccac6bc1c74d4d167f4 (patch)
tree4642dc4f7c036b26de0ae0e6c53f8602b6960ada
parent34f334f734754916d0bfbe6f2879f65150fe493c (diff)
parentb5df26a280112129ffcd34f74456cc6f2980e5be (diff)
downloadtcl-ff256dde107faf2fff2f4ccac6bc1c74d4d167f4.zip
tcl-ff256dde107faf2fff2f4ccac6bc1c74d4d167f4.tar.gz
tcl-ff256dde107faf2fff2f4ccac6bc1c74d4d167f4.tar.bz2
3036566 - Get msgcat locale for Win Vista+ first from gui language registry key.
Bumped msgcat to version 1.5.2. Minor manpage corrections.
-rw-r--r--ChangeLog7
-rw-r--r--changes4
-rw-r--r--doc/msgcat.n7
-rw-r--r--library/msgcat/msgcat.tcl39
-rw-r--r--library/msgcat/pkgIndex.tcl2
-rw-r--r--unix/Makefile.in4
-rw-r--r--win/Makefile.in4
7 files changed, 42 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index bbccf19..0661925 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-05-28 Harald Oehlmann <oehhar@users.sf.net>
+
+ * library/msgcat/msgcat.tcl: [Bug 3036566]: Also get locale from
+ registry key HCU\Control Panel\Desktop : PreferredUILanguages to
+ honor installed language packs on Vista+.
+ Bumped msgcat version to 1.5.2
+
2013-05-22 Donal K. Fellows <dkf@users.sf.net>
* generic/tclUtf.c (TclUtfCasecmp): [Bug 3613609]: Replace problematic
diff --git a/changes b/changes
index c4ad59d..78ade0e 100644
--- a/changes
+++ b/changes
@@ -7734,3 +7734,7 @@ Many revisions to better support a Cygwin environment (nijtmans)
2013-03-22 tzdata updated to Olson's tzdata2013b (venkat)
--- Released 8.5.14, April 3, 2013 --- See ChangeLog for details ---
+
+2013-05-08 (bug fix)[3036566] Honor language packs on Vista+ to get initial locale (oehlmann)
+=> msgcat 1.5.2
+
diff --git a/doc/msgcat.n b/doc/msgcat.n
index 47b6bf7..bfd94ae 100644
--- a/doc/msgcat.n
+++ b/doc/msgcat.n
@@ -35,7 +35,7 @@ msgcat \- Tcl message catalog
\fB::msgcat::mcflmset \fIsrc-trans-list\fR
.VE "TIP 404"
.sp
-\fB::msgcat::mcunknown \fIlocale src-string\fR
+\fB::msgcat::mcunknown \fIlocale src-string\fR ?\fIarg arg ...\fR?
.BE
.SH DESCRIPTION
.PP
@@ -157,12 +157,13 @@ translate-string\fR ?\fIsrc-string translate-string ...\fR?}
of \fB::msgcat::mcflset\fR. The function returns the number of translations set.
.VE "TIP 404"
.TP
-\fB::msgcat::mcunknown \fIlocale src-string\fR
+\fB::msgcat::mcunknown \fIlocale src-string\fR ?\fIarg arg ...\fR?
.
This routine is called by \fB::msgcat::mc\fR in the case when
a translation for \fIsrc-string\fR is not defined in the
current locale. The default action is to return
-\fIsrc-string\fR. This procedure can be redefined by the
+\fIsrc-string\fR passed by format if there are any arguments. This
+procedure can be redefined by the
application, for example to log error messages for each unknown
string. The \fB::msgcat::mcunknown\fR procedure is invoked at the
same stack context as the call to \fB::msgcat::mc\fR. The return value
diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl
index 5f0ba2e..cf3b9d7 100644
--- a/library/msgcat/msgcat.tcl
+++ b/library/msgcat/msgcat.tcl
@@ -13,7 +13,7 @@
package require Tcl 8.5
# When the version number changes, be sure to update the pkgIndex.tcl file,
# and the installation directory in the Makefiles.
-package provide msgcat 1.5.1
+package provide msgcat 1.5.2
namespace eval msgcat {
namespace export mc mcload mclocale mcmax mcmset mcpreferences mcset \
@@ -541,8 +541,11 @@ proc msgcat::Init {} {
# settings, or fall back on locale of "C".
#
- # First check registry value LocalName present from Windows Vista
- # which contains the local string as RFC5646, composed of:
+ # On Vista and later:
+ # HCU/Control Panel/Desktop : PreferredUILanguages is for language packs,
+ # HCU/Control Pannel/International : localName is the default locale.
+ #
+ # They contain the local string as RFC5646, composed of:
# [a-z]{2,3} : language
# -[a-z]{4} : script (optional, translated by table Latn->latin)
# -[a-z]{2}|[0-9]{3} : territory (optional, numerical region codes not used)
@@ -550,23 +553,25 @@ proc msgcat::Init {} {
# Those are translated to local strings.
# Examples: de-CH -> de_ch, sr-Latn-CS -> sr_cs@latin, es-419 -> es
#
- set key {HKEY_CURRENT_USER\Control Panel\International}
- if {![catch {registry get $key LocaleName} localeName]
- && [regexp {^([a-z]{2,3})(?:-([a-z]{4}))?(?:-([a-z]{2}))?(?:-.+)?$}\
- [string tolower $localeName] match locale script territory]} {
- if {"" ne $territory} {
- append locale _ $territory
- }
- set modifierDict [dict create latn latin cyrl cyrillic]
- if {[dict exists $modifierDict $script]} {
- append locale @ [dict get $modifierDict $script]
- }
- if {![catch {mclocale [ConvertLocale $locale]}]} {
- return
+ foreach key {{HKEY_CURRENT_USER\Control Panel\Desktop} {HKEY_CURRENT_USER\Control Panel\International}}\
+ value {PreferredUILanguages localeName} {
+ if {![catch {registry get $key $value} localeName]
+ && [regexp {^([a-z]{2,3})(?:-([a-z]{4}))?(?:-([a-z]{2}))?(?:-.+)?$}\
+ [string tolower $localeName] match locale script territory]} {
+ if {"" ne $territory} {
+ append locale _ $territory
+ }
+ set modifierDict [dict create latn latin cyrl cyrillic]
+ if {[dict exists $modifierDict $script]} {
+ append locale @ [dict get $modifierDict $script]
+ }
+ if {![catch {mclocale [ConvertLocale $locale]}]} {
+ return
+ }
}
}
- # then check key locale which contains a numerical language ID
+ # then check value locale which contains a numerical language ID
if {[catch {
set locale [registry get $key "locale"]
}]} {
diff --git a/library/msgcat/pkgIndex.tcl b/library/msgcat/pkgIndex.tcl
index 3fdb25a..5fabfe3 100644
--- a/library/msgcat/pkgIndex.tcl
+++ b/library/msgcat/pkgIndex.tcl
@@ -1,2 +1,2 @@
if {![package vsatisfies [package provide Tcl] 8.5]} {return}
-package ifneeded msgcat 1.5.1 [list source [file join $dir msgcat.tcl]]
+package ifneeded msgcat 1.5.2 [list source [file join $dir msgcat.tcl]]
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 22656d5..34c7165 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -773,8 +773,8 @@ install-libraries: libraries $(INSTALL_TZDATA) install-msgs
do \
$(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/opt0.4; \
done;
- @echo "Installing package msgcat 1.5.1 as a Tcl Module";
- @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.5.1.tm;
+ @echo "Installing package msgcat 1.5.2 as a Tcl Module";
+ @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.5.2.tm;
@echo "Installing package tcltest 2.3.5 as a Tcl Module";
@$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.3.5.tm;
diff --git a/win/Makefile.in b/win/Makefile.in
index 3ac7f43..235313f 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -649,8 +649,8 @@ install-libraries: libraries install-tzdata install-msgs
do \
$(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/opt0.4"; \
done;
- @echo "Installing package msgcat 1.5.1 as a Tcl Module";
- @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.5.1.tm;
+ @echo "Installing package msgcat 1.5.2 as a Tcl Module";
+ @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.5.2.tm;
@echo "Installing package tcltest 2.3.5 as a Tcl Module";
@$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.3.5.tm;
@echo "Installing package platform 1.0.12 as a Tcl Module";