summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-09-19 14:50:11 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-09-19 14:50:11 (GMT)
commitc57eb3c77c77749299dfec90a74977fa9c5c559b (patch)
treeb1a93c9472066ad889bb814aa68d0b255123be23 /library
parentbd029b94a1f825a22bf635e4c255406562741d5b (diff)
parent562176ad5a881a5f92f2985feab5401c375d559a (diff)
downloadtcl-c57eb3c77c77749299dfec90a74977fa9c5c559b.zip
tcl-c57eb3c77c77749299dfec90a74977fa9c5c559b.tar.gz
tcl-c57eb3c77c77749299dfec90a74977fa9c5c559b.tar.bz2
merge trunkfrq_3527238
<p>change dde version to 1.4.0b2
Diffstat (limited to 'library')
-rw-r--r--library/dde/pkgIndex.tcl4
-rw-r--r--library/init.tcl2
-rw-r--r--library/msgcat/msgcat.tcl82
-rw-r--r--library/msgcat/pkgIndex.tcl2
-rwxr-xr-xlibrary/msgs/uk.msg2
5 files changed, 84 insertions, 8 deletions
diff --git a/library/dde/pkgIndex.tcl b/library/dde/pkgIndex.tcl
index 4cf73d0..8758bd2 100644
--- a/library/dde/pkgIndex.tcl
+++ b/library/dde/pkgIndex.tcl
@@ -1,7 +1,7 @@
if {([info commands ::tcl::pkgconfig] eq "")
|| ([info sharedlibextension] ne ".dll")} return
if {[::tcl::pkgconfig get debug]} {
- package ifneeded dde 1.4.0 [list load [file join $dir tcldde14g.dll] dde]
+ package ifneeded dde 1.4.0b2 [list load [file join $dir tcldde14g.dll] dde]
} else {
- package ifneeded dde 1.4.0 [list load [file join $dir tcldde14.dll] dde]
+ package ifneeded dde 1.4.0b2 [list load [file join $dir tcldde14.dll] dde]
}
diff --git a/library/init.tcl b/library/init.tcl
index 51c7f29..3ec78af 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -15,7 +15,7 @@
if {[info commands package] == ""} {
error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]"
}
-package require -exact Tcl 8.6b2
+package require -exact Tcl 8.6b3
# Compute the auto path to use in this interpreter.
# The values on the path come from several locations:
diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl
index 3377b47..112507a 100644
--- a/library/msgcat/msgcat.tcl
+++ b/library/msgcat/msgcat.tcl
@@ -13,11 +13,11 @@
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.5
+package provide msgcat 1.5.0
namespace eval msgcat {
namespace export mc mcload mclocale mcmax mcmset mcpreferences mcset \
- mcunknown
+ mcunknown mcflset mcflmset
# Records the current locale as passed to mclocale
variable Locale ""
@@ -25,6 +25,9 @@ namespace eval msgcat {
# Records the list of locales to search
variable Loclist {}
+ # Records the locale of the currently sourced message catalogue file
+ variable FileLocale
+
# Records the mapping between source strings and translated strings. The
# dict key is of the form "<locale> <namespace> <src>", where locale and
# namespace should be themselves dict values and the value is
@@ -277,6 +280,11 @@ proc msgcat::mcpreferences {} {
# Returns the number of message catalogs that were loaded.
proc msgcat::mcload {langdir} {
+ variable FileLocale
+ # Save the file locale if we are recursively called
+ if {[info exists FileLocale]} {
+ set nestedFileLocale $FileLocale
+ }
set x 0
foreach p [mcpreferences] {
if { $p eq {} } {
@@ -285,9 +293,17 @@ proc msgcat::mcload {langdir} {
set langfile [file join $langdir $p.msg]
if {[file exists $langfile]} {
incr x
+ set FileLocale [string tolower [file tail [file rootname $langfile]]]
+ if {"root" eq $FileLocale} {
+ set FileLocale ""
+ }
uplevel 1 [list ::source -encoding utf-8 $langfile]
+ unset FileLocale
}
}
+ if {[info exists nestedFileLocale]} {
+ set FileLocale $nestedFileLocale
+ }
return $x
}
@@ -318,6 +334,35 @@ proc msgcat::mcset {locale src {dest ""}} {
return $dest
}
+# msgcat::mcflset --
+#
+# Set the translation for a given string in the current file locale.
+#
+# Arguments:
+# src The source string.
+# dest (Optional) The translated string. If omitted,
+# the source string is used.
+#
+# Results:
+# Returns the new locale.
+
+proc msgcat::mcflset {src {dest ""}} {
+ variable FileLocale
+ variable Msgs
+
+ if {![info exists FileLocale]} {
+ return -code error \
+ "must only be used inside a message catalog loaded with ::msgcat::mcload"
+ }
+ if {[llength [info level 0]] == 2} { ;# dest not specified
+ set dest $src
+ }
+
+ set ns [uplevel 1 [list ::namespace current]]
+ dict set Msgs $FileLocale $ns $src $dest
+ return $dest
+}
+
# msgcat::mcmset --
#
# Set the translation for multiple strings in a specified locale.
@@ -345,7 +390,38 @@ proc msgcat::mcmset {locale pairs } {
dict set Msgs $locale $ns $src $dest
}
- return $length
+ return [expr {$length / 2}]
+}
+
+# msgcat::mcflmset --
+#
+# Set the translation for multiple strings in the mc file locale.
+#
+# Arguments:
+# pairs One or more src/dest pairs (must be even length)
+#
+# Results:
+# Returns the number of pairs processed
+
+proc msgcat::mcflmset {pairs} {
+ variable FileLocale
+ variable Msgs
+
+ if {![info exists FileLocale]} {
+ return -code error \
+ "must only be used inside a message catalog loaded with ::msgcat::mcload"
+ }
+ set length [llength $pairs]
+ if {$length % 2} {
+ return -code error "bad translation list:\
+ should be \"[lindex [info level 0] 0] locale {src dest ...}\""
+ }
+
+ set ns [uplevel 1 [list ::namespace current]]
+ foreach {src dest} $pairs {
+ dict set Msgs $FileLocale $ns $src $dest
+ }
+ return [expr {$length / 2}]
}
# msgcat::mcunknown --
diff --git a/library/msgcat/pkgIndex.tcl b/library/msgcat/pkgIndex.tcl
index 60c2d3c..832bf81 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.5 [list source [file join $dir msgcat.tcl]]
+package ifneeded msgcat 1.5.0 [list source [file join $dir msgcat.tcl]]
diff --git a/library/msgs/uk.msg b/library/msgs/uk.msg
index 3e24f86..7d4c64a 100755
--- a/library/msgs/uk.msg
+++ b/library/msgs/uk.msg
@@ -33,7 +33,7 @@ namespace eval ::tcl::clock {
::msgcat::mcset uk MONTHS_FULL [list \
"\u0441\u0456\u0447\u043d\u044f"\
"\u043b\u044e\u0442\u043e\u0433\u043e"\
- "\u0431\u0435\u0440\u0435\u0436\u043d\u044f"\
+ "\u0431\u0435\u0440\u0435\u0437\u043d\u044f"\
"\u043a\u0432\u0456\u0442\u043d\u044f"\
"\u0442\u0440\u0430\u0432\u043d\u044f"\
"\u0447\u0435\u0440\u0432\u043d\u044f"\