Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | [Bug 3536888] update: Translate script parameters for msgcat |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b3e93a43b728da4500aa09d3a07f62ff |
User & Date: | jan.nijtmans 2012-07-02 08:40:31 |
Context
2012-07-02
| ||
08:57 | merge-mark check-in: a9f3496920 user: jan.nijtmans tags: trunk | |
08:40 | [Bug 3536888] update: Translate script parameters for msgcat check-in: b3e93a43b7 user: jan.nijtmans tags: trunk | |
2012-07-01
| ||
19:44 | add TclUnixCopyFile to stub table for Cygwin check-in: afb4e7c90a user: jan.nijtmans tags: trunk | |
2012-06-29
| ||
19:27 | translate script parameters for msgcat update msgcat doc Closed-Leaf check-in: 925e009590 user: jan.nijtmans tags: bug-3536888 | |
Changes
Changes to doc/msgcat.n.
︙ | ︙ | |||
9 10 11 12 13 14 15 | .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME msgcat \- Tcl message catalog .SH SYNOPSIS \fBpackage require Tcl 8.5\fR .sp | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME msgcat \- Tcl message catalog .SH SYNOPSIS \fBpackage require Tcl 8.5\fR .sp \fBpackage require msgcat 1.4.5\fR .sp \fB::msgcat::mc \fIsrc-string\fR ?\fIarg arg ...\fR? .sp \fB::msgcat::mcmax ?\fIsrc-string src-string ...\fR? .sp \fB::msgcat::mclocale \fR?\fInewLocale\fR? .sp |
︙ | ︙ | |||
171 172 173 174 175 176 177 | to extract its parts. The initial locale is then set by calling \fB::msgcat::mclocale\fR with the argument .PP .CS language[_country][_modifier] .CE .PP | | | > > > > | | < | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | to extract its parts. The initial locale is then set by calling \fB::msgcat::mclocale\fR with the argument .PP .CS language[_country][_modifier] .CE .PP On Windows and Cygwin, if none of those environment variables is set, msgcat will attempt to extract locale information from the registry. From Windows Vista on, the RFC4747 locale name "lang-script-country-options" is transformed to the locale as "lang_country_script" (Example: sr-Latn-CS -> sr_cs_latin). For Windows XP, the language id is transformed analoguously (Example: 0c1a -> sr_yu_cyrillic). If all these attempts to discover an initial locale from the user's environment fail, msgcat defaults to an initial locale of .QW C . .PP When a locale is specified by the user, a .QW "best match" search is performed during string translation. For example, if a user specifies en_GB_Funky, the locales |
︙ | ︙ |
Changes to library/msgcat/msgcat.tcl.
︙ | ︙ | |||
338 339 340 341 342 343 344 | should be \"[lindex [info level 0] 0] locale {src dest ...}\"" } set locale [string tolower $locale] set ns [uplevel 1 [list ::namespace current]] foreach {src dest} $pairs { | | | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | should be \"[lindex [info level 0] 0] locale {src dest ...}\"" } set locale [string tolower $locale] set ns [uplevel 1 [list ::namespace current]] foreach {src dest} $pairs { dict set Msgs $locale $ns $src $dest } return $length } # msgcat::mcunknown -- # |
︙ | ︙ | |||
384 385 386 387 388 389 390 | # Results: # Returns the length of the longest translated string. proc msgcat::mcmax {args} { set max 0 foreach string $args { set translated [uplevel 1 [list [namespace origin mc] $string]] | | | | | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | # Results: # Returns the length of the longest translated string. proc msgcat::mcmax {args} { set max 0 foreach string $args { set translated [uplevel 1 [list [namespace origin mc] $string]] set len [string length $translated] if {$len>$max} { set max $len } } return $max } # Convert the locale values stored in environment variables to a form # suitable for passing to [mclocale] proc msgcat::ConvertLocale {value} { |
︙ | ︙ | |||
464 465 466 467 468 469 470 | # 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 | | | | | > > > > | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | # 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, translated by table Latn->latin) # -[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@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 } } |
︙ | ︙ |