summaryrefslogtreecommitdiffstats
path: root/library/msgcat/msgcat.tcl
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2015-05-31 16:20:06 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2015-05-31 16:20:06 (GMT)
commitf50357637950d7ee913d02d98cfa78ca49bd0e09 (patch)
treed53d085f4f5d210127092023f92633ef57a090f6 /library/msgcat/msgcat.tcl
parentf9c9b71cd327714fabe221f91e2f9af29fdd9b85 (diff)
parent32461a99d3dc5741caf2f1c282ca57fe06220b79 (diff)
downloadtcl-f50357637950d7ee913d02d98cfa78ca49bd0e09.zip
tcl-f50357637950d7ee913d02d98cfa78ca49bd0e09.tar.gz
tcl-f50357637950d7ee913d02d98cfa78ca49bd0e09.tar.bz2
merge trunk
Diffstat (limited to 'library/msgcat/msgcat.tcl')
-rwxr-xr-x[-rw-r--r--]library/msgcat/msgcat.tcl49
1 files changed, 25 insertions, 24 deletions
diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl
index 92fb7f7..b217634 100644..100755
--- a/library/msgcat/msgcat.tcl
+++ b/library/msgcat/msgcat.tcl
@@ -16,9 +16,8 @@ package require Tcl 8.5
package provide msgcat 1.6.0
namespace eval msgcat {
- namespace export mc mcexists mcload mclocale mcmax mcmset\
- mcpreferences mcset mcunknown mcflset mcflmset\
- mcloadedlocales mcforgetpackage\
+ namespace export mc mcexists mcload mclocale mcmax mcmset mcpreferences mcset\
+ mcunknown mcflset mcflmset mcloadedlocales mcforgetpackage\
mcpackageconfig mcpackagelocale
# Records the list of locales to search
@@ -816,7 +815,7 @@ proc msgcat::Load {ns locales {callbackonly 0}} {
}
set x 0
foreach p $locales {
- if { $p eq {} } {
+ if {$p eq {}} {
set p ROOT
}
set langfile [file join $langdir $p.msg]
@@ -944,7 +943,7 @@ proc msgcat::mcflset {src {dest ""}} {
# Results:
# Returns the number of pairs processed
-proc msgcat::mcmset {locale pairs } {
+proc msgcat::mcmset {locale pairs} {
variable Msgs
set length [llength $pairs]
@@ -1125,8 +1124,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)
@@ -1134,26 +1136,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 {([registry values $key "LocaleName"] ne "")
- && [regexp {^([a-z]{2,3})(?:-([a-z]{4}))?(?:-([a-z]{2}))?(?:-.+)?$}\
- [string tolower [registry get $key "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"]
}]} {