Artifact
66d86ef756baf54736f41a5909b69fac23002dd4:
Attachment "msgcat-1.5.0-1.5.1.patch" to
ticket [3544988fff]
added by
oehhar
2012-07-25 21:51:00.
0000: 2d 2d 2d 20 43 3a 2f 54 63 6c 38 35 2f 6c 69 62 --- C:/Tcl85/lib
0010: 2f 74 63 6c 38 2f 38 2e 35 2f 6d 73 67 63 61 74 /tcl8/8.5/msgcat
0020: 2d 31 2e 35 2e 30 2e 74 6d 09 4d 6f 6e 20 4a 75 -1.5.0.tm.Mon Ju
0030: 6c 20 31 36 20 31 36 3a 30 35 3a 35 36 20 32 30 l 16 16:05:56 20
0040: 31 32 0a 2b 2b 2b 20 43 3a 2f 54 63 6c 38 35 2f 12.+++ C:/Tcl85/
0050: 6c 69 62 2f 74 63 6c 38 2f 38 2e 35 2f 6d 73 67 lib/tcl8/8.5/msg
0060: 63 61 74 2d 31 2e 35 2e 31 2e 74 6d 09 57 65 64 cat-1.5.1.tm.Wed
0070: 20 4a 75 6c 20 32 35 20 31 36 3a 32 37 3a 34 33 Jul 25 16:27:43
0080: 20 32 30 31 32 0a 40 40 20 2d 31 33 2c 31 31 20 2012.@@ -13,11
0090: 2b 31 33 2c 31 31 20 40 40 0a 20 70 61 63 6b 61 +13,11 @@. packa
00a0: 67 65 20 72 65 71 75 69 72 65 20 54 63 6c 20 38 ge require Tcl 8
00b0: 2e 35 0a 20 23 20 57 68 65 6e 20 74 68 65 20 76 .5. # When the v
00c0: 65 72 73 69 6f 6e 20 6e 75 6d 62 65 72 20 63 68 ersion number ch
00d0: 61 6e 67 65 73 2c 20 62 65 20 73 75 72 65 20 74 anges, be sure t
00e0: 6f 20 75 70 64 61 74 65 20 74 68 65 20 70 6b 67 o update the pkg
00f0: 49 6e 64 65 78 2e 74 63 6c 20 66 69 6c 65 2c 0a Index.tcl file,.
0100: 20 23 20 61 6e 64 20 74 68 65 20 69 6e 73 74 61 # and the insta
0110: 6c 6c 61 74 69 6f 6e 20 64 69 72 65 63 74 6f 72 llation director
0120: 79 20 69 6e 20 74 68 65 20 4d 61 6b 65 66 69 6c y in the Makefil
0130: 65 73 2e 0a 2d 70 61 63 6b 61 67 65 20 70 72 6f es..-package pro
0140: 76 69 64 65 20 6d 73 67 63 61 74 20 31 2e 35 2e vide msgcat 1.5.
0150: 30 0a 2b 70 61 63 6b 61 67 65 20 70 72 6f 76 69 0.+package provi
0160: 64 65 20 6d 73 67 63 61 74 20 31 2e 35 2e 31 0a de msgcat 1.5.1.
0170: 20 0a 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 . namespace eva
0180: 6c 20 6d 73 67 63 61 74 20 7b 0a 2d 20 20 20 20 l msgcat {.-
0190: 6e 61 6d 65 73 70 61 63 65 20 65 78 70 6f 72 74 namespace export
01a0: 20 6d 63 63 6f 6e 66 69 67 20 6d 63 20 6d 63 6c mcconfig mc mcl
01b0: 6f 61 64 20 6d 63 6c 6f 63 61 6c 65 20 6d 63 6d oad mclocale mcm
01c0: 61 78 20 6d 63 6d 73 65 74 20 6d 63 70 72 65 66 ax mcmset mcpref
01d0: 65 72 65 6e 63 65 73 20 5c 0a 2d 09 20 20 20 20 erences \.-.
01e0: 6d 63 73 65 74 20 6d 63 75 6e 6b 6e 6f 77 6e 0a mcset mcunknown.
01f0: 2b 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 + namespace e
0200: 78 70 6f 72 74 20 6d 63 63 6f 6e 66 69 67 20 6d xport mcconfig m
0210: 63 20 6d 63 6c 6f 61 64 20 6d 63 6c 6f 63 61 6c c mcload mclocal
0220: 65 20 6d 63 6d 61 78 20 6d 63 6d 73 65 74 20 6d e mcmax mcmset m
0230: 63 66 6c 73 65 74 5c 0a 2b 09 20 20 20 20 6d 63 cflset\.+. mc
0240: 70 72 65 66 65 72 65 6e 63 65 73 20 6d 63 73 65 preferences mcse
0250: 74 20 6d 63 66 6c 73 65 74 20 6d 63 75 6e 6b 6e t mcflset mcunkn
0260: 6f 77 6e 0a 20 0a 20 20 20 20 20 23 20 52 65 63 own. . # Rec
0270: 6f 72 64 73 20 74 68 65 20 63 75 72 72 65 6e 74 ords the current
0280: 20 6c 6f 63 61 6c 65 20 61 73 20 70 61 73 73 65 locale as passe
0290: 64 20 74 6f 20 6d 63 6c 6f 63 61 6c 65 0a 20 20 d to mclocale.
02a0: 20 20 20 76 61 72 69 61 62 6c 65 20 4c 6f 63 61 variable Loca
02b0: 6c 65 20 22 22 0a 40 40 20 2d 32 38 2c 36 20 2b le "".@@ -28,6 +
02c0: 32 38 2c 39 20 40 40 0a 20 20 20 20 20 23 20 4c 28,9 @@. # L
02d0: 69 73 74 20 6f 66 20 66 69 6c 65 20 70 61 74 74 ist of file patt
02e0: 65 72 6e 20 74 6f 20 6c 6f 61 64 20 69 6e 20 61 ern to load in a
02f0: 64 64 69 74 69 6f 6e 20 74 6f 20 4c 6f 63 6c 69 ddition to Locli
0300: 73 74 2e 0a 20 20 20 20 20 76 61 72 69 61 62 6c st.. variabl
0310: 65 20 50 61 74 74 65 72 6e 6c 69 73 74 20 7b 7d e Patternlist {}
0320: 0a 20 0a 2b 20 20 20 20 23 20 4c 6f 63 61 6c 65 . .+ # Locale
0330: 20 6f 66 20 63 75 72 72 65 6e 74 6c 79 20 73 6f of currently so
0340: 75 72 63 65 64 20 6d 65 73 73 61 67 65 20 63 61 urced message ca
0350: 74 61 6c 6f 67 75 65 20 66 69 6c 65 0a 2b 20 20 talogue file.+
0360: 20 20 76 61 72 69 61 62 6c 65 20 4d 43 46 69 6c variable MCFil
0370: 65 4c 6f 63 61 6c 65 20 22 22 0a 2b 0a 20 20 20 eLocale "".+.
0380: 20 20 23 20 52 65 63 6f 72 64 73 20 74 68 65 20 # Records the
0390: 6d 61 70 70 69 6e 67 20 62 65 74 77 65 65 6e 20 mapping between
03a0: 73 6f 75 72 63 65 20 73 74 72 69 6e 67 73 20 61 source strings a
03b0: 6e 64 20 74 72 61 6e 73 6c 61 74 65 64 20 73 74 nd translated st
03c0: 72 69 6e 67 73 2e 20 20 54 68 65 0a 20 20 20 20 rings. The.
03d0: 20 23 20 64 69 63 74 20 6b 65 79 20 69 73 20 6f # dict key is o
03e0: 66 20 74 68 65 20 66 6f 72 6d 20 22 3c 6c 6f 63 f the form "<loc
03f0: 61 6c 65 3e 20 3c 6e 61 6d 65 73 70 61 63 65 3e ale> <namespace>
0400: 20 3c 73 72 63 3e 22 2c 20 77 68 65 72 65 20 6c <src>", where l
0410: 6f 63 61 6c 65 20 61 6e 64 0a 20 20 20 20 20 23 ocale and. #
0420: 20 6e 61 6d 65 73 70 61 63 65 20 73 68 6f 75 6c namespace shoul
0430: 64 20 62 65 20 74 68 65 6d 73 65 6c 76 65 73 20 d be themselves
0440: 64 69 63 74 20 76 61 6c 75 65 73 20 61 6e 64 20 dict values and
0450: 74 68 65 20 76 61 6c 75 65 20 69 73 0a 40 40 20 the value is.@@
0460: 2d 31 37 34 2c 36 20 2b 31 37 37 2c 31 30 20 40 -174,6 +177,10 @
0470: 40 0a 20 23 09 41 76 61 69 6c 61 62 6c 65 20 6f @. #.Available o
0480: 70 74 69 6f 6e 73 20 61 72 65 3a 0a 20 23 09 2d ptions are:. #.-
0490: 70 61 74 74 65 72 6e 0a 20 23 09 20 20 20 20 4c pattern. #. L
04a0: 69 73 74 20 6f 66 20 66 69 6c 65 20 70 61 74 74 ist of file patt
04b0: 65 72 6e 20 74 6f 20 6c 6f 61 64 20 69 6e 20 61 ern to load in a
04c0: 64 64 69 74 69 6f 6e 20 74 6f 20 6d 63 70 72 65 ddition to mcpre
04d0: 66 65 72 65 6e 63 65 73 0a 2b 23 09 2d 6d 63 66 ferences.+#.-mcf
04e0: 69 6c 65 6c 6f 63 61 6c 65 0a 2b 23 09 20 20 20 ilelocale.+#.
04f0: 20 4c 6f 63 61 6c 65 20 65 78 74 72 61 63 74 65 Locale extracte
0500: 64 20 66 72 6f 6d 20 74 68 65 20 66 69 6c 65 20 d from the file
0510: 6e 61 6d 65 20 6f 66 20 61 20 6d 65 73 73 61 67 name of a messag
0520: 65 20 66 69 6c 65 20 77 68 69 63 68 20 69 73 0a e file which is.
0530: 2b 23 09 20 20 20 20 63 75 72 72 65 6e 74 6c 79 +#. currently
0540: 20 73 6f 75 72 63 65 64 2e 0a 2b 23 09 20 20 20 sourced..+#.
0550: 20 54 68 69 73 20 6c 6f 63 61 6c 65 20 69 73 20 This locale is
0560: 75 73 65 64 20 62 79 20 74 68 65 20 63 6f 6d 6d used by the comm
0570: 61 6e 64 73 20 6d 63 66 6c 73 65 74 20 61 6e 64 ands mcflset and
0580: 20 6d 63 66 6c 6d 73 65 74 2e 0a 20 23 0a 20 23 mcflmset.. #. #
0590: 20 41 72 67 75 6d 65 6e 74 73 3a 0a 20 23 09 6f Arguments:. #.o
05a0: 70 74 69 6f 6e 09 54 68 65 20 6e 61 6d 65 20 6f ption.The name o
05b0: 66 20 74 68 65 20 6f 70 74 69 6f 6e 0a 40 40 20 f the option.@@
05c0: 2d 31 38 34 2c 31 35 20 2b 31 39 31 2c 31 38 20 -184,15 +191,18
05d0: 40 40 0a 20 0a 20 70 72 6f 63 20 6d 73 67 63 61 @@. . proc msgca
05e0: 74 3a 3a 6d 63 63 6f 6e 66 69 67 20 7b 61 72 67 t::mcconfig {arg
05f0: 73 7d 20 7b 0a 20 20 20 20 20 76 61 72 69 61 62 s} {. variab
0600: 6c 65 20 50 61 74 74 65 72 6e 6c 69 73 74 0a 2b le Patternlist.+
0610: 20 20 20 20 76 61 72 69 61 62 6c 65 20 4d 43 46 variable MCF
0620: 69 6c 65 4c 6f 63 61 6c 65 0a 20 20 20 20 20 69 ileLocale. i
0630: 66 20 7b 31 20 3d 3d 20 5b 6c 6c 65 6e 67 74 68 f {1 == [llength
0640: 20 24 61 72 67 73 5d 7d 20 7b 0a 20 09 73 77 69 $args]} {. .swi
0650: 74 63 68 20 2d 65 78 61 63 74 20 2d 2d 20 5b 6c tch -exact -- [l
0660: 69 6e 64 65 78 20 24 61 72 67 73 5d 20 7b 0a 20 index $args] {.
0670: 09 20 20 20 20 2d 70 61 74 74 65 72 6e 20 7b 20 . -pattern {
0680: 72 65 74 75 72 6e 20 24 50 61 74 74 65 72 6e 6c return $Patternl
0690: 69 73 74 7d 0a 2b 09 20 20 20 20 2d 6d 63 66 69 ist}.+. -mcfi
06a0: 6c 65 6c 6f 63 61 6c 65 20 7b 20 72 65 74 75 72 lelocale { retur
06b0: 6e 20 24 4d 43 46 69 6c 65 4c 6f 63 61 6c 65 7d n $MCFileLocale}
06c0: 0a 20 09 20 20 20 20 64 65 66 61 75 6c 74 20 7b . . default {
06d0: 20 72 65 74 75 72 6e 20 2d 63 6f 64 65 20 65 72 return -code er
06e0: 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 6f 70 74 ror "Unknown opt
06f0: 69 6f 6e 22 20 7d 0a 20 09 7d 0a 20 20 20 20 20 ion" }. .}.
0700: 7d 0a 20 20 20 20 20 64 69 63 74 20 66 6f 72 20 }. dict for
0710: 7b 6f 70 74 69 6f 6e 20 76 61 6c 75 65 7d 20 24 {option value} $
0720: 61 72 67 73 20 7b 0a 20 09 73 77 69 74 63 68 20 args {. .switch
0730: 2d 65 78 61 63 74 20 2d 2d 20 24 6f 70 74 69 6f -exact -- $optio
0740: 6e 20 7b 0a 20 09 20 20 20 20 2d 70 61 74 74 65 n {. . -patte
0750: 72 6e 20 7b 20 73 65 74 20 50 61 74 74 65 72 6e rn { set Pattern
0760: 6c 69 73 74 20 24 76 61 6c 75 65 20 7d 0a 2b 09 list $value }.+.
0770: 20 20 20 20 2d 6d 63 66 69 6c 65 6c 6f 63 61 6c -mcfilelocal
0780: 65 20 7b 20 73 65 74 20 4d 43 46 69 6c 65 4c 6f e { set MCFileLo
0790: 63 61 6c 65 20 5b 73 74 72 69 6e 67 20 74 6f 6c cale [string tol
07a0: 6f 77 65 72 20 24 76 61 6c 75 65 5d 20 7d 0a 20 ower $value] }.
07b0: 09 20 20 20 20 64 65 66 61 75 6c 74 20 7b 20 72 . default { r
07c0: 65 74 75 72 6e 20 2d 63 6f 64 65 20 65 72 72 6f eturn -code erro
07d0: 72 20 22 55 6e 6b 6e 6f 77 6e 20 6f 70 74 69 6f r "Unknown optio
07e0: 6e 22 20 7d 0a 20 09 7d 0a 20 20 20 20 20 7d 0a n" }. .}. }.
07f0: 40 40 20 2d 33 31 33 2c 36 20 2b 33 32 33 2c 37 @@ -313,6 +323,7
0800: 20 40 40 0a 20 0a 20 70 72 6f 63 20 6d 73 67 63 @@. . proc msgc
0810: 61 74 3a 3a 6d 63 6c 6f 61 64 20 7b 6c 61 6e 67 at::mcload {lang
0820: 64 69 72 7d 20 7b 0a 20 20 20 20 20 76 61 72 69 dir} {. vari
0830: 61 62 6c 65 20 50 61 74 74 65 72 6e 6c 69 73 74 able Patternlist
0840: 0a 2b 20 20 20 20 76 61 72 69 61 62 6c 65 20 4d .+ variable M
0850: 43 46 69 6c 65 4c 6f 63 61 6c 65 0a 20 20 20 20 CFileLocale.
0860: 20 73 65 74 20 78 20 30 0a 20 20 20 20 20 73 65 set x 0. se
0870: 74 20 66 69 6c 65 6c 69 73 74 20 7b 7d 0a 20 20 t filelist {}.
0880: 20 20 20 66 6f 72 65 61 63 68 20 70 61 74 74 65 foreach patte
0890: 72 6e 20 5b 6c 73 6f 72 74 20 2d 75 6e 69 71 75 rn [lsort -uniqu
08a0: 65 20 5b 63 6f 6e 63 61 74 20 5b 6d 63 70 72 65 e [concat [mcpre
08b0: 66 65 72 65 6e 63 65 73 5d 20 24 50 61 74 74 65 ferences] $Patte
08c0: 72 6e 6c 69 73 74 5d 5d 20 7b 0a 40 40 20 2d 33 rnlist]] {.@@ -3
08d0: 32 34 2c 36 20 2b 33 33 35 2c 31 30 20 40 40 0a 24,6 +335,10 @@.
08e0: 20 20 20 20 20 7d 0a 20 20 20 20 20 66 6f 72 65 }. fore
08f0: 61 63 68 20 6c 61 6e 67 66 69 6c 65 20 5b 6c 73 ach langfile [ls
0900: 6f 72 74 20 2d 75 6e 69 71 75 65 20 24 66 69 6c ort -unique $fil
0910: 65 6c 69 73 74 5d 20 7b 0a 20 09 69 6e 63 72 20 elist] {. .incr
0920: 78 0a 2b 09 73 65 74 20 4d 43 46 69 6c 65 4c 6f x.+.set MCFileLo
0930: 63 61 6c 65 20 5b 73 74 72 69 6e 67 20 74 6f 6c cale [string tol
0940: 6f 77 65 72 20 5b 66 69 6c 65 20 74 61 69 6c 20 ower [file tail
0950: 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 6d 65 20 24 [file rootname $
0960: 6c 61 6e 67 66 69 6c 65 5d 5d 5d 0a 2b 09 69 66 langfile]]].+.if
0970: 20 7b 22 72 6f 6f 74 22 20 65 71 20 24 4d 43 46 {"root" eq $MCF
0980: 69 6c 65 4c 6f 63 61 6c 65 7d 20 7b 0a 2b 09 20 ileLocale} {.+.
0990: 20 20 20 73 65 74 20 4d 43 46 69 6c 65 4c 6f 63 set MCFileLoc
09a0: 61 6c 65 20 22 22 0a 2b 09 7d 0a 20 09 75 70 6c ale "".+.}. .upl
09b0: 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 3a 3a 73 evel 1 [list ::s
09c0: 6f 75 72 63 65 20 2d 65 6e 63 6f 64 69 6e 67 20 ource -encoding
09d0: 75 74 66 2d 38 20 24 6c 61 6e 67 66 69 6c 65 5d utf-8 $langfile]
09e0: 0a 20 20 20 20 20 7d 0a 20 20 20 20 20 72 65 74 . }. ret
09f0: 75 72 6e 20 24 78 0a 40 40 20 2d 33 35 36 2c 36 urn $x.@@ -356,6
0a00: 20 2b 33 37 31 2c 33 31 20 40 40 0a 20 20 20 20 +371,31 @@.
0a10: 20 72 65 74 75 72 6e 20 24 64 65 73 74 0a 20 7d return $dest. }
0a20: 0a 20 0a 2b 23 20 6d 73 67 63 61 74 3a 3a 6d 63 . .+# msgcat::mc
0a30: 66 6c 73 65 74 20 2d 2d 0a 2b 23 0a 2b 23 09 53 flset --.+#.+#.S
0a40: 65 74 20 74 68 65 20 74 72 61 6e 73 6c 61 74 69 et the translati
0a50: 6f 6e 20 66 6f 72 20 61 20 67 69 76 65 6e 20 73 on for a given s
0a60: 74 72 69 6e 67 20 69 6e 20 74 68 65 20 63 75 72 tring in the cur
0a70: 72 65 6e 74 20 4d 43 20 66 69 6c 65 20 6c 6f 63 rent MC file loc
0a80: 61 6c 65 2e 0a 2b 23 0a 2b 23 20 41 72 67 75 6d ale..+#.+# Argum
0a90: 65 6e 74 73 3a 0a 2b 23 09 73 72 63 09 09 54 68 ents:.+#.src..Th
0aa0: 65 20 73 6f 75 72 63 65 20 73 74 72 69 6e 67 2e e source string.
0ab0: 0a 2b 23 09 64 65 73 74 09 09 28 4f 70 74 69 6f .+#.dest..(Optio
0ac0: 6e 61 6c 29 20 54 68 65 20 74 72 61 6e 73 6c 61 nal) The transla
0ad0: 74 65 64 20 73 74 72 69 6e 67 2e 20 20 49 66 20 ted string. If
0ae0: 6f 6d 69 74 74 65 64 2c 0a 2b 23 09 09 09 74 68 omitted,.+#...th
0af0: 65 20 73 6f 75 72 63 65 20 73 74 72 69 6e 67 20 e source string
0b00: 69 73 20 75 73 65 64 2e 0a 2b 23 0a 2b 23 20 52 is used..+#.+# R
0b10: 65 73 75 6c 74 73 3a 0a 2b 23 09 52 65 74 75 72 esults:.+#.Retur
0b20: 6e 73 20 74 68 65 20 6e 65 77 20 6c 6f 63 61 6c ns the new local
0b30: 65 2e 0a 2b 0a 2b 70 72 6f 63 20 6d 73 67 63 61 e..+.+proc msgca
0b40: 74 3a 3a 6d 63 66 6c 73 65 74 20 7b 73 72 63 20 t::mcflset {src
0b50: 7b 64 65 73 74 20 22 22 7d 7d 20 7b 0a 2b 20 20 {dest ""}} {.+
0b60: 20 20 76 61 72 69 61 62 6c 65 20 4d 43 46 69 6c variable MCFil
0b70: 65 4c 6f 63 61 6c 65 0a 2b 20 20 20 20 76 61 72 eLocale.+ var
0b80: 69 61 62 6c 65 20 4d 73 67 73 0a 2b 20 20 20 20 iable Msgs.+
0b90: 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 5b 69 6e if {[llength [in
0ba0: 66 6f 20 6c 65 76 65 6c 20 30 5d 5d 20 3d 3d 20 fo level 0]] ==
0bb0: 32 7d 20 7b 20 3b 23 20 64 65 73 74 20 6e 6f 74 2} { ;# dest not
0bc0: 20 73 70 65 63 69 66 69 65 64 0a 2b 09 73 65 74 specified.+.set
0bd0: 20 64 65 73 74 20 24 73 72 63 0a 2b 20 20 20 20 dest $src.+
0be0: 7d 0a 2b 0a 2b 20 20 20 20 73 65 74 20 6e 73 20 }.+.+ set ns
0bf0: 5b 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 [uplevel 1 [list
0c00: 20 3a 3a 6e 61 6d 65 73 70 61 63 65 20 63 75 72 ::namespace cur
0c10: 72 65 6e 74 5d 5d 0a 2b 0a 2b 20 20 20 20 64 69 rent]].+.+ di
0c20: 63 74 20 73 65 74 20 4d 73 67 73 20 24 4d 43 46 ct set Msgs $MCF
0c30: 69 6c 65 4c 6f 63 61 6c 65 20 24 6e 73 20 24 73 ileLocale $ns $s
0c40: 72 63 20 24 64 65 73 74 0a 2b 20 20 20 20 72 65 rc $dest.+ re
0c50: 74 75 72 6e 20 24 64 65 73 74 0a 2b 7d 0a 2b 0a turn $dest.+}.+.
0c60: 20 23 20 6d 73 67 63 61 74 3a 3a 6d 63 6d 73 65 # msgcat::mcmse
0c70: 74 20 2d 2d 0a 20 23 0a 20 23 09 53 65 74 20 74 t --. #. #.Set t
0c80: 68 65 20 74 72 61 6e 73 6c 61 74 69 6f 6e 20 66 he translation f
0c90: 6f 72 20 6d 75 6c 74 69 70 6c 65 20 73 74 72 69 or multiple stri
0ca0: 6e 67 73 20 69 6e 20 61 20 73 70 65 63 69 66 69 ngs in a specifi
0cb0: 65 64 20 6c 6f 63 61 6c 65 2e 0a 40 40 20 2d 33 ed locale..@@ -3
0cc0: 38 31 2c 36 20 2b 34 32 31 2c 33 35 20 40 40 0a 81,6 +421,35 @@.
0cd0: 20 0a 20 20 20 20 20 66 6f 72 65 61 63 68 20 7b . foreach {
0ce0: 73 72 63 20 64 65 73 74 7d 20 24 70 61 69 72 73 src dest} $pairs
0cf0: 20 7b 0a 20 09 64 69 63 74 20 73 65 74 20 4d 73 {. .dict set Ms
0d00: 67 73 20 24 6c 6f 63 61 6c 65 20 24 6e 73 20 24 gs $locale $ns $
0d10: 73 72 63 20 24 64 65 73 74 0a 2b 20 20 20 20 7d src $dest.+ }
0d20: 0a 2b 0a 2b 20 20 20 20 72 65 74 75 72 6e 20 24 .+.+ return $
0d30: 6c 65 6e 67 74 68 0a 2b 7d 0a 2b 0a 2b 23 20 6d length.+}.+.+# m
0d40: 73 67 63 61 74 3a 3a 6d 63 66 6c 6d 73 65 74 20 sgcat::mcflmset
0d50: 2d 2d 0a 2b 23 0a 2b 23 09 53 65 74 20 74 68 65 --.+#.+#.Set the
0d60: 20 74 72 61 6e 73 6c 61 74 69 6f 6e 20 66 6f 72 translation for
0d70: 20 6d 75 6c 74 69 70 6c 65 20 73 74 72 69 6e 67 multiple string
0d80: 73 20 69 6e 20 74 68 65 20 6d 63 20 66 69 6c 65 s in the mc file
0d90: 20 6c 6f 63 61 6c 65 2e 0a 2b 23 0a 2b 23 20 41 locale..+#.+# A
0da0: 72 67 75 6d 65 6e 74 73 3a 0a 2b 23 09 70 61 69 rguments:.+#.pai
0db0: 72 73 09 09 4f 6e 65 20 6f 72 20 6d 6f 72 65 20 rs..One or more
0dc0: 73 72 63 2f 64 65 73 74 20 70 61 69 72 73 20 28 src/dest pairs (
0dd0: 6d 75 73 74 20 62 65 20 65 76 65 6e 20 6c 65 6e must be even len
0de0: 67 74 68 29 0a 2b 23 0a 2b 23 20 52 65 73 75 6c gth).+#.+# Resul
0df0: 74 73 3a 0a 2b 23 09 52 65 74 75 72 6e 73 20 74 ts:.+#.Returns t
0e00: 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 70 61 69 he number of pai
0e10: 72 73 20 70 72 6f 63 65 73 73 65 64 0a 2b 0a 2b rs processed.+.+
0e20: 70 72 6f 63 20 6d 73 67 63 61 74 3a 3a 6d 63 66 proc msgcat::mcf
0e30: 6c 6d 73 65 74 20 7b 70 61 69 72 73 20 7d 20 7b lmset {pairs } {
0e40: 0a 2b 20 20 20 20 76 61 72 69 61 62 6c 65 20 4d .+ variable M
0e50: 43 46 69 6c 65 4c 6f 63 61 6c 65 0a 2b 20 20 20 CFileLocale.+
0e60: 20 76 61 72 69 61 62 6c 65 20 4d 73 67 73 0a 2b variable Msgs.+
0e70: 0a 2b 20 20 20 20 73 65 74 20 6c 65 6e 67 74 68 .+ set length
0e80: 20 5b 6c 6c 65 6e 67 74 68 20 24 70 61 69 72 73 [llength $pairs
0e90: 5d 0a 2b 20 20 20 20 69 66 20 7b 24 6c 65 6e 67 ].+ if {$leng
0ea0: 74 68 20 25 20 32 7d 20 7b 0a 2b 09 72 65 74 75 th % 2} {.+.retu
0eb0: 72 6e 20 2d 63 6f 64 65 20 65 72 72 6f 72 20 22 rn -code error "
0ec0: 62 61 64 20 74 72 61 6e 73 6c 61 74 69 6f 6e 20 bad translation
0ed0: 6c 69 73 74 3a 5c 0a 2b 09 09 20 73 68 6f 75 6c list:\.+.. shoul
0ee0: 64 20 62 65 20 5c 22 5b 6c 69 6e 64 65 78 20 5b d be \"[lindex [
0ef0: 69 6e 66 6f 20 6c 65 76 65 6c 20 30 5d 20 30 5d info level 0] 0]
0f00: 20 6c 6f 63 61 6c 65 20 7b 73 72 63 20 64 65 73 locale {src des
0f10: 74 20 2e 2e 2e 7d 5c 22 22 0a 2b 20 20 20 20 7d t ...}\"".+ }
0f20: 0a 2b 0a 2b 20 20 20 20 73 65 74 20 6e 73 20 5b .+.+ set ns [
0f30: 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 uplevel 1 [list
0f40: 3a 3a 6e 61 6d 65 73 70 61 63 65 20 63 75 72 72 ::namespace curr
0f50: 65 6e 74 5d 5d 0a 2b 0a 2b 20 20 20 20 66 6f 72 ent]].+.+ for
0f60: 65 61 63 68 20 7b 73 72 63 20 64 65 73 74 7d 20 each {src dest}
0f70: 24 70 61 69 72 73 20 7b 0a 2b 09 64 69 63 74 20 $pairs {.+.dict
0f80: 73 65 74 20 4d 73 67 73 20 24 4d 43 46 69 6c 65 set Msgs $MCFile
0f90: 4c 6f 63 61 6c 65 20 24 6e 73 20 24 73 72 63 20 Locale $ns $src
0fa0: 24 64 65 73 74 0a 20 20 20 20 20 7d 0a 20 0a 20 $dest. }. .
0fb0: 20 20 20 20 72 65 74 75 72 6e 20 24 6c 65 6e 67 return $leng
0fc0: 74 68 0a th.