summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
Diffstat (limited to 'library')
-rw-r--r--library/clock.tcl13
-rw-r--r--library/msgcat/msgcat.tcl45
2 files changed, 36 insertions, 22 deletions
diff --git a/library/clock.tcl b/library/clock.tcl
index 1891b21..60dfb38 100644
--- a/library/clock.tcl
+++ b/library/clock.tcl
@@ -16,9 +16,17 @@
#
#----------------------------------------------------------------------
-# We must have message catalogs that support the root locale.
+# msgcat 1.7 features are used. We need access to the Registry on Windows
+# systems.
-package require msgcat 1.6
+uplevel \#0 {
+ package require msgcat 1.7
+ if { $::tcl_platform(platform) eq {windows} } {
+ if { [catch { package require registry 1.1 }] } {
+ namespace eval ::tcl::clock [list variable NoRegistry {}]
+ }
+ }
+}
# Put the library directory into the namespace for the ensemble so that the
# library code can find message catalogs and time zone definition files.
@@ -52,6 +60,7 @@ namespace eval ::tcl::clock {
# Import the message catalog commands that we use.
namespace import ::msgcat::mclocale
+ proc mc {args} { tailcall ::msgcat::mcn [namespace current] {*}$args }
namespace import ::msgcat::mcpackagelocale
}
diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl
index fa21685..f6e5224 100644
--- a/library/msgcat/msgcat.tcl
+++ b/library/msgcat/msgcat.tcl
@@ -1220,27 +1220,32 @@ proc msgcat::mcutil::ConvertLocale {value} {
# - called from an class defined oo object
# - called from a classless oo object
proc ::msgcat::PackageNamespaceGet {} {
- uplevel 2 {
- # Check self namespace to determine environment
- switch -exact -- [namespace which self] {
- {::oo::define::self} {
- # We are within a class definition
- return [namespace qualifiers [self]]
- }
- {::oo::Helpers::self} {
- # We are within an object
- set Class [info object class [self]]
- # Check for classless defined object
- if {$Class eq {::oo::object}} {
- return [namespace qualifiers [self]]
- }
- # Class defined object
- return [namespace qualifiers $Class]
- }
- default {
- # Not in object environment
- return [namespace current]
+ set ns [uplevel 2 { namespace current }]
+
+ if {![string match {::oo::*} $ns]} {
+ # Not in object environment
+ return $ns
+ }
+
+ # Check self namespace to determine environment
+ switch -exact -- [uplevel 2 { namespace which -command self }] {
+ {::oo::define::self} {
+ # We are within a class definition
+ return [namespace qualifiers [uplevel 2 { self }]]
+ }
+ {::oo::Helpers::self} {
+ # We are within an object
+ set Class [info object class [uplevel 2 { self }]]
+ # Check for classless defined object
+ if {$Class eq {::oo::object}} {
+ return [namespace qualifiers [uplevel 2 { self }]]
}
+ # Class defined object
+ return [namespace qualifiers $Class]
+ }
+ default {
+ # Not in object environment
+ return $ns
}
}
}