diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-07-01 19:51:28 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-07-01 19:51:28 (GMT) |
commit | 7747ac024f699006066d1eb7919fab3f7715d835 (patch) | |
tree | 14e48d160d21d4a4b84a7a47545b914f6f1962c0 /library | |
parent | 24ce75e998f13506548f2bebeb361405aa16546f (diff) | |
parent | a01324b87773322006055cac9ff0da9bdae34d4b (diff) | |
download | tcl-7747ac024f699006066d1eb7919fab3f7715d835.zip tcl-7747ac024f699006066d1eb7919fab3f7715d835.tar.gz tcl-7747ac024f699006066d1eb7919fab3f7715d835.tar.bz2 |
merge trunk
Diffstat (limited to 'library')
-rw-r--r-- | library/dde/pkgIndex.tcl | 2 | ||||
-rw-r--r-- | library/msgcat/msgcat.tcl | 52 | ||||
-rw-r--r-- | library/msgcat/pkgIndex.tcl | 2 | ||||
-rw-r--r-- | library/platform/shell.tcl | 2 | ||||
-rwxr-xr-x | library/reg/pkgIndex.tcl | 6 |
5 files changed, 45 insertions, 19 deletions
diff --git a/library/dde/pkgIndex.tcl b/library/dde/pkgIndex.tcl index 5b4eae9..fef4f24 100644 --- a/library/dde/pkgIndex.tcl +++ b/library/dde/pkgIndex.tcl @@ -1,5 +1,5 @@ if {![package vsatisfies [package provide Tcl] 8.5]} return -if {[string compare [info sharedlibextension] .dll]} return +if {[info sharedlibextension] ne ".dll"} return if {[::tcl::pkgconfig get debug]} { package ifneeded dde 1.4.0 [list load [file join $dir tcldde14g.dll] dde] } else { diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 369ed52..f6c62a3 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.4.4 +package provide msgcat 1.4.5 namespace eval msgcat { namespace export mc mcload mclocale mcmax mcmset mcpreferences mcset \ @@ -32,7 +32,7 @@ namespace eval msgcat { variable Msgs [dict create] # Map of language codes used in Windows registry to those of ISO-639 - if { $::tcl_platform(platform) eq "windows" } { + if {[info sharedlibextension] eq ".dll"} { variable WinRegToISO639 [dict create {*}{ 01 ar 0401 ar_SA 0801 ar_IQ 0c01 ar_EG 1001 ar_LY 1401 ar_DZ 1801 ar_MA 1c01 ar_TN 2001 ar_OM 2401 ar_YE 2801 ar_SY @@ -66,8 +66,8 @@ namespace eval msgcat { 15 pl 0415 pl_PL 16 pt 0416 pt_BR 0816 pt_PT 17 rm 0417 rm_CH - 18 ro 0418 ro_RO - 19 ru + 18 ro 0418 ro_RO 0818 ro_MO + 19 ru 0819 ru_MO 1a hr 041a hr_HR 081a sr_YU 0c1a sr_YU@cyrillic 1b sk 041b sk_SK 1c sq 041c sq_AL @@ -92,6 +92,7 @@ namespace eval msgcat { 2f mk 042f mk_MK 30 bnt 0430 bnt_TZ 31 ts 0431 ts_ZA + 32 tn 33 ven 0433 ven_ZA 34 xh 0434 xh_ZA 35 zu 0435 zu_ZA @@ -426,7 +427,7 @@ proc msgcat::ConvertLocale {value} { # Initialize the default locale proc msgcat::Init {} { - global env tcl_platform + global env # # set default locale, try to get from environment @@ -451,23 +452,48 @@ proc msgcat::Init {} { } } # - # The rest of this routine is special processing for Windows; - # all other platforms, get out now. + # The rest of this routine is special processing for Windows or + # Cygwin. All other platforms, get out now. # - if {$tcl_platform(platform) ne "windows"} { + if {([info sharedlibextension] ne ".dll") + || [catch {package require registry}]} { mclocale C return } # - # On Windows, try to set locale depending on registry settings, - # or fall back on locale of "C". + # On Windows or Cygwin, try to set locale depending on registry + # 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: + # [a-z]{2,3} : language + # -[a-z]{4} : script (optional, not used) + # -[a-z]{2}|[0-9]{3} : territory (optional, numerical region codes not used) + # (-.*)* : variant, extension, private use (optional, not used) + # Those are translated to local strings. + # Examples: de-CH -> de_ch, sr-Latn-CS -> sr_cs, 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\ + territory]} { + if {"" ne $territory} { + append locale _ $territory + } + if {![catch { + mclocale [ConvertLocale $locale] + }]} { + return + } + } + + # then check key locale which contains a numerical language ID if {[catch { - package require registry - set key {HKEY_CURRENT_USER\Control Panel\International} set locale [registry get $key "locale"] }]} { - mclocale C + mclocale C return } # diff --git a/library/msgcat/pkgIndex.tcl b/library/msgcat/pkgIndex.tcl index 17ad5db..60c2d3c 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.4.4 [list source [file join $dir msgcat.tcl]] +package ifneeded msgcat 1.4.5 [list source [file join $dir msgcat.tcl]] diff --git a/library/platform/shell.tcl b/library/platform/shell.tcl index e0a129a..d37cdcd 100644 --- a/library/platform/shell.tcl +++ b/library/platform/shell.tcl @@ -187,7 +187,7 @@ proc ::platform::shell::TEMP {} { } } } - if {[string compare $channel ""]} { + if {$channel != ""} { return -code error "Failed to open a temporary file: $channel" } else { return -code error "Failed to find an unused temporary file name" diff --git a/library/reg/pkgIndex.tcl b/library/reg/pkgIndex.tcl index 067425f..f71b09f 100755 --- a/library/reg/pkgIndex.tcl +++ b/library/reg/pkgIndex.tcl @@ -1,9 +1,9 @@ if {![package vsatisfies [package provide Tcl] 8.5]} return -if {[string compare [info sharedlibextension] .dll]} return +if {[info sharedlibextension] ne ".dll"} return if {[::tcl::pkgconfig get debug]} { - package ifneeded registry 1.3 \ + package ifneeded registry 1.3.0 \ [list load [file join $dir tclreg13g.dll] registry] } else { - package ifneeded registry 1.3 \ + package ifneeded registry 1.3.0 \ [list load [file join $dir tclreg13.dll] registry] } |