summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-06-21 17:03:54 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-06-21 17:03:54 (GMT)
commit6cabd70c0dad93b763c05c2893f02a868e7dad82 (patch)
tree376000ac77efa31b5ba87715f2835f15c46ffd53 /library
parent5bbb147862ea23bdd98ad9dbcb4c539da07a9bbc (diff)
downloadtcl-6cabd70c0dad93b763c05c2893f02a868e7dad82.zip
tcl-6cabd70c0dad93b763c05c2893f02a868e7dad82.tar.gz
tcl-6cabd70c0dad93b763c05c2893f02a868e7dad82.tar.bz2
Rewrite msgcat::mcutil::getpreferences, not depending on 'string last' returning -1 any more
Diffstat (limited to 'library')
-rw-r--r--library/manifest.txt2
-rw-r--r--library/msgcat/msgcat.tcl22
-rw-r--r--library/msgcat/pkgIndex.tcl2
3 files changed, 14 insertions, 12 deletions
diff --git a/library/manifest.txt b/library/manifest.txt
index c1d7d05..5ae0eb7 100644
--- a/library/manifest.txt
+++ b/library/manifest.txt
@@ -6,7 +6,7 @@ apply {{dir} {
set isafe [interp issafe]
foreach {safe package version file} {
0 http 2.9.2 {http http.tcl}
- 1 msgcat 1.7.0 {msgcat msgcat.tcl}
+ 1 msgcat 1.7.1 {msgcat msgcat.tcl}
1 opt 0.4.7 {opt optparse.tcl}
0 cookiejar 0.2.0 {cookiejar cookiejar.tcl}
0 tcl::idna 1.0.1 {cookiejar idna.tcl}
diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl
index 9f7d54a..e55f93e 100644
--- a/library/msgcat/msgcat.tcl
+++ b/library/msgcat/msgcat.tcl
@@ -15,7 +15,7 @@
package require Tcl 8.7-
# When the version number changes, be sure to update the pkgIndex.tcl file,
# and the installation directory in the Makefiles.
-package provide msgcat 1.7.0
+package provide msgcat 1.7.1
namespace eval msgcat {
namespace export mc mcn mcexists mcload mclocale mcmax\
@@ -360,17 +360,19 @@ proc msgcat::mclocale {args} {
proc msgcat::mcutil::getpreferences {locale} {
set locale [string tolower $locale]
- set loclist [list $locale]
- while {-1 !=[set pos [string last "_" $locale]]} {
- set locale [string range $locale 0 $pos-1]
- if { "_" ne [string index $locale end] } {
- lappend loclist $locale
+ set loclist {}
+ set locel {}
+ foreach el [split $locale _] {
+ if {[string index $locel end] != {_}} {
+ set loclist [linsert $loclist 0 $locel]
+ }
+ if {$locel != {}} {
+ set locel ${locel}_${el}
+ } else {
+ set locel ${el}
}
}
- if {"" ne [lindex $loclist end]} {
- lappend loclist {}
- }
- return $loclist
+ return [linsert $loclist 0 $locel]
}
# msgcat::mcpreferences --
diff --git a/library/msgcat/pkgIndex.tcl b/library/msgcat/pkgIndex.tcl
index 3309a30..18bd71b 100644
--- a/library/msgcat/pkgIndex.tcl
+++ b/library/msgcat/pkgIndex.tcl
@@ -1,2 +1,2 @@
if {![package vsatisfies [package provide Tcl] 8.7-]} {return}
-package ifneeded msgcat 1.7.0 [list source [file join $dir msgcat.tcl]]
+package ifneeded msgcat 1.7.1 [list source [file join $dir msgcat.tcl]]