0000: 27 5c 22 0a 27 5c 22 20 43 6f 70 79 72 69 67 68 '\".'\" Copyrigh
0010: 74 20 28 63 29 20 31 39 39 38 20 4d 61 72 6b 20 t (c) 1998 Mark
0020: 48 61 72 72 69 73 6f 6e 2e 0a 27 5c 22 0a 27 5c Harrison..'\".'\
0030: 22 20 53 65 65 20 74 68 65 20 66 69 6c 65 20 22 " See the file "
0040: 6c 69 63 65 6e 73 65 2e 74 65 72 6d 73 22 20 66 license.terms" f
0050: 6f 72 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f or information o
0060: 6e 20 75 73 61 67 65 20 61 6e 64 20 72 65 64 69 n usage and redi
0070: 73 74 72 69 62 75 74 69 6f 6e 0a 27 5c 22 20 6f stribution.'\" o
0080: 66 20 74 68 69 73 20 66 69 6c 65 2c 20 61 6e 64 f this file, and
0090: 20 66 6f 72 20 61 20 44 49 53 43 4c 41 49 4d 45 for a DISCLAIME
00a0: 52 20 4f 46 20 41 4c 4c 20 57 41 52 52 41 4e 54 R OF ALL WARRANT
00b0: 49 45 53 2e 0a 27 5c 22 0a 2e 54 48 20 22 6d 73 IES..'\"..TH "ms
00c0: 67 63 61 74 22 20 6e 20 31 2e 35 20 6d 73 67 63 gcat" n 1.5 msgc
00d0: 61 74 20 22 54 63 6c 20 42 75 6e 64 6c 65 64 20 at "Tcl Bundled
00e0: 50 61 63 6b 61 67 65 73 22 0a 2e 73 6f 20 6d 61 Packages"..so ma
00f0: 6e 2e 6d 61 63 72 6f 73 0a 2e 42 53 0a 27 5c 22 n.macros..BS.'\"
0100: 20 4e 6f 74 65 3a 20 20 64 6f 20 6e 6f 74 20 6d Note: do not m
0110: 6f 64 69 66 79 20 74 68 65 20 2e 53 48 20 4e 41 odify the .SH NA
0120: 4d 45 20 6c 69 6e 65 20 69 6d 6d 65 64 69 61 74 ME line immediat
0130: 65 6c 79 20 62 65 6c 6f 77 21 0a 2e 53 48 20 4e ely below!..SH N
0140: 41 4d 45 0a 6d 73 67 63 61 74 20 5c 2d 20 54 63 AME.msgcat \- Tc
0150: 6c 20 6d 65 73 73 61 67 65 20 63 61 74 61 6c 6f l message catalo
0160: 67 0a 2e 53 48 20 53 59 4e 4f 50 53 49 53 0a 5c g..SH SYNOPSIS.\
0170: 66 42 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 fBpackage requir
0180: 65 20 54 63 6c 20 38 2e 37 5c 66 52 0a 2e 73 70 e Tcl 8.7\fR..sp
0190: 0a 5c 66 42 70 61 63 6b 61 67 65 20 72 65 71 75 .\fBpackage requ
01a0: 69 72 65 20 6d 73 67 63 61 74 20 31 2e 37 5c 66 ire msgcat 1.7\f
01b0: 52 0a 2e 73 70 0a 5c 66 42 3a 3a 6d 73 67 63 61 R..sp.\fB::msgca
01c0: 74 3a 3a 6d 63 20 5c 66 49 73 72 63 2d 73 74 72 t::mc \fIsrc-str
01d0: 69 6e 67 5c 66 52 20 3f 5c 66 49 61 72 67 20 61 ing\fR ?\fIarg a
01e0: 72 67 20 2e 2e 2e 5c 66 52 3f 0a 2e 73 70 0a 5c rg ...\fR?..sp.\
01f0: 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 6d 61 fB::msgcat::mcma
0200: 78 20 3f 5c 66 49 73 72 63 2d 73 74 72 69 6e 67 x ?\fIsrc-string
0210: 20 73 72 63 2d 73 74 72 69 6e 67 20 2e 2e 2e 5c src-string ...\
0220: 66 52 3f 0a 2e 73 70 0a 2e 56 53 20 22 54 49 50 fR?..sp..VS "TIP
0230: 20 34 31 32 22 0a 5c 66 42 3a 3a 6d 73 67 63 61 412".\fB::msgca
0240: 74 3a 3a 6d 63 65 78 69 73 74 73 5c 66 52 20 3f t::mcexists\fR ?
0250: 5c 66 42 2d 65 78 61 63 74 6e 61 6d 65 73 70 61 \fB-exactnamespa
0260: 63 65 5c 66 52 3f 20 3f 5c 66 42 2d 65 78 61 63 ce\fR? ?\fB-exac
0270: 74 6c 6f 63 61 6c 65 5c 66 52 3f 20 5c 66 49 73 tlocale\fR? \fIs
0280: 72 63 2d 73 74 72 69 6e 67 5c 66 52 0a 2e 56 45 rc-string\fR..VE
0290: 20 22 54 49 50 20 34 31 32 22 0a 2e 73 70 0a 2e "TIP 412"..sp..
02a0: 56 53 20 22 54 49 50 20 34 39 30 22 0a 5c 66 42 VS "TIP 490".\fB
02b0: 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 70 61 63 6b ::msgcat::mcpack
02c0: 61 67 65 6e 61 6d 65 73 70 61 63 65 67 65 74 5c agenamespaceget\
02d0: 66 52 0a 2e 56 45 20 22 54 49 50 20 34 39 30 22 fR..VE "TIP 490"
02e0: 0a 2e 73 70 0a 5c 66 42 3a 3a 6d 73 67 63 61 74 ..sp.\fB::msgcat
02f0: 3a 3a 6d 63 6c 6f 63 61 6c 65 20 5c 66 52 3f 5c ::mclocale \fR?\
0300: 66 49 6e 65 77 4c 6f 63 61 6c 65 5c 66 52 3f 0a fInewLocale\fR?.
0310: 2e 73 70 0a 2e 56 53 20 22 54 49 50 20 34 39 39 .sp..VS "TIP 499
0320: 22 0a 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d ".\fB::msgcat::m
0330: 63 70 72 65 66 65 72 65 6e 63 65 73 5c 66 52 20 cpreferences\fR
0340: 3f 5c 66 49 6c 6f 63 61 6c 65 20 70 72 65 66 65 ?\fIlocale prefe
0350: 72 65 6e 63 65 5c 66 52 3f 20 2e 2e 2e 0a 2e 56 rence\fR? .....V
0360: 45 20 22 54 49 50 20 34 39 39 22 0a 2e 73 70 0a E "TIP 499"..sp.
0370: 2e 56 53 20 22 54 49 50 20 34 31 32 22 0a 5c 66 .VS "TIP 412".\f
0380: 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 6c 6f 61 B::msgcat::mcloa
0390: 64 65 64 6c 6f 63 61 6c 65 73 20 73 75 62 63 6f dedlocales subco
03a0: 6d 6d 61 6e 64 5c 66 52 20 3f 5c 66 49 6c 6f 63 mmand\fR ?\fIloc
03b0: 61 6c 65 5c 66 52 3f 0a 2e 56 45 20 22 54 49 50 ale\fR?..VE "TIP
03c0: 20 34 31 32 22 0a 2e 73 70 0a 5c 66 42 3a 3a 6d 412"..sp.\fB::m
03d0: 73 67 63 61 74 3a 3a 6d 63 6c 6f 61 64 20 5c 66 sgcat::mcload \f
03e0: 49 64 69 72 6e 61 6d 65 5c 66 52 0a 2e 73 70 0a Idirname\fR..sp.
03f0: 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 73 \fB::msgcat::mcs
0400: 65 74 20 5c 66 49 6c 6f 63 61 6c 65 20 73 72 63 et \fIlocale src
0410: 2d 73 74 72 69 6e 67 20 5c 66 52 3f 5c 66 49 74 -string \fR?\fIt
0420: 72 61 6e 73 6c 61 74 65 2d 73 74 72 69 6e 67 5c ranslate-string\
0430: 66 52 3f 0a 2e 73 70 0a 5c 66 42 3a 3a 6d 73 67 fR?..sp.\fB::msg
0440: 63 61 74 3a 3a 6d 63 6d 73 65 74 20 5c 66 49 6c cat::mcmset \fIl
0450: 6f 63 61 6c 65 20 73 72 63 2d 74 72 61 6e 73 2d ocale src-trans-
0460: 6c 69 73 74 5c 66 52 0a 2e 73 70 0a 5c 66 42 3a list\fR..sp.\fB:
0470: 3a 6d 73 67 63 61 74 3a 3a 6d 63 66 6c 73 65 74 :msgcat::mcflset
0480: 20 5c 66 49 73 72 63 2d 73 74 72 69 6e 67 20 5c \fIsrc-string \
0490: 66 52 3f 5c 66 49 74 72 61 6e 73 6c 61 74 65 2d fR?\fItranslate-
04a0: 73 74 72 69 6e 67 5c 66 52 3f 0a 2e 73 70 0a 5c string\fR?..sp.\
04b0: 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 66 6c fB::msgcat::mcfl
04c0: 6d 73 65 74 20 5c 66 49 73 72 63 2d 74 72 61 6e mset \fIsrc-tran
04d0: 73 2d 6c 69 73 74 5c 66 52 0a 2e 73 70 0a 5c 66 s-list\fR..sp.\f
04e0: 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 75 6e 6b B::msgcat::mcunk
04f0: 6e 6f 77 6e 20 5c 66 49 6c 6f 63 61 6c 65 20 73 nown \fIlocale s
0500: 72 63 2d 73 74 72 69 6e 67 5c 66 52 20 3f 5c 66 rc-string\fR ?\f
0510: 49 61 72 67 20 61 72 67 20 2e 2e 2e 5c 66 52 3f Iarg arg ...\fR?
0520: 0a 2e 73 70 0a 2e 56 53 20 22 54 49 50 20 34 31 ..sp..VS "TIP 41
0530: 32 22 0a 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 2".\fB::msgcat::
0540: 6d 63 70 61 63 6b 61 67 65 6c 6f 63 61 6c 65 20 mcpackagelocale
0550: 73 75 62 63 6f 6d 6d 61 6e 64 5c 66 52 20 3f 5c subcommand\fR ?\
0560: 66 49 6c 6f 63 61 6c 65 5c 66 52 3f 0a 2e 73 70 fIlocale\fR?..sp
0570: 0a 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 .\fB::msgcat::mc
0580: 70 61 63 6b 61 67 65 63 6f 6e 66 69 67 20 73 75 packageconfig su
0590: 62 63 6f 6d 6d 61 6e 64 5c 66 52 20 5c 66 49 6f bcommand\fR \fIo
05a0: 70 74 69 6f 6e 5c 66 52 20 3f 5c 66 49 76 61 6c ption\fR ?\fIval
05b0: 75 65 5c 66 52 3f 0a 2e 73 70 0a 5c 66 42 3a 3a ue\fR?..sp.\fB::
05c0: 6d 73 67 63 61 74 3a 3a 6d 63 66 6f 72 67 65 74 msgcat::mcforget
05d0: 70 61 63 6b 61 67 65 5c 66 52 0a 2e 56 45 20 22 package\fR..VE "
05e0: 54 49 50 20 34 31 32 22 0a 2e 73 70 0a 2e 56 53 TIP 412"..sp..VS
05f0: 20 22 54 49 50 20 34 39 39 22 0a 5c 66 42 3a 3a "TIP 499".\fB::
0600: 6d 73 67 63 61 74 3a 3a 6d 63 75 74 69 6c 20 73 msgcat::mcutil s
0610: 75 62 63 6f 6d 6d 61 6e 64 5c 66 52 20 3f 5c 66 ubcommand\fR ?\f
0620: 49 6c 6f 63 61 6c 65 5c 66 52 3f 0a 2e 56 53 20 Ilocale\fR?..VS
0630: 22 54 49 50 20 34 39 39 22 0a 2e 42 45 0a 2e 53 "TIP 499"..BE..S
0640: 48 20 44 45 53 43 52 49 50 54 49 4f 4e 0a 2e 50 H DESCRIPTION..P
0650: 50 0a 54 68 65 20 5c 66 42 6d 73 67 63 61 74 5c P.The \fBmsgcat\
0660: 66 52 20 70 61 63 6b 61 67 65 20 70 72 6f 76 69 fR package provi
0670: 64 65 73 20 61 20 73 65 74 20 6f 66 20 66 75 6e des a set of fun
0680: 63 74 69 6f 6e 73 0a 74 68 61 74 20 63 61 6e 20 ctions.that can
0690: 62 65 20 75 73 65 64 20 74 6f 20 6d 61 6e 61 67 be used to manag
06a0: 65 20 6d 75 6c 74 69 2d 6c 69 6e 67 75 61 6c 20 e multi-lingual
06b0: 75 73 65 72 20 69 6e 74 65 72 66 61 63 65 73 2e user interfaces.
06c0: 0a 54 65 78 74 20 73 74 72 69 6e 67 73 20 61 72 .Text strings ar
06d0: 65 20 64 65 66 69 6e 65 64 20 69 6e 20 61 0a 2e e defined in a..
06e0: 51 57 20 22 6d 65 73 73 61 67 65 20 63 61 74 61 QW "message cata
06f0: 6c 6f 67 22 0a 77 68 69 63 68 20 69 73 20 69 6e log".which is in
0700: 64 65 70 65 6e 64 65 6e 74 20 66 72 6f 6d 20 74 dependent from t
0710: 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2c 20 he application,
0720: 61 6e 64 0a 77 68 69 63 68 20 63 61 6e 20 62 65 and.which can be
0730: 20 65 64 69 74 65 64 20 6f 72 20 6c 6f 63 61 6c edited or local
0740: 69 7a 65 64 20 77 69 74 68 6f 75 74 20 6d 6f 64 ized without mod
0750: 69 66 79 69 6e 67 0a 74 68 65 20 61 70 70 6c 69 ifying.the appli
0760: 63 61 74 69 6f 6e 20 73 6f 75 72 63 65 20 63 6f cation source co
0770: 64 65 2e 20 20 4e 65 77 20 6c 61 6e 67 75 61 67 de. New languag
0780: 65 73 0a 6f 72 20 6c 6f 63 61 6c 65 73 20 6d 61 es.or locales ma
0790: 79 20 62 65 20 70 72 6f 76 69 64 65 64 20 62 79 y be provided by
07a0: 20 61 64 64 69 6e 67 20 61 20 6e 65 77 20 66 69 adding a new fi
07b0: 6c 65 20 74 6f 0a 74 68 65 20 6d 65 73 73 61 67 le to.the messag
07c0: 65 20 63 61 74 61 6c 6f 67 2e 0a 2e 50 50 0a 5c e catalog...PP.\
07d0: 66 42 6d 73 67 63 61 74 5c 66 52 20 64 69 73 74 fBmsgcat\fR dist
07e0: 69 6e 67 75 69 73 65 73 20 70 61 63 6b 61 67 65 inguises package
07f0: 73 20 62 79 20 69 74 73 20 6e 61 6d 65 73 70 61 s by its namespa
0800: 63 65 2e 0a 45 61 63 68 20 70 61 63 6b 61 67 65 ce..Each package
0810: 20 68 61 73 20 69 74 73 20 6f 77 6e 20 6d 65 73 has its own mes
0820: 73 61 67 65 20 63 61 74 61 6c 6f 67 20 61 6e 64 sage catalog and
0830: 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 73 configuration s
0840: 65 74 74 69 6e 67 73 20 69 6e 20 5c 66 42 6d 73 ettings in \fBms
0850: 67 63 61 74 5c 66 52 2e 0a 2e 50 50 0a 41 20 5c gcat\fR...PP.A \
0860: 66 49 6c 6f 63 61 6c 65 5c 66 52 20 69 73 20 61 fIlocale\fR is a
0870: 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e 20 73 specification s
0880: 74 72 69 6e 67 20 64 65 73 63 72 69 62 69 6e 67 tring describing
0890: 20 61 20 75 73 65 72 20 6c 61 6e 67 75 61 67 65 a user language
08a0: 20 6c 69 6b 65 20 5c 66 42 64 65 5f 63 68 5c 66 like \fBde_ch\f
08b0: 52 20 66 6f 72 20 53 77 69 73 73 20 47 65 72 6d R for Swiss Germ
08c0: 61 6e 2e 0a 49 6e 20 5c 66 42 6d 73 67 63 61 74 an..In \fBmsgcat
08d0: 5c 66 52 2c 20 74 68 65 72 65 20 69 73 20 61 20 \fR, there is a
08e0: 67 6c 6f 62 61 6c 20 6c 6f 63 61 6c 65 20 69 6e global locale in
08f0: 69 74 69 61 6c 69 7a 65 64 20 62 79 20 74 68 65 itialized by the
0900: 20 73 79 73 74 65 6d 20 6c 6f 63 61 6c 65 20 6f system locale o
0910: 66 20 74 68 65 20 63 75 72 72 65 6e 74 20 73 79 f the current sy
0920: 73 74 65 6d 2e 0a 45 61 63 68 20 70 61 63 6b 61 stem..Each packa
0930: 67 65 20 6d 61 79 20 64 65 63 69 64 65 20 74 6f ge may decide to
0940: 20 75 73 65 20 74 68 65 20 67 6c 6f 62 61 6c 20 use the global
0950: 6c 6f 63 61 6c 65 20 6f 72 20 74 6f 20 75 73 65 locale or to use
0960: 20 61 20 70 61 63 6b 61 67 65 20 73 70 65 63 69 a package speci
0970: 66 69 63 20 6c 6f 63 61 6c 65 2e 0a 2e 50 50 0a fic locale...PP.
0980: 54 68 65 20 67 6c 6f 62 61 6c 20 6c 6f 63 61 6c The global local
0990: 65 20 6d 61 79 20 62 65 20 63 68 61 6e 67 65 64 e may be changed
09a0: 20 6f 6e 20 64 65 6d 61 6e 64 2c 20 66 6f 72 20 on demand, for
09b0: 65 78 61 6d 70 6c 65 20 62 79 20 61 20 75 73 65 example by a use
09c0: 72 20 69 6e 69 74 69 61 74 65 64 20 6c 61 6e 67 r initiated lang
09d0: 75 61 67 65 20 63 68 61 6e 67 65 20 6f 72 20 77 uage change or w
09e0: 69 74 68 69 6e 20 61 20 6d 75 6c 74 69 20 75 73 ithin a multi us
09f0: 65 72 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6c er application l
0a00: 69 6b 65 20 61 20 77 65 62 20 73 65 72 76 65 72 ike a web server
0a10: 2e 0a 2e 50 50 0a 2e 56 53 20 74 69 70 34 39 30 ...PP..VS tip490
0a20: 0a 4f 62 6a 65 63 74 20 6f 72 69 65 6e 74 65 64 .Object oriented
0a30: 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 73 20 programming is
0a40: 73 75 70 70 6f 72 74 65 64 20 62 79 20 74 68 65 supported by the
0a50: 20 75 73 65 20 6f 66 20 61 20 70 61 63 6b 61 67 use of a packag
0a60: 65 20 6e 61 6d 65 73 70 61 63 65 2e 0a 2e 56 45 e namespace...VE
0a70: 20 74 69 70 34 39 30 0a 2e 50 50 0a 2e 53 48 20 tip490..PP..SH
0a80: 43 4f 4d 4d 41 4e 44 53 0a 2e 54 50 0a 5c 66 42 COMMANDS..TP.\fB
0a90: 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 20 5c 66 49 ::msgcat::mc \fI
0aa0: 73 72 63 2d 73 74 72 69 6e 67 5c 66 52 20 3f 5c src-string\fR ?\
0ab0: 66 49 61 72 67 20 61 72 67 20 2e 2e 2e 5c 66 52 fIarg arg ...\fR
0ac0: 3f 0a 2e 0a 52 65 74 75 72 6e 73 20 61 20 74 72 ?...Returns a tr
0ad0: 61 6e 73 6c 61 74 69 6f 6e 20 6f 66 20 5c 66 49 anslation of \fI
0ae0: 73 72 63 2d 73 74 72 69 6e 67 5c 66 52 20 61 63 src-string\fR ac
0af0: 63 6f 72 64 69 6e 67 20 74 6f 20 74 68 65 0a 63 cording to the.c
0b00: 75 72 72 65 6e 74 20 6c 6f 63 61 6c 65 2e 20 20 urrent locale.
0b10: 49 66 20 61 64 64 69 74 69 6f 6e 61 6c 20 61 72 If additional ar
0b20: 67 75 6d 65 6e 74 73 20 70 61 73 74 20 5c 66 49 guments past \fI
0b30: 73 72 63 2d 73 74 72 69 6e 67 5c 66 52 0a 61 72 src-string\fR.ar
0b40: 65 20 67 69 76 65 6e 2c 20 74 68 65 20 5c 66 42 e given, the \fB
0b50: 66 6f 72 6d 61 74 5c 66 52 20 63 6f 6d 6d 61 6e format\fR comman
0b60: 64 20 69 73 20 75 73 65 64 20 74 6f 20 73 75 62 d is used to sub
0b70: 73 74 69 74 75 74 65 20 74 68 65 0a 61 64 64 69 stitute the.addi
0b80: 74 69 6f 6e 61 6c 20 61 72 67 75 6d 65 6e 74 73 tional arguments
0b90: 20 69 6e 20 74 68 65 20 74 72 61 6e 73 6c 61 74 in the translat
0ba0: 69 6f 6e 20 6f 66 20 5c 66 49 73 72 63 2d 73 74 ion of \fIsrc-st
0bb0: 72 69 6e 67 5c 66 52 2e 0a 2e 52 53 0a 2e 50 50 ring\fR...RS..PP
0bc0: 0a 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 .\fB::msgcat::mc
0bd0: 5c 66 52 20 77 69 6c 6c 20 73 65 61 72 63 68 20 \fR will search
0be0: 74 68 65 20 6d 65 73 73 61 67 65 73 20 64 65 66 the messages def
0bf0: 69 6e 65 64 0a 69 6e 20 74 68 65 20 63 75 72 72 ined.in the curr
0c00: 65 6e 74 20 6e 61 6d 65 73 70 61 63 65 20 66 6f ent namespace fo
0c10: 72 20 61 20 74 72 61 6e 73 6c 61 74 69 6f 6e 20 r a translation
0c20: 6f 66 20 5c 66 49 73 72 63 2d 73 74 72 69 6e 67 of \fIsrc-string
0c30: 5c 66 52 3b 20 69 66 0a 6e 6f 6e 65 20 69 73 20 \fR; if.none is
0c40: 66 6f 75 6e 64 2c 20 69 74 20 77 69 6c 6c 20 73 found, it will s
0c50: 65 61 72 63 68 20 69 6e 20 74 68 65 20 70 61 72 earch in the par
0c60: 65 6e 74 20 6f 66 20 74 68 65 20 63 75 72 72 65 ent of the curre
0c70: 6e 74 20 6e 61 6d 65 73 70 61 63 65 2c 0a 61 6e nt namespace,.an
0c80: 64 20 73 6f 20 6f 6e 20 75 6e 74 69 6c 20 69 74 d so on until it
0c90: 20 72 65 61 63 68 65 73 20 74 68 65 20 67 6c 6f reaches the glo
0ca0: 62 61 6c 20 6e 61 6d 65 73 70 61 63 65 2e 20 20 bal namespace.
0cb0: 49 66 20 6e 6f 20 74 72 61 6e 73 6c 61 74 69 6f If no translatio
0cc0: 6e 0a 73 74 72 69 6e 67 20 65 78 69 73 74 73 2c n.string exists,
0cd0: 20 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 \fB::msgcat::mc
0ce0: 75 6e 6b 6e 6f 77 6e 5c 66 52 20 69 73 20 63 61 unknown\fR is ca
0cf0: 6c 6c 65 64 20 61 6e 64 20 74 68 65 20 73 74 72 lled and the str
0d00: 69 6e 67 0a 72 65 74 75 72 6e 65 64 20 66 72 6f ing.returned fro
0d10: 6d 20 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d m \fB::msgcat::m
0d20: 63 75 6e 6b 6e 6f 77 6e 5c 66 52 20 69 73 20 72 cunknown\fR is r
0d30: 65 74 75 72 6e 65 64 2e 0a 2e 50 50 0a 5c 66 42 eturned...PP.\fB
0d40: 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 5c 66 52 20 ::msgcat::mc\fR
0d50: 69 73 20 74 68 65 20 6d 61 69 6e 20 66 75 6e 63 is the main func
0d60: 74 69 6f 6e 20 75 73 65 64 20 74 6f 20 6c 6f 63 tion used to loc
0d70: 61 6c 69 7a 65 20 61 6e 0a 61 70 70 6c 69 63 61 alize an.applica
0d80: 74 69 6f 6e 2e 20 20 49 6e 73 74 65 61 64 20 6f tion. Instead o
0d90: 66 20 75 73 69 6e 67 20 61 6e 20 45 6e 67 6c 69 f using an Engli
0da0: 73 68 20 73 74 72 69 6e 67 20 64 69 72 65 63 74 sh string direct
0db0: 6c 79 2c 20 61 6e 0a 61 70 70 6c 69 63 61 74 69 ly, an.applicati
0dc0: 6f 6e 20 63 61 6e 20 70 61 73 73 20 74 68 65 20 on can pass the
0dd0: 45 6e 67 6c 69 73 68 20 73 74 72 69 6e 67 20 74 English string t
0de0: 68 72 6f 75 67 68 20 5c 66 42 3a 3a 6d 73 67 63 hrough \fB::msgc
0df0: 61 74 3a 3a 6d 63 5c 66 52 20 61 6e 64 0a 75 73 at::mc\fR and.us
0e00: 65 20 74 68 65 20 72 65 73 75 6c 74 2e 20 20 49 e the result. I
0e10: 66 20 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e f an application
0e20: 20 69 73 20 77 72 69 74 74 65 6e 20 66 6f 72 20 is written for
0e30: 61 20 73 69 6e 67 6c 65 20 6c 61 6e 67 75 61 67 a single languag
0e40: 65 20 69 6e 0a 74 68 69 73 20 66 61 73 68 69 6f e in.this fashio
0e50: 6e 2c 20 74 68 65 6e 20 69 74 20 69 73 20 65 61 n, then it is ea
0e60: 73 79 20 74 6f 20 61 64 64 20 73 75 70 70 6f 72 sy to add suppor
0e70: 74 20 66 6f 72 20 61 64 64 69 74 69 6f 6e 61 6c t for additional
0e80: 20 6c 61 6e 67 75 61 67 65 73 0a 6c 61 74 65 72 languages.later
0e90: 20 73 69 6d 70 6c 79 20 62 79 20 64 65 66 69 6e simply by defin
0ea0: 69 6e 67 20 6e 65 77 20 6d 65 73 73 61 67 65 20 ing new message
0eb0: 63 61 74 61 6c 6f 67 20 65 6e 74 72 69 65 73 2e catalog entries.
0ec0: 0a 2e 52 45 0a 2e 56 53 20 22 54 49 50 20 34 39 ..RE..VS "TIP 49
0ed0: 30 22 0a 2e 54 50 0a 5c 66 42 3a 3a 6d 73 67 63 0"..TP.\fB::msgc
0ee0: 61 74 3a 3a 6d 63 6e 20 5c 66 49 6e 61 6d 65 73 at::mcn \fInames
0ef0: 70 61 63 65 5c 66 52 20 5c 66 49 73 72 63 2d 73 pace\fR \fIsrc-s
0f00: 74 72 69 6e 67 5c 66 52 20 3f 5c 66 49 61 72 67 tring\fR ?\fIarg
0f10: 20 61 72 67 20 2e 2e 2e 5c 66 52 3f 0a 2e 0a 4c arg ...\fR?...L
0f20: 69 6b 65 20 5c 66 42 3a 3a 6d 73 67 63 61 74 3a ike \fB::msgcat:
0f30: 3a 6d 63 5c 66 52 2c 20 62 75 74 20 77 69 74 68 :mc\fR, but with
0f40: 20 74 68 65 20 6d 65 73 73 61 67 65 20 6e 61 6d the message nam
0f50: 65 73 70 61 63 65 20 73 70 65 63 69 66 69 65 64 espace specified
0f60: 20 61 73 20 66 69 72 73 74 20 61 72 67 75 6d 65 as first argume
0f70: 6e 74 2e 0a 2e 50 50 0a 2e 52 53 0a 5c 66 42 6d nt...PP..RS.\fBm
0f80: 63 6e 5c 66 52 20 6d 61 79 20 62 65 20 75 73 65 cn\fR may be use
0f90: 64 20 66 6f 72 20 63 61 73 65 73 20 77 68 65 72 d for cases wher
0fa0: 65 20 74 68 65 20 70 61 63 6b 61 67 65 20 6e 61 e the package na
0fb0: 6d 65 73 70 61 63 65 20 69 73 20 6e 6f 74 20 74 mespace is not t
0fc0: 68 65 20 6e 61 6d 65 73 70 61 63 65 20 6f 66 20 he namespace of
0fd0: 74 68 65 20 63 61 6c 6c 65 72 2e 0a 41 6e 20 65 the caller..An e
0fe0: 78 61 6d 70 6c 65 20 69 73 20 73 68 6f 77 6e 20 xample is shown
0ff0: 77 69 74 68 69 6e 20 74 68 65 20 64 65 73 63 72 within the descr
1000: 69 70 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 6f iption of the co
1010: 6d 6d 61 6e 64 20 5c 66 42 3a 3a 6d 73 67 63 61 mmand \fB::msgca
1020: 74 3a 3a 6d 63 70 61 63 6b 61 67 65 6e 61 6d 65 t::mcpackagename
1030: 73 70 61 63 65 67 65 74 5c 66 52 20 62 65 6c 6f spaceget\fR belo
1040: 77 2e 0a 2e 52 45 0a 2e 50 50 0a 2e 54 50 0a 5c w...RE..PP..TP.\
1050: 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 6d 61 fB::msgcat::mcma
1060: 78 20 3f 5c 66 49 73 72 63 2d 73 74 72 69 6e 67 x ?\fIsrc-string
1070: 20 73 72 63 2d 73 74 72 69 6e 67 20 2e 2e 2e 5c src-string ...\
1080: 66 52 3f 0a 2e 0a 47 69 76 65 6e 20 73 65 76 65 fR?...Given seve
1090: 72 61 6c 20 73 6f 75 72 63 65 20 73 74 72 69 6e ral source strin
10a0: 67 73 2c 20 5c 66 42 3a 3a 6d 73 67 63 61 74 3a gs, \fB::msgcat:
10b0: 3a 6d 63 6d 61 78 5c 66 52 20 72 65 74 75 72 6e :mcmax\fR return
10c0: 73 20 74 68 65 20 6c 65 6e 67 74 68 0a 6f 66 20 s the length.of
10d0: 74 68 65 20 6c 6f 6e 67 65 73 74 20 74 72 61 6e the longest tran
10e0: 73 6c 61 74 65 64 20 73 74 72 69 6e 67 2e 20 20 slated string.
10f0: 54 68 69 73 20 69 73 20 75 73 65 66 75 6c 20 77 This is useful w
1100: 68 65 6e 20 64 65 73 69 67 6e 69 6e 67 0a 6c 6f hen designing.lo
1110: 63 61 6c 69 7a 65 64 20 47 55 49 73 2c 20 77 68 calized GUIs, wh
1120: 69 63 68 20 6d 61 79 20 72 65 71 75 69 72 65 20 ich may require
1130: 74 68 61 74 20 61 6c 6c 20 62 75 74 74 6f 6e 73 that all buttons
1140: 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 62 , for example, b
1150: 65 20 61 0a 66 69 78 65 64 20 77 69 64 74 68 20 e a.fixed width
1160: 28 77 68 69 63 68 20 77 69 6c 6c 20 62 65 20 74 (which will be t
1170: 68 65 20 77 69 64 74 68 20 6f 66 20 74 68 65 20 he width of the
1180: 77 69 64 65 73 74 20 62 75 74 74 6f 6e 29 2e 0a widest button)..
1190: 2e 54 50 0a 2e 56 53 20 22 54 49 50 20 34 31 32 .TP..VS "TIP 412
11a0: 22 0a 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d ".\fB::msgcat::m
11b0: 63 65 78 69 73 74 73 5c 66 52 20 3f 5c 66 42 2d cexists\fR ?\fB-
11c0: 65 78 61 63 74 6e 61 6d 65 73 70 61 63 65 5c 66 exactnamespace\f
11d0: 52 3f 20 3f 5c 66 42 2d 65 78 61 63 74 6c 6f 63 R? ?\fB-exactloc
11e0: 61 6c 65 5c 66 52 3f 20 3f 5c 66 42 2d 6e 61 6d ale\fR? ?\fB-nam
11f0: 65 73 70 61 63 65 5c 66 52 20 5c 66 49 6e 61 6d espace\fR \fInam
1200: 65 73 70 61 63 65 5c 66 52 3f 20 5c 66 49 73 72 espace\fR? \fIsr
1210: 63 2d 73 74 72 69 6e 67 5c 66 52 0a 2e 0a 52 65 c-string\fR...Re
1220: 74 75 72 6e 20 74 72 75 65 2c 20 69 66 20 74 68 turn true, if th
1230: 65 72 65 20 69 73 20 61 20 74 72 61 6e 73 6c 61 ere is a transla
1240: 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 67 69 76 tion for the giv
1250: 65 6e 20 5c 66 49 73 72 63 2d 73 74 72 69 6e 67 en \fIsrc-string
1260: 5c 66 52 2e 0a 2e 50 50 0a 2e 52 53 0a 54 68 65 \fR...PP..RS.The
1270: 20 73 65 61 72 63 68 20 6d 61 79 20 62 65 20 6c search may be l
1280: 69 6d 69 74 65 64 20 62 79 20 74 68 65 20 6f 70 imited by the op
1290: 74 69 6f 6e 20 5c 66 42 5c 2d 65 78 61 63 74 6e tion \fB\-exactn
12a0: 61 6d 65 73 70 61 63 65 5c 66 52 20 74 6f 20 6f amespace\fR to o
12b0: 6e 6c 79 20 63 68 65 63 6b 20 74 68 65 20 63 75 nly check the cu
12c0: 72 72 65 6e 74 20 6e 61 6d 65 73 70 61 63 65 20 rrent namespace
12d0: 61 6e 64 20 6e 6f 74 20 61 6e 79 20 70 61 72 65 and not any pare
12e0: 6e 74 20 6e 61 6d 65 73 70 61 63 65 73 2e 0a 2e nt namespaces...
12f0: 50 50 0a 49 74 20 6d 61 79 20 61 6c 73 6f 20 62 PP.It may also b
1300: 65 20 6c 69 6d 69 74 65 64 20 62 79 20 74 68 65 e limited by the
1310: 20 6f 70 74 69 6f 6e 20 5c 66 42 5c 2d 65 78 61 option \fB\-exa
1320: 63 74 6c 6f 63 61 6c 65 5c 66 52 20 74 6f 20 6f ctlocale\fR to o
1330: 6e 6c 79 20 63 68 65 63 6b 20 74 68 65 20 66 69 nly check the fi
1340: 72 73 74 20 70 72 65 66 65 72 65 64 20 6c 6f 63 rst prefered loc
1350: 61 6c 65 20 28 65 2e 67 2e 20 66 69 72 73 74 20 ale (e.g. first
1360: 65 6c 65 6d 65 6e 74 20 72 65 74 75 72 6e 65 64 element returned
1370: 20 62 79 20 5c 66 42 3a 3a 6d 73 67 63 61 74 3a by \fB::msgcat:
1380: 3a 6d 63 70 72 65 66 65 72 65 6e 63 65 73 5c 66 :mcpreferences\f
1390: 52 20 69 66 20 67 6c 6f 62 61 6c 20 6c 6f 63 61 R if global loca
13a0: 6c 65 20 69 73 20 75 73 65 64 29 2e 0a 2e 50 50 le is used)...PP
13b0: 0a 2e 56 45 20 22 54 49 50 20 34 31 32 22 0a 2e ..VE "TIP 412"..
13c0: 56 53 20 22 54 49 50 20 34 39 30 22 0a 41 6e 20 VS "TIP 490".An
13d0: 65 78 70 6c 69 63 69 74 20 70 61 63 6b 61 67 65 explicit package
13e0: 20 6e 61 6d 65 73 70 61 63 65 20 6d 61 79 20 62 namespace may b
13f0: 65 20 73 70 65 63 69 66 69 65 64 20 62 79 20 74 e specified by t
1400: 68 65 20 6f 70 74 69 6f 6e 20 5c 66 42 2d 6e 61 he option \fB-na
1410: 6d 65 73 70 61 63 65 5c 66 52 2e 0a 54 68 65 20 mespace\fR..The
1420: 6e 61 6d 65 73 70 61 63 65 20 6f 66 20 74 68 65 namespace of the
1430: 20 63 61 6c 6c 65 72 20 69 73 20 75 73 65 64 20 caller is used
1440: 69 66 20 6e 6f 74 20 65 78 70 6c 69 63 69 74 6c if not explicitl
1450: 79 20 73 70 65 63 69 66 69 65 64 2e 0a 2e 52 45 y specified...RE
1460: 0a 2e 50 50 0a 2e 56 45 20 22 54 49 50 20 34 39 ..PP..VE "TIP 49
1470: 30 22 0a 2e 56 53 20 22 54 49 50 20 34 39 30 22 0"..VS "TIP 490"
1480: 0a 2e 54 50 0a 5c 66 42 3a 3a 6d 73 67 63 61 74 ..TP.\fB::msgcat
1490: 3a 3a 6d 63 70 61 63 6b 61 67 65 6e 61 6d 65 73 ::mcpackagenames
14a0: 70 61 63 65 67 65 74 5c 66 52 0a 2e 0a 52 65 74 paceget\fR...Ret
14b0: 75 72 6e 20 74 68 65 20 70 61 63 6b 61 67 65 20 urn the package
14c0: 6e 61 6d 65 73 70 61 63 65 20 6f 66 20 74 68 65 namespace of the
14d0: 20 63 61 6c 6c 65 72 2e 0a 54 68 69 73 20 63 6f caller..This co
14e0: 6d 6d 61 6e 64 20 68 61 6e 64 6c 65 73 20 61 6c mmand handles al
14f0: 6c 20 63 61 73 65 73 20 64 65 73 63 72 69 62 65 l cases describe
1500: 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 5c 66 42 d in section \fB
1510: 4f 42 4a 45 43 54 20 4f 52 49 45 4e 54 45 44 20 OBJECT ORIENTED
1520: 50 52 4f 47 52 41 4d 4d 49 4e 47 5c 66 52 2e 0a PROGRAMMING\fR..
1530: 2e 50 50 0a 2e 52 53 0a 45 78 61 6d 70 6c 65 20 .PP..RS.Example
1540: 75 73 61 67 65 20 69 73 20 61 20 74 6f 6f 6c 74 usage is a toolt
1550: 69 70 20 70 61 63 6b 61 67 65 2c 20 77 68 69 63 ip package, whic
1560: 68 20 73 61 76 65 73 20 74 68 65 20 63 61 6c 6c h saves the call
1570: 65 72 20 70 61 63 6b 61 67 65 20 6e 61 6d 65 73 er package names
1580: 70 61 63 65 20 74 6f 20 75 70 64 61 74 65 20 74 pace to update t
1590: 68 65 20 74 72 61 6e 73 6c 61 74 69 6f 6e 20 65 he translation e
15a0: 61 63 68 20 74 69 6d 65 20 74 68 65 20 74 6f 6f ach time the too
15b0: 6c 74 69 70 20 69 73 20 73 68 6f 77 6e 3a 0a 2e ltip is shown:..
15c0: 43 53 0a 70 72 6f 63 20 3a 3a 74 6f 6f 6c 74 69 CS.proc ::toolti
15d0: 70 3a 3a 74 6f 6f 6c 74 69 70 20 7b 77 69 64 67 p::tooltip {widg
15e0: 65 74 20 6d 65 73 73 61 67 65 7d 20 7b 0a 20 20 et message} {.
15f0: 20 20 2e 2e 2e 0a 20 20 20 20 73 65 74 20 6d 65 .... set me
1600: 73 73 61 67 65 6e 61 6d 65 73 70 61 63 65 20 5b ssagenamespace [
1610: 75 70 6c 65 76 65 6c 20 31 20 7b 3a 3a 6d 73 67 uplevel 1 {::msg
1620: 63 61 74 3a 3a 6d 63 70 61 63 6b 61 67 65 6e 61 cat::mcpackagena
1630: 6d 65 73 70 61 63 65 67 65 74 7d 5d 0a 20 20 20 mespaceget}].
1640: 20 2e 2e 2e 0a 20 20 20 20 62 69 6e 64 20 24 77 .... bind $w
1650: 69 64 67 65 74 20 20 5b 6c 69 73 74 20 3a 3a 74 idget [list ::t
1660: 6f 6f 6c 74 69 70 3a 3a 73 68 6f 77 20 24 77 69 ooltip::show $wi
1670: 64 67 65 74 20 24 6d 65 73 73 61 67 65 6e 61 6d dget $messagenam
1680: 65 73 70 61 63 65 20 24 6d 65 73 73 61 67 65 5d espace $message]
1690: 0a 7d 0a 0a 70 72 6f 63 20 3a 3a 74 6f 6f 6c 74 .}..proc ::toolt
16a0: 69 70 3a 3a 73 68 6f 77 20 7b 77 69 64 67 65 74 ip::show {widget
16b0: 20 6d 65 73 73 61 67 65 6e 61 6d 65 73 70 61 63 messagenamespac
16c0: 65 20 6d 65 73 73 61 67 65 7d 20 7b 0a 20 20 20 e message} {.
16d0: 20 2e 2e 2e 0a 20 20 20 20 73 65 74 20 6d 65 73 .... set mes
16e0: 73 61 67 65 20 5b 3a 3a 6d 73 67 63 61 74 3a 3a sage [::msgcat::
16f0: 6d 63 6e 20 24 6d 65 73 73 61 67 65 6e 61 6d 65 mcn $messagename
1700: 73 70 61 63 65 20 24 6d 65 73 73 61 67 65 5d 0a space $message].
1710: 20 20 20 20 2e 2e 2e 0a 7d 0a 2e 43 45 0a 2e 52 ....}..CE..R
1720: 45 0a 2e 50 50 0a 2e 56 45 20 22 54 49 50 20 34 E..PP..VE "TIP 4
1730: 39 30 22 0a 2e 54 50 0a 5c 66 42 3a 3a 6d 73 67 90"..TP.\fB::msg
1740: 63 61 74 3a 3a 6d 63 6c 6f 63 61 6c 65 20 5c 66 cat::mclocale \f
1750: 52 3f 5c 66 49 6e 65 77 4c 6f 63 61 6c 65 5c 66 R?\fInewLocale\f
1760: 52 3f 0a 2e 0a 49 66 20 5c 66 49 6e 65 77 4c 6f R?...If \fInewLo
1770: 63 61 6c 65 5c 66 52 20 69 73 20 6f 6d 69 74 74 cale\fR is omitt
1780: 65 64 2c 20 74 68 65 20 63 75 72 72 65 6e 74 20 ed, the current
1790: 6c 6f 63 61 6c 65 20 69 73 20 72 65 74 75 72 6e locale is return
17a0: 65 64 2c 20 6f 74 68 65 72 77 69 73 65 20 74 68 ed, otherwise th
17b0: 65 20 63 75 72 72 65 6e 74 20 6c 6f 63 61 6c 65 e current locale
17c0: 0a 69 73 20 73 65 74 20 74 6f 20 5c 66 49 6e 65 .is set to \fIne
17d0: 77 4c 6f 63 61 6c 65 5c 66 52 2e 0a 2e 50 50 0a wLocale\fR...PP.
17e0: 2e 52 53 0a 49 66 20 74 68 65 20 6e 65 77 20 6c .RS.If the new l
17f0: 6f 63 61 6c 65 20 69 73 20 73 65 74 20 74 6f 20 ocale is set to
1800: 5c 66 49 6e 65 77 4c 6f 63 61 6c 65 5c 66 52 2c \fInewLocale\fR,
1810: 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 the correspondi
1820: 6e 67 20 70 72 65 66 65 72 65 6e 63 65 73 20 61 ng preferences a
1830: 72 65 20 63 61 6c 63 75 6c 61 74 65 64 20 61 6e re calculated an
1840: 64 20 73 65 74 2e 0a 46 6f 72 20 65 78 61 6d 70 d set..For examp
1850: 6c 65 2c 20 69 66 20 74 68 65 20 63 75 72 72 65 le, if the curre
1860: 6e 74 20 6c 6f 63 61 6c 65 20 69 73 20 65 6e 5f nt locale is en_
1870: 55 53 5f 66 75 6e 6b 79 2c 20 74 68 65 6e 20 5c US_funky, then \
1880: 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 70 72 fB::msgcat::mcpr
1890: 65 66 65 72 65 6e 63 65 73 5c 66 52 20 72 65 74 eferences\fR ret
18a0: 75 72 6e 73 20 5c 66 42 7b 65 6e 5f 75 73 5f 66 urns \fB{en_us_f
18b0: 75 6e 6b 79 20 65 6e 5f 75 73 20 65 6e 20 7b 7d unky en_us en {}
18c0: 7d 5c 66 52 2e 0a 2e 50 50 0a 54 68 65 20 73 61 }\fR...PP.The sa
18d0: 6d 65 20 72 65 73 75 6c 74 20 6d 61 79 20 62 65 me result may be
18e0: 20 61 63 68 65 76 65 64 20 62 79 20 5c 66 42 3a acheved by \fB:
18f0: 3a 6d 73 67 63 61 74 3a 3a 6d 63 70 72 65 66 65 :msgcat::mcprefe
1900: 72 65 6e 63 65 73 5c 66 52 20 7b 2a 7d 5b 5c 66 rences\fR {*}[\f
1910: 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 75 74 69 B::msgcat::mcuti
1920: 6c 20 67 65 74 70 72 65 66 65 72 65 6e 63 65 73 l getpreferences
1930: 5c 66 52 20 5c 66 49 6e 65 77 4c 6f 63 61 6c 65 \fR \fInewLocale
1940: 5c 66 52 5d 2e 0a 2e 50 50 0a 54 68 65 20 63 75 \fR]...PP.The cu
1950: 72 72 65 6e 74 20 6c 6f 63 61 6c 65 20 69 73 20 rrent locale is
1960: 61 6c 77 61 79 73 20 74 68 65 20 66 69 72 73 74 always the first
1970: 20 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 element of the
1980: 6c 69 73 74 20 72 65 74 75 72 6e 65 64 20 62 79 list returned by
1990: 20 5c 66 42 6d 63 70 72 65 66 65 72 65 6e 63 65 \fBmcpreference
19a0: 73 5c 66 52 2e 0a 2e 50 50 0a 6d 73 67 63 61 74 s\fR...PP.msgcat
19b0: 20 73 74 6f 72 65 73 20 61 6e 64 20 63 6f 6d 70 stores and comp
19c0: 61 72 65 73 20 74 68 65 20 6c 6f 63 61 6c 65 20 ares the locale
19d0: 69 6e 20 61 0a 63 61 73 65 2d 69 6e 73 65 6e 73 in a.case-insens
19e0: 69 74 69 76 65 20 6d 61 6e 6e 65 72 2c 20 61 6e itive manner, an
19f0: 64 20 72 65 74 75 72 6e 73 20 6c 6f 63 61 6c 65 d returns locale
1a00: 73 20 69 6e 20 6c 6f 77 65 72 63 61 73 65 2e 0a s in lowercase..
1a10: 54 68 65 20 69 6e 69 74 69 61 6c 20 6c 6f 63 61 The initial loca
1a20: 6c 65 20 69 73 20 64 65 74 65 72 6d 69 6e 65 64 le is determined
1a30: 20 62 79 20 74 68 65 20 6c 6f 63 61 6c 65 20 73 by the locale s
1a40: 70 65 63 69 66 69 65 64 20 69 6e 0a 74 68 65 20 pecified in.the
1a50: 75 73 65 72 27 73 20 65 6e 76 69 72 6f 6e 6d 65 user's environme
1a60: 6e 74 2e 20 20 53 65 65 20 5c 66 42 4c 4f 43 41 nt. See \fBLOCA
1a70: 4c 45 20 53 50 45 43 49 46 49 43 41 54 49 4f 4e LE SPECIFICATION
1a80: 5c 66 52 0a 62 65 6c 6f 77 20 66 6f 72 20 61 20 \fR.below for a
1a90: 64 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 74 description of t
1aa0: 68 65 20 6c 6f 63 61 6c 65 20 73 74 72 69 6e 67 he locale string
1ab0: 20 66 6f 72 6d 61 74 2e 0a 2e 50 50 0a 2e 56 53 format...PP..VS
1ac0: 20 22 54 49 50 20 34 31 32 22 0a 49 66 20 74 68 "TIP 412".If th
1ad0: 65 20 6c 6f 63 61 6c 65 20 69 73 20 73 65 74 2c e locale is set,
1ae0: 20 74 68 65 20 70 72 65 66 65 72 65 6e 63 65 20 the preference
1af0: 6c 69 73 74 20 6f 66 20 6c 6f 63 61 6c 65 73 20 list of locales
1b00: 69 73 20 65 76 61 6c 75 61 74 65 64 2e 0a 4c 6f is evaluated..Lo
1b10: 63 61 6c 65 73 20 69 6e 20 74 68 69 73 20 6c 69 cales in this li
1b20: 73 74 20 61 72 65 20 6c 6f 61 64 65 64 20 6e 6f st are loaded no
1b30: 77 2c 20 69 66 20 6e 6f 74 20 6a 65 74 20 6c 6f w, if not jet lo
1b40: 61 64 65 64 2e 0a 2e 56 45 20 22 54 49 50 20 34 aded...VE "TIP 4
1b50: 31 32 22 0a 2e 52 45 0a 2e 54 50 0a 5c 66 42 3a 12"..RE..TP.\fB:
1b60: 3a 6d 73 67 63 61 74 3a 3a 6d 63 70 72 65 66 65 :msgcat::mcprefe
1b70: 72 65 6e 63 65 73 5c 66 52 20 3f 5c 66 49 6c 6f rences\fR ?\fIlo
1b80: 63 61 6c 65 20 70 72 65 66 65 72 65 6e 63 65 5c cale preference\
1b90: 66 52 3f 20 2e 2e 2e 0a 2e 0a 57 69 74 68 6f 75 fR? ......Withou
1ba0: 74 20 61 72 67 75 6d 65 6e 74 73 2c 20 72 65 74 t arguments, ret
1bb0: 75 72 6e 73 20 61 6e 20 6f 72 64 65 72 65 64 20 urns an ordered
1bc0: 6c 69 73 74 20 6f 66 20 74 68 65 20 6c 6f 63 61 list of the loca
1bd0: 6c 65 73 20 70 72 65 66 65 72 72 65 64 20 62 79 les preferred by
1be0: 0a 74 68 65 20 75 73 65 72 2e 0a 54 68 65 20 6c .the user..The l
1bf0: 69 73 74 20 69 73 20 6f 72 64 65 72 65 64 20 66 ist is ordered f
1c00: 72 6f 6d 20 6d 6f 73 74 20 73 70 65 63 69 66 69 rom most specifi
1c10: 63 20 74 6f 20 6c 65 61 73 74 20 70 72 65 66 65 c to least prefe
1c20: 72 65 6e 63 65 2e 0a 2e 50 50 0a 2e 56 53 20 22 rence...PP..VS "
1c30: 54 49 50 20 34 39 39 22 0a 2e 52 53 0a 41 20 73 TIP 499"..RS.A s
1c40: 65 74 20 6f 66 20 6c 6f 63 61 6c 65 20 70 72 65 et of locale pre
1c50: 66 65 72 65 6e 63 65 73 20 6d 61 79 20 62 65 20 ferences may be
1c60: 67 69 76 65 6e 20 74 6f 20 73 65 74 20 74 68 65 given to set the
1c70: 20 6c 69 73 74 20 6f 66 20 6c 6f 63 61 6c 65 20 list of locale
1c80: 70 72 65 66 65 72 65 6e 63 65 73 2e 0a 54 68 65 preferences..The
1c90: 20 63 75 72 72 65 6e 74 20 6c 6f 63 61 6c 65 20 current locale
1ca0: 69 73 20 61 6c 73 6f 20 73 65 74 2c 20 77 68 69 is also set, whi
1cb0: 63 68 20 69 73 20 74 68 65 20 66 69 72 73 74 20 ch is the first
1cc0: 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 6c element of the l
1cd0: 6f 63 61 6c 65 20 70 72 65 66 65 72 65 6e 63 65 ocale preference
1ce0: 73 20 6c 69 73 74 2e 0a 2e 50 50 0a 4c 6f 63 61 s list...PP.Loca
1cf0: 6c 65 20 70 72 65 66 65 72 65 6e 63 65 73 20 61 le preferences a
1d00: 72 65 20 6c 6f 61 64 65 64 20 6e 6f 77 2c 20 69 re loaded now, i
1d10: 66 20 6e 6f 74 20 6a 65 74 20 6c 6f 61 64 65 64 f not jet loaded
1d20: 2e 0a 2e 50 50 0a 41 73 20 61 6e 20 65 78 61 6d ...PP.As an exam
1d30: 70 6c 65 2c 20 74 68 65 20 75 73 65 72 20 6d 61 ple, the user ma
1d40: 79 20 70 72 65 66 65 72 20 46 72 65 6e 63 68 20 y prefer French
1d50: 6f 72 20 45 6e 67 6c 69 73 68 20 74 65 78 74 2e or English text.
1d60: 20 54 68 69 73 20 6d 61 79 20 62 65 20 63 6f 6e This may be con
1d70: 66 69 67 75 72 65 64 20 62 79 3a 0a 2e 43 53 0a figured by:..CS.
1d80: 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 70 72 65 66 ::msgcat::mcpref
1d90: 65 72 65 6e 63 65 73 20 66 72 20 65 6e 20 7b 7d erences fr en {}
1da0: 0a 2e 43 45 0a 2e 52 45 0a 2e 50 50 0a 2e 56 53 ..CE..RE..PP..VS
1db0: 20 22 54 49 50 20 34 39 39 22 0a 2e 54 50 0a 5c "TIP 499"..TP.\
1dc0: 66 42 3a 3a 6d 73 67 63 61 74 3a 6d 63 6c 6f 61 fB::msgcat:mcloa
1dd0: 64 65 64 6c 6f 63 61 6c 65 73 20 73 75 62 63 6f dedlocales subco
1de0: 6d 6d 61 6e 64 5c 66 52 20 3f 5c 66 49 6c 6f 63 mmand\fR ?\fIloc
1df0: 61 6c 65 5c 66 52 3f 0a 2e 0a 54 68 69 73 20 67 ale\fR?...This g
1e00: 72 6f 75 70 20 6f 66 20 63 6f 6d 6d 61 6e 64 73 roup of commands
1e10: 20 6d 61 6e 61 67 65 20 74 68 65 20 6c 69 73 74 manage the list
1e20: 20 6f 66 20 6c 6f 61 64 65 64 20 6c 6f 63 61 6c of loaded local
1e30: 65 73 20 66 6f 72 20 70 61 63 6b 61 67 65 73 20 es for packages
1e40: 6e 6f 74 20 73 65 74 74 69 6e 67 20 61 20 70 61 not setting a pa
1e50: 63 6b 61 67 65 20 6c 6f 63 61 6c 65 2e 0a 2e 50 ckage locale...P
1e60: 50 0a 2e 52 53 0a 54 68 65 20 73 75 62 63 6f 6d P..RS.The subcom
1e70: 6d 61 6e 64 20 5c 66 42 67 65 74 5c 66 52 20 72 mand \fBget\fR r
1e80: 65 74 75 72 6e 73 20 74 68 65 20 6c 69 73 74 20 eturns the list
1e90: 6f 66 20 63 75 72 72 65 6e 74 6c 79 20 6c 6f 61 of currently loa
1ea0: 64 65 64 20 6c 6f 63 61 6c 65 73 2e 0a 2e 50 50 ded locales...PP
1eb0: 0a 54 68 65 20 73 75 62 63 6f 6d 6d 61 6e 64 20 .The subcommand
1ec0: 5c 66 42 70 72 65 73 65 6e 74 5c 66 52 20 72 65 \fBpresent\fR re
1ed0: 71 75 69 72 65 73 20 74 68 65 20 61 72 67 75 6d quires the argum
1ee0: 65 6e 74 20 5c 66 49 6c 6f 63 61 6c 65 5c 66 52 ent \fIlocale\fR
1ef0: 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 72 75 and returns tru
1f00: 65 2c 20 69 66 20 74 68 69 73 20 6c 6f 63 61 6c e, if this local
1f10: 65 20 69 73 20 6c 6f 61 64 65 64 2e 0a 2e 50 50 e is loaded...PP
1f20: 0a 54 68 65 20 73 75 62 63 6f 6d 6d 61 6e 64 20 .The subcommand
1f30: 5c 66 42 63 6c 65 61 72 5c 66 52 20 72 65 6d 6f \fBclear\fR remo
1f40: 76 65 73 20 61 6c 6c 20 6c 6f 63 61 6c 65 73 20 ves all locales
1f50: 61 6e 64 20 74 68 65 69 72 20 64 61 74 61 2c 20 and their data,
1f60: 77 68 69 63 68 20 61 72 65 20 6e 6f 74 20 69 6e which are not in
1f70: 20 74 68 65 20 63 75 72 72 65 6e 74 20 70 72 65 the current pre
1f80: 66 65 72 65 6e 63 65 20 6c 69 73 74 2e 0a 2e 52 ference list...R
1f90: 45 0a 2e 54 50 0a 5c 66 42 3a 3a 6d 73 67 63 61 E..TP.\fB::msgca
1fa0: 74 3a 3a 6d 63 6c 6f 61 64 20 5c 66 49 64 69 72 t::mcload \fIdir
1fb0: 6e 61 6d 65 5c 66 52 0a 2e 0a 2e 56 53 20 22 54 name\fR....VS "T
1fc0: 49 50 20 34 31 32 22 0a 53 65 61 72 63 68 65 73 IP 412".Searches
1fd0: 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 64 the specified d
1fe0: 69 72 65 63 74 6f 72 79 20 66 6f 72 20 66 69 6c irectory for fil
1ff0: 65 73 20 74 68 61 74 20 6d 61 74 63 68 0a 74 68 es that match.th
2000: 65 20 6c 61 6e 67 75 61 67 65 20 73 70 65 63 69 e language speci
2010: 66 69 63 61 74 69 6f 6e 73 20 72 65 74 75 72 6e fications return
2020: 65 64 20 62 79 20 5c 66 42 3a 3a 6d 73 67 63 61 ed by \fB::msgca
2030: 74 3a 3a 6d 63 6c 6f 61 64 65 64 6c 6f 63 61 6c t::mcloadedlocal
2040: 65 73 20 67 65 74 5c 66 52 0a 28 6f 72 20 5c 66 es get\fR.(or \f
2050: 42 6d 73 67 63 61 74 3a 3a 6d 63 70 61 63 6b 61 Bmsgcat::mcpacka
2060: 67 65 6c 6f 63 61 6c 65 20 70 72 65 66 65 72 65 gelocale prefere
2070: 6e 63 65 73 5c 66 52 20 69 66 20 61 20 70 61 63 nces\fR if a pac
2080: 6b 61 67 65 20 6c 6f 63 61 6c 65 20 69 73 20 73 kage locale is s
2090: 65 74 29 20 28 6e 6f 74 65 20 74 68 61 74 20 74 et) (note that t
20a0: 68 65 73 65 20 61 72 65 20 61 6c 6c 20 6c 6f 77 hese are all low
20b0: 65 72 63 61 73 65 29 2c 20 65 78 74 65 6e 64 65 ercase), extende
20c0: 64 20 62 79 20 74 68 65 20 66 69 6c 65 20 65 78 d by the file ex
20d0: 74 65 6e 73 69 6f 6e 0a 2e 51 57 20 2e 6d 73 67 tension..QW .msg
20e0: 20 2e 0a 45 61 63 68 20 6d 61 74 63 68 69 6e 67 ..Each matching
20f0: 20 66 69 6c 65 20 69 73 0a 72 65 61 64 20 69 6e file is.read in
2100: 20 6f 72 64 65 72 2c 20 61 73 73 75 6d 69 6e 67 order, assuming
2110: 20 61 20 55 54 46 2d 38 20 65 6e 63 6f 64 69 6e a UTF-8 encodin
2120: 67 2e 20 20 54 68 65 20 66 69 6c 65 20 63 6f 6e g. The file con
2130: 74 65 6e 74 73 20 61 72 65 0a 74 68 65 6e 20 65 tents are.then e
2140: 76 61 6c 75 61 74 65 64 20 61 73 20 61 20 54 63 valuated as a Tc
2150: 6c 20 73 63 72 69 70 74 2e 20 20 54 68 69 73 20 l script. This
2160: 6d 65 61 6e 73 20 74 68 61 74 20 55 6e 69 63 6f means that Unico
2170: 64 65 20 63 68 61 72 61 63 74 65 72 73 0a 6d 61 de characters.ma
2180: 79 20 62 65 20 70 72 65 73 65 6e 74 20 69 6e 20 y be present in
2190: 74 68 65 20 6d 65 73 73 61 67 65 20 66 69 6c 65 the message file
21a0: 20 65 69 74 68 65 72 20 64 69 72 65 63 74 6c 79 either directly
21b0: 20 69 6e 20 74 68 65 69 72 20 55 54 46 2d 38 0a in their UTF-8.
21c0: 65 6e 63 6f 64 65 64 20 66 6f 72 6d 2c 20 6f 72 encoded form, or
21d0: 20 62 79 20 75 73 65 20 6f 66 20 74 68 65 20 62 by use of the b
21e0: 61 63 6b 73 6c 61 73 68 2d 75 20 71 75 6f 74 69 ackslash-u quoti
21f0: 6e 67 20 72 65 63 6f 67 6e 69 7a 65 64 20 62 79 ng recognized by
2200: 20 54 63 6c 0a 65 76 61 6c 75 61 74 69 6f 6e 2e Tcl.evaluation.
2210: 20 20 54 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 The number of
2220: 6d 65 73 73 61 67 65 20 66 69 6c 65 73 20 77 68 message files wh
2230: 69 63 68 20 6d 61 74 63 68 65 64 20 74 68 65 20 ich matched the
2240: 73 70 65 63 69 66 69 63 61 74 69 6f 6e 0a 61 6e specification.an
2250: 64 20 77 65 72 65 20 6c 6f 61 64 65 64 20 69 73 d were loaded is
2260: 20 72 65 74 75 72 6e 65 64 2e 0a 2e 52 53 0a 2e returned...RS..
2270: 50 50 0a 49 6e 20 61 64 64 69 74 69 6f 6e 2c 20 PP.In addition,
2280: 74 68 65 20 67 69 76 65 6e 20 66 6f 6c 64 65 72 the given folder
2290: 20 69 73 20 73 74 6f 72 65 64 20 69 6e 20 74 68 is stored in th
22a0: 65 20 5c 66 42 6d 73 67 63 61 74 5c 66 52 20 70 e \fBmsgcat\fR p
22b0: 61 63 6b 61 67 65 20 63 6f 6e 66 69 67 75 72 61 ackage configura
22c0: 74 69 6f 6e 20 6f 70 74 69 6f 6e 20 5c 66 49 6d tion option \fIm
22d0: 63 66 6f 6c 64 65 72 5c 66 52 20 74 6f 20 65 76 cfolder\fR to ev
22e0: 65 6e 74 75 61 6c 6c 79 20 6c 6f 61 64 20 6d 65 entually load me
22f0: 73 73 61 67 65 20 63 61 74 61 6c 6f 67 20 66 69 ssage catalog fi
2300: 6c 65 73 20 72 65 71 75 69 72 65 64 20 62 79 20 les required by
2310: 61 20 6c 6f 63 61 6c 65 20 63 68 61 6e 67 65 2e a locale change.
2320: 0a 2e 56 45 20 22 54 49 50 20 34 31 32 22 0a 2e ..VE "TIP 412"..
2330: 52 45 0a 2e 54 50 0a 5c 66 42 3a 3a 6d 73 67 63 RE..TP.\fB::msgc
2340: 61 74 3a 3a 6d 63 73 65 74 20 5c 66 49 6c 6f 63 at::mcset \fIloc
2350: 61 6c 65 20 73 72 63 2d 73 74 72 69 6e 67 20 5c ale src-string \
2360: 66 52 3f 5c 66 49 74 72 61 6e 73 6c 61 74 65 2d fR?\fItranslate-
2370: 73 74 72 69 6e 67 5c 66 52 3f 0a 2e 0a 53 65 74 string\fR?...Set
2380: 73 20 74 68 65 20 74 72 61 6e 73 6c 61 74 69 6f s the translatio
2390: 6e 20 66 6f 72 20 5c 66 49 73 72 63 2d 73 74 72 n for \fIsrc-str
23a0: 69 6e 67 5c 66 52 20 74 6f 20 5c 66 49 74 72 61 ing\fR to \fItra
23b0: 6e 73 6c 61 74 65 2d 73 74 72 69 6e 67 5c 66 52 nslate-string\fR
23c0: 0a 69 6e 20 74 68 65 20 73 70 65 63 69 66 69 65 .in the specifie
23d0: 64 20 5c 66 49 6c 6f 63 61 6c 65 5c 66 52 20 61 d \fIlocale\fR a
23e0: 6e 64 20 74 68 65 20 63 75 72 72 65 6e 74 20 6e nd the current n
23f0: 61 6d 65 73 70 61 63 65 2e 20 20 49 66 0a 5c 66 amespace. If.\f
2400: 49 74 72 61 6e 73 6c 61 74 65 2d 73 74 72 69 6e Itranslate-strin
2410: 67 5c 66 52 20 69 73 20 6e 6f 74 20 73 70 65 63 g\fR is not spec
2420: 69 66 69 65 64 2c 20 5c 66 49 73 72 63 2d 73 74 ified, \fIsrc-st
2430: 72 69 6e 67 5c 66 52 20 69 73 20 75 73 65 64 0a ring\fR is used.
2440: 66 6f 72 20 62 6f 74 68 2e 20 20 54 68 65 20 66 for both. The f
2450: 75 6e 63 74 69 6f 6e 20 72 65 74 75 72 6e 73 20 unction returns
2460: 5c 66 49 74 72 61 6e 73 6c 61 74 65 2d 73 74 72 \fItranslate-str
2470: 69 6e 67 5c 66 52 2e 0a 2e 54 50 0a 5c 66 42 3a ing\fR...TP.\fB:
2480: 3a 6d 73 67 63 61 74 3a 3a 6d 63 6d 73 65 74 20 :msgcat::mcmset
2490: 5c 66 49 6c 6f 63 61 6c 65 20 73 72 63 2d 74 72 \fIlocale src-tr
24a0: 61 6e 73 2d 6c 69 73 74 5c 66 52 0a 2e 0a 53 65 ans-list\fR...Se
24b0: 74 73 20 74 68 65 20 74 72 61 6e 73 6c 61 74 69 ts the translati
24c0: 6f 6e 20 66 6f 72 20 6d 75 6c 74 69 70 6c 65 20 on for multiple
24d0: 73 6f 75 72 63 65 20 73 74 72 69 6e 67 73 20 69 source strings i
24e0: 6e 0a 5c 66 49 73 72 63 2d 74 72 61 6e 73 2d 6c n.\fIsrc-trans-l
24f0: 69 73 74 5c 66 52 20 69 6e 20 74 68 65 20 73 70 ist\fR in the sp
2500: 65 63 69 66 69 65 64 20 5c 66 49 6c 6f 63 61 6c ecified \fIlocal
2510: 65 5c 66 52 20 61 6e 64 20 74 68 65 20 63 75 72 e\fR and the cur
2520: 72 65 6e 74 0a 6e 61 6d 65 73 70 61 63 65 2e 0a rent.namespace..
2530: 5c 66 49 73 72 63 2d 74 72 61 6e 73 2d 6c 69 73 \fIsrc-trans-lis
2540: 74 5c 66 52 20 6d 75 73 74 20 68 61 76 65 20 61 t\fR must have a
2550: 6e 20 65 76 65 6e 20 6e 75 6d 62 65 72 20 6f 66 n even number of
2560: 20 65 6c 65 6d 65 6e 74 73 20 61 6e 64 20 69 73 elements and is
2570: 20 69 6e 0a 74 68 65 20 66 6f 72 6d 20 7b 5c 66 in.the form {\f
2580: 49 73 72 63 2d 73 74 72 69 6e 67 20 74 72 61 6e Isrc-string tran
2590: 73 6c 61 74 65 2d 73 74 72 69 6e 67 5c 66 52 20 slate-string\fR
25a0: 3f 5c 66 49 73 72 63 2d 73 74 72 69 6e 67 0a 74 ?\fIsrc-string.t
25b0: 72 61 6e 73 6c 61 74 65 2d 73 74 72 69 6e 67 20 ranslate-string
25c0: 2e 2e 2e 5c 66 52 3f 7d 20 5c 66 42 3a 3a 6d 73 ...\fR?} \fB::ms
25d0: 67 63 61 74 3a 3a 6d 63 6d 73 65 74 5c 66 52 20 gcat::mcmset\fR
25e0: 63 61 6e 20 62 65 20 73 69 67 6e 69 66 69 63 61 can be significa
25f0: 6e 74 6c 79 0a 66 61 73 74 65 72 20 74 68 61 6e ntly.faster than
2600: 20 6d 75 6c 74 69 70 6c 65 20 69 6e 76 6f 63 61 multiple invoca
2610: 74 69 6f 6e 73 20 6f 66 20 5c 66 42 3a 3a 6d 73 tions of \fB::ms
2620: 67 63 61 74 3a 3a 6d 63 73 65 74 5c 66 52 2e 20 gcat::mcset\fR.
2630: 54 68 65 20 66 75 6e 63 74 69 6f 6e 0a 72 65 74 The function.ret
2640: 75 72 6e 73 20 74 68 65 20 6e 75 6d 62 65 72 20 urns the number
2650: 6f 66 20 74 72 61 6e 73 6c 61 74 69 6f 6e 73 20 of translations
2660: 73 65 74 2e 0a 2e 54 50 0a 5c 66 42 3a 3a 6d 73 set...TP.\fB::ms
2670: 67 63 61 74 3a 3a 6d 63 66 6c 73 65 74 20 5c 66 gcat::mcflset \f
2680: 49 73 72 63 2d 73 74 72 69 6e 67 20 5c 66 52 3f Isrc-string \fR?
2690: 5c 66 49 74 72 61 6e 73 6c 61 74 65 2d 73 74 72 \fItranslate-str
26a0: 69 6e 67 5c 66 52 3f 0a 53 65 74 73 20 74 68 65 ing\fR?.Sets the
26b0: 20 74 72 61 6e 73 6c 61 74 69 6f 6e 20 66 6f 72 translation for
26c0: 20 5c 66 49 73 72 63 2d 73 74 72 69 6e 67 5c 66 \fIsrc-string\f
26d0: 52 20 74 6f 20 5c 66 49 74 72 61 6e 73 6c 61 74 R to \fItranslat
26e0: 65 2d 73 74 72 69 6e 67 5c 66 52 20 69 6e 20 74 e-string\fR in t
26f0: 68 65 0a 63 75 72 72 65 6e 74 20 6e 61 6d 65 73 he.current names
2700: 70 61 63 65 20 66 6f 72 20 74 68 65 20 6c 6f 63 pace for the loc
2710: 61 6c 65 20 69 6d 70 6c 69 65 64 20 62 79 20 74 ale implied by t
2720: 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 6d he name of the m
2730: 65 73 73 61 67 65 20 63 61 74 61 6c 6f 67 0a 62 essage catalog.b
2740: 65 69 6e 67 20 6c 6f 61 64 65 64 20 76 69 61 20 eing loaded via
2750: 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 6c \fB::msgcat::mcl
2760: 6f 61 64 5c 66 52 2e 20 20 49 66 20 5c 66 49 74 oad\fR. If \fIt
2770: 72 61 6e 73 6c 61 74 65 2d 73 74 72 69 6e 67 5c ranslate-string\
2780: 66 52 20 69 73 20 6e 6f 74 0a 73 70 65 63 69 66 fR is not.specif
2790: 69 65 64 2c 20 5c 66 49 73 72 63 2d 73 74 72 69 ied, \fIsrc-stri
27a0: 6e 67 5c 66 52 20 69 73 20 75 73 65 64 20 66 6f ng\fR is used fo
27b0: 72 20 62 6f 74 68 2e 20 20 54 68 65 20 66 75 6e r both. The fun
27c0: 63 74 69 6f 6e 20 72 65 74 75 72 6e 73 0a 5c 66 ction returns.\f
27d0: 49 74 72 61 6e 73 6c 61 74 65 2d 73 74 72 69 6e Itranslate-strin
27e0: 67 5c 66 52 2e 0a 2e 54 50 0a 5c 66 42 3a 3a 6d g\fR...TP.\fB::m
27f0: 73 67 63 61 74 3a 3a 6d 63 66 6c 6d 73 65 74 20 sgcat::mcflmset
2800: 5c 66 49 73 72 63 2d 74 72 61 6e 73 2d 6c 69 73 \fIsrc-trans-lis
2810: 74 5c 66 52 0a 53 65 74 73 20 74 68 65 20 74 72 t\fR.Sets the tr
2820: 61 6e 73 6c 61 74 69 6f 6e 20 66 6f 72 20 6d 75 anslation for mu
2830: 6c 74 69 70 6c 65 20 73 6f 75 72 63 65 20 73 74 ltiple source st
2840: 72 69 6e 67 73 20 69 6e 20 5c 66 49 73 72 63 2d rings in \fIsrc-
2850: 74 72 61 6e 73 2d 6c 69 73 74 5c 66 52 20 69 6e trans-list\fR in
2860: 0a 74 68 65 20 63 75 72 72 65 6e 74 20 6e 61 6d .the current nam
2870: 65 73 70 61 63 65 20 66 6f 72 20 74 68 65 20 6c espace for the l
2880: 6f 63 61 6c 65 20 69 6d 70 6c 69 65 64 20 62 79 ocale implied by
2890: 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 the name of the
28a0: 20 6d 65 73 73 61 67 65 0a 63 61 74 61 6c 6f 67 message.catalog
28b0: 20 62 65 69 6e 67 20 6c 6f 61 64 65 64 20 76 69 being loaded vi
28c0: 61 20 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d a \fB::msgcat::m
28d0: 63 6c 6f 61 64 5c 66 52 2e 20 5c 66 49 73 72 63 cload\fR. \fIsrc
28e0: 2d 74 72 61 6e 73 2d 6c 69 73 74 5c 66 52 20 6d -trans-list\fR m
28f0: 75 73 74 0a 68 61 76 65 20 61 6e 20 65 76 65 6e ust.have an even
2900: 20 6e 75 6d 62 65 72 20 6f 66 20 65 6c 65 6d 65 number of eleme
2910: 6e 74 73 20 61 6e 64 20 69 73 20 69 6e 20 74 68 nts and is in th
2920: 65 20 66 6f 72 6d 20 7b 5c 66 49 73 72 63 2d 73 e form {\fIsrc-s
2930: 74 72 69 6e 67 0a 74 72 61 6e 73 6c 61 74 65 2d tring.translate-
2940: 73 74 72 69 6e 67 5c 66 52 20 3f 5c 66 49 73 72 string\fR ?\fIsr
2950: 63 2d 73 74 72 69 6e 67 20 74 72 61 6e 73 6c 61 c-string transla
2960: 74 65 2d 73 74 72 69 6e 67 20 2e 2e 2e 5c 66 52 te-string ...\fR
2970: 3f 7d 0a 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a ?}.\fB::msgcat::
2980: 6d 63 66 6c 6d 73 65 74 5c 66 52 20 63 61 6e 20 mcflmset\fR can
2990: 62 65 20 73 69 67 6e 69 66 69 63 61 6e 74 6c 79 be significantly
29a0: 20 66 61 73 74 65 72 20 74 68 61 6e 20 6d 75 6c faster than mul
29b0: 74 69 70 6c 65 20 69 6e 76 6f 63 61 74 69 6f 6e tiple invocation
29c0: 73 0a 6f 66 20 5c 66 42 3a 3a 6d 73 67 63 61 74 s.of \fB::msgcat
29d0: 3a 3a 6d 63 66 6c 73 65 74 5c 66 52 2e 20 54 68 ::mcflset\fR. Th
29e0: 65 20 66 75 6e 63 74 69 6f 6e 20 72 65 74 75 72 e function retur
29f0: 6e 73 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 ns the number of
2a00: 20 74 72 61 6e 73 6c 61 74 69 6f 6e 73 20 73 65 translations se
2a10: 74 2e 0a 2e 54 50 0a 5c 66 42 3a 3a 6d 73 67 63 t...TP.\fB::msgc
2a20: 61 74 3a 3a 6d 63 75 6e 6b 6e 6f 77 6e 20 5c 66 at::mcunknown \f
2a30: 49 6c 6f 63 61 6c 65 20 73 72 63 2d 73 74 72 69 Ilocale src-stri
2a40: 6e 67 5c 66 52 20 3f 5c 66 49 61 72 67 20 61 72 ng\fR ?\fIarg ar
2a50: 67 20 2e 2e 2e 5c 66 52 3f 0a 2e 0a 54 68 69 73 g ...\fR?...This
2a60: 20 72 6f 75 74 69 6e 65 20 69 73 20 63 61 6c 6c routine is call
2a70: 65 64 20 62 79 20 5c 66 42 3a 3a 6d 73 67 63 61 ed by \fB::msgca
2a80: 74 3a 3a 6d 63 5c 66 52 20 69 6e 20 74 68 65 20 t::mc\fR in the
2a90: 63 61 73 65 20 77 68 65 6e 0a 61 20 74 72 61 6e case when.a tran
2aa0: 73 6c 61 74 69 6f 6e 20 66 6f 72 20 5c 66 49 73 slation for \fIs
2ab0: 72 63 2d 73 74 72 69 6e 67 5c 66 52 20 69 73 20 rc-string\fR is
2ac0: 6e 6f 74 20 64 65 66 69 6e 65 64 20 69 6e 20 74 not defined in t
2ad0: 68 65 0a 63 75 72 72 65 6e 74 20 6c 6f 63 61 6c he.current local
2ae0: 65 2e 20 20 54 68 65 20 64 65 66 61 75 6c 74 20 e. The default
2af0: 61 63 74 69 6f 6e 20 69 73 20 74 6f 20 72 65 74 action is to ret
2b00: 75 72 6e 0a 5c 66 49 73 72 63 2d 73 74 72 69 6e urn.\fIsrc-strin
2b10: 67 5c 66 52 20 70 61 73 73 65 64 20 62 79 20 66 g\fR passed by f
2b20: 6f 72 6d 61 74 20 69 66 20 74 68 65 72 65 20 61 ormat if there a
2b30: 72 65 20 61 6e 79 20 61 72 67 75 6d 65 6e 74 73 re any arguments
2b40: 2e 20 20 54 68 69 73 0a 70 72 6f 63 65 64 75 72 . This.procedur
2b50: 65 20 63 61 6e 20 62 65 20 72 65 64 65 66 69 6e e can be redefin
2b60: 65 64 20 62 79 20 74 68 65 0a 61 70 70 6c 69 63 ed by the.applic
2b70: 61 74 69 6f 6e 2c 20 66 6f 72 20 65 78 61 6d 70 ation, for examp
2b80: 6c 65 20 74 6f 20 6c 6f 67 20 65 72 72 6f 72 20 le to log error
2b90: 6d 65 73 73 61 67 65 73 20 66 6f 72 20 65 61 63 messages for eac
2ba0: 68 20 75 6e 6b 6e 6f 77 6e 0a 73 74 72 69 6e 67 h unknown.string
2bb0: 2e 20 20 54 68 65 20 5c 66 42 3a 3a 6d 73 67 63 . The \fB::msgc
2bc0: 61 74 3a 3a 6d 63 75 6e 6b 6e 6f 77 6e 5c 66 52 at::mcunknown\fR
2bd0: 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 69 6e procedure is in
2be0: 76 6f 6b 65 64 20 61 74 20 74 68 65 0a 73 61 6d voked at the.sam
2bf0: 65 20 73 74 61 63 6b 20 63 6f 6e 74 65 78 74 20 e stack context
2c00: 61 73 20 74 68 65 20 63 61 6c 6c 20 74 6f 20 5c as the call to \
2c10: 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 5c 66 fB::msgcat::mc\f
2c20: 52 2e 20 20 54 68 65 20 72 65 74 75 72 6e 20 76 R. The return v
2c30: 61 6c 75 65 0a 6f 66 20 5c 66 42 3a 3a 6d 73 67 alue.of \fB::msg
2c40: 63 61 74 3a 3a 6d 63 75 6e 6b 6e 6f 77 6e 5c 66 cat::mcunknown\f
2c50: 52 20 69 73 20 75 73 65 64 20 61 73 20 74 68 65 R is used as the
2c60: 20 72 65 74 75 72 6e 20 76 61 6c 75 65 20 66 6f return value fo
2c70: 72 20 74 68 65 20 63 61 6c 6c 0a 74 6f 20 5c 66 r the call.to \f
2c80: 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 5c 66 52 B::msgcat::mc\fR
2c90: 2e 0a 2e 56 53 20 22 54 49 50 20 34 31 32 22 0a ...VS "TIP 412".
2ca0: 2e 52 53 0a 2e 50 50 0a 4e 6f 74 65 20 74 68 61 .RS..PP.Note tha
2cb0: 74 20 74 68 69 73 20 72 6f 75 74 69 6e 65 20 69 t this routine i
2cc0: 73 20 6f 6e 6c 79 20 63 61 6c 6c 65 64 20 69 66 s only called if
2cd0: 20 74 68 65 20 63 6f 6e 63 65 72 6e 65 64 20 70 the concerned p
2ce0: 61 63 6b 61 67 65 20 64 69 64 20 6e 6f 74 20 73 ackage did not s
2cf0: 65 74 20 61 20 70 61 63 6b 61 67 65 20 6c 6f 63 et a package loc
2d00: 61 6c 65 20 75 6e 6b 6e 6f 77 6e 20 63 6f 6d 6d ale unknown comm
2d10: 61 6e 64 20 6e 61 6d 65 2e 0a 2e 52 45 0a 2e 54 and name...RE..T
2d20: 50 0a 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d P.\fB::msgcat::m
2d30: 63 66 6f 72 67 65 74 70 61 63 6b 61 67 65 5c 66 cforgetpackage\f
2d40: 52 0a 2e 0a 54 68 65 20 63 61 6c 6c 69 6e 67 20 R...The calling
2d50: 70 61 63 6b 61 67 65 20 63 6c 65 61 72 73 20 61 package clears a
2d60: 6c 6c 20 69 74 73 20 73 74 61 74 65 20 77 69 74 ll its state wit
2d70: 68 69 6e 20 74 68 65 20 5c 66 42 6d 73 67 63 61 hin the \fBmsgca
2d80: 74 5c 66 52 20 70 61 63 6b 61 67 65 20 69 6e 63 t\fR package inc
2d90: 6c 75 64 69 6e 67 20 61 6c 6c 20 73 65 74 74 69 luding all setti
2da0: 6e 67 73 20 61 6e 64 20 74 72 61 6e 73 6c 61 74 ngs and translat
2db0: 69 6f 6e 73 2e 0a 2e 56 45 20 22 54 49 50 20 34 ions...VE "TIP 4
2dc0: 31 32 22 0a 2e 50 50 0a 2e 56 53 20 22 54 49 50 12"..PP..VS "TIP
2dd0: 20 34 39 39 22 0a 2e 54 50 0a 5c 66 42 3a 3a 6d 499"..TP.\fB::m
2de0: 73 67 63 61 74 3a 3a 6d 63 75 74 69 6c 20 67 65 sgcat::mcutil ge
2df0: 74 70 72 65 66 65 72 65 6e 63 65 73 5c 66 52 20 tpreferences\fR
2e00: 5c 66 49 6c 6f 63 61 6c 65 5c 66 52 0a 2e 0a 52 \fIlocale\fR...R
2e10: 65 74 75 72 6e 20 74 68 65 20 70 72 65 66 65 72 eturn the prefer
2e20: 65 6e 63 65 73 20 6c 69 73 74 20 6f 66 20 74 68 ences list of th
2e30: 65 20 67 69 76 65 6e 20 6c 6f 63 61 6c 65 20 61 e given locale a
2e40: 73 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 73 s described in s
2e50: 65 63 74 69 6f 6e 20 5c 66 42 4c 4f 43 41 4c 45 ection \fBLOCALE
2e60: 20 53 50 45 43 49 46 49 43 41 54 49 4f 4e 5c 66 SPECIFICATION\f
2e70: 52 2e 0a 41 6e 20 65 78 61 6d 70 6c 65 20 69 73 R..An example is
2e80: 20 74 68 65 20 63 6f 6d 70 6f 73 69 74 69 6f 6e the composition
2e90: 20 6f 66 20 61 20 70 72 65 66 65 72 65 6e 63 65 of a preference
2ea0: 20 6c 69 73 74 20 66 6f 72 20 74 68 65 20 62 69 list for the bi
2eb0: 6c 69 6e 67 75 61 6c 20 72 65 67 69 6f 6e 20 22 lingual region "
2ec0: 42 69 65 6c 2f 42 69 65 6e 6e 65 22 20 61 73 20 Biel/Bienne" as
2ed0: 61 20 63 6f 6e 63 61 74 65 6e 61 74 69 6f 6e 20 a concatenation
2ee0: 6f 66 20 73 77 69 73 73 20 67 65 72 6d 61 6e 20 of swiss german
2ef0: 61 6e 64 20 73 77 69 73 73 20 66 72 65 6e 63 68 and swiss french
2f00: 3a 0a 2e 43 53 0a 25 20 63 6f 6e 63 61 74 20 5b :..CS.% concat [
2f10: 6c 72 61 6e 67 65 20 5b 6d 73 67 63 61 74 3a 3a lrange [msgcat::
2f20: 6d 63 75 74 69 6c 20 67 65 74 70 72 65 66 65 72 mcutil getprefer
2f30: 65 6e 63 65 73 20 66 72 5f 43 48 5d 20 30 20 65 ences fr_CH] 0 e
2f40: 6e 64 2d 31 5d 20 5b 6d 73 67 63 61 74 3a 3a 6d nd-1] [msgcat::m
2f50: 63 75 74 69 6c 20 67 65 74 70 72 65 66 65 72 65 cutil getprefere
2f60: 6e 63 65 73 20 64 65 5f 43 48 5d 0a 66 72 5f 63 nces de_CH].fr_c
2f70: 68 20 66 72 20 64 65 5f 63 68 20 64 65 20 7b 7d h fr de_ch de {}
2f80: 0a 2e 43 45 0a 2e 54 50 0a 5c 66 42 3a 3a 6d 73 ..CE..TP.\fB::ms
2f90: 67 63 61 74 3a 3a 6d 63 75 74 69 6c 20 67 65 74 gcat::mcutil get
2fa0: 73 79 73 74 65 6d 6c 6f 63 61 6c 65 5c 66 52 0a systemlocale\fR.
2fb0: 2e 0a 54 68 65 20 73 79 73 74 65 6d 20 6c 6f 63 ..The system loc
2fc0: 61 6c 65 20 69 73 20 72 65 74 75 72 6e 65 64 20 ale is returned
2fd0: 61 73 20 64 65 73 63 72 69 62 65 64 20 62 79 20 as described by
2fe0: 74 68 65 20 73 65 63 74 69 6f 6e 20 5c 66 42 4c the section \fBL
2ff0: 4f 43 41 4c 45 20 53 50 45 43 49 46 49 43 41 54 OCALE SPECIFICAT
3000: 49 4f 4e 5c 66 52 2e 0a 2e 56 45 20 22 54 49 50 ION\fR...VE "TIP
3010: 20 34 39 39 22 0a 2e 50 50 0a 2e 53 48 20 22 4c 499"..PP..SH "L
3020: 4f 43 41 4c 45 20 53 50 45 43 49 46 49 43 41 54 OCALE SPECIFICAT
3030: 49 4f 4e 22 0a 2e 50 50 0a 54 68 65 20 6c 6f 63 ION"..PP.The loc
3040: 61 6c 65 20 69 73 20 73 70 65 63 69 66 69 65 64 ale is specified
3050: 20 74 6f 20 5c 66 42 6d 73 67 63 61 74 5c 66 52 to \fBmsgcat\fR
3060: 20 62 79 20 61 20 6c 6f 63 61 6c 65 20 73 74 72 by a locale str
3070: 69 6e 67 0a 70 61 73 73 65 64 20 74 6f 20 5c 66 ing.passed to \f
3080: 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 6c 6f 63 B::msgcat::mcloc
3090: 61 6c 65 5c 66 52 2e 0a 54 68 65 20 6c 6f 63 61 ale\fR..The loca
30a0: 6c 65 20 73 74 72 69 6e 67 20 63 6f 6e 73 69 73 le string consis
30b0: 74 73 20 6f 66 0a 61 20 6c 61 6e 67 75 61 67 65 ts of.a language
30c0: 20 63 6f 64 65 2c 20 61 6e 20 6f 70 74 69 6f 6e code, an option
30d0: 61 6c 20 63 6f 75 6e 74 72 79 20 63 6f 64 65 2c al country code,
30e0: 20 61 6e 64 20 61 6e 20 6f 70 74 69 6f 6e 61 6c and an optional
30f0: 0a 73 79 73 74 65 6d 2d 73 70 65 63 69 66 69 63 .system-specific
3100: 20 63 6f 64 65 2c 20 65 61 63 68 20 73 65 70 61 code, each sepa
3110: 72 61 74 65 64 20 62 79 0a 2e 51 57 20 5f 20 2e rated by..QW _ .
3120: 0a 54 68 65 20 63 6f 75 6e 74 72 79 20 61 6e 64 .The country and
3130: 20 6c 61 6e 67 75 61 67 65 0a 63 6f 64 65 73 20 language.codes
3140: 61 72 65 20 73 70 65 63 69 66 69 65 64 20 69 6e are specified in
3150: 20 73 74 61 6e 64 61 72 64 73 20 49 53 4f 2d 36 standards ISO-6
3160: 33 39 20 61 6e 64 20 49 53 4f 2d 33 31 36 36 2e 39 and ISO-3166.
3170: 0a 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 .For example, th
3180: 65 20 6c 6f 63 61 6c 65 0a 2e 51 57 20 65 6e 0a e locale..QW en.
3190: 73 70 65 63 69 66 69 65 73 20 45 6e 67 6c 69 73 specifies Englis
31a0: 68 20 61 6e 64 0a 2e 51 57 20 65 6e 5f 55 53 0a h and..QW en_US.
31b0: 73 70 65 63 69 66 69 65 73 20 55 2e 53 2e 20 45 specifies U.S. E
31c0: 6e 67 6c 69 73 68 2e 0a 2e 50 50 0a 57 68 65 6e nglish...PP.When
31d0: 20 74 68 65 20 6d 73 67 63 61 74 20 70 61 63 6b the msgcat pack
31e0: 61 67 65 20 69 73 20 66 69 72 73 74 20 6c 6f 61 age is first loa
31f0: 64 65 64 2c 20 74 68 65 20 6c 6f 63 61 6c 65 20 ded, the locale
3200: 69 73 20 69 6e 69 74 69 61 6c 69 7a 65 64 0a 61 is initialized.a
3210: 63 63 6f 72 64 69 6e 67 20 74 6f 20 74 68 65 20 ccording to the
3220: 75 73 65 72 27 73 20 65 6e 76 69 72 6f 6e 6d 65 user's environme
3230: 6e 74 2e 20 20 54 68 65 20 76 61 72 69 61 62 6c nt. The variabl
3240: 65 73 20 5c 66 42 65 6e 76 28 4c 43 5f 41 4c 4c es \fBenv(LC_ALL
3250: 29 5c 66 52 2c 0a 5c 66 42 65 6e 76 28 4c 43 5f )\fR,.\fBenv(LC_
3260: 4d 45 53 53 41 47 45 53 29 5c 66 52 2c 20 61 6e MESSAGES)\fR, an
3270: 64 20 5c 66 42 65 6e 76 28 4c 41 4e 47 29 5c 66 d \fBenv(LANG)\f
3280: 52 20 61 72 65 20 65 78 61 6d 69 6e 65 64 20 69 R are examined i
3290: 6e 20 6f 72 64 65 72 2e 0a 54 68 65 20 66 69 72 n order..The fir
32a0: 73 74 20 6f 66 20 74 68 65 6d 20 74 6f 20 68 61 st of them to ha
32b0: 76 65 20 61 20 6e 6f 6e 2d 65 6d 70 74 79 20 76 ve a non-empty v
32c0: 61 6c 75 65 20 69 73 20 75 73 65 64 20 74 6f 20 alue is used to
32d0: 64 65 74 65 72 6d 69 6e 65 20 74 68 65 0a 69 6e determine the.in
32e0: 69 74 69 61 6c 20 6c 6f 63 61 6c 65 2e 20 20 54 itial locale. T
32f0: 68 65 20 76 61 6c 75 65 20 69 73 20 70 61 72 73 he value is pars
3300: 65 64 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 ed according to
3310: 74 68 65 20 58 50 47 34 20 70 61 74 74 65 72 6e the XPG4 pattern
3320: 0a 2e 50 50 0a 2e 43 53 0a 6c 61 6e 67 75 61 67 ..PP..CS.languag
3330: 65 5b 5f 63 6f 75 6e 74 72 79 5d 5b 2e 63 6f 64 e[_country][.cod
3340: 65 73 65 74 5d 5b 40 6d 6f 64 69 66 69 65 72 5d eset][@modifier]
3350: 0a 2e 43 45 0a 2e 50 50 0a 74 6f 20 65 78 74 72 ..CE..PP.to extr
3360: 61 63 74 20 69 74 73 20 70 61 72 74 73 2e 20 20 act its parts.
3370: 54 68 65 20 69 6e 69 74 69 61 6c 20 6c 6f 63 61 The initial loca
3380: 6c 65 20 69 73 20 74 68 65 6e 20 73 65 74 20 62 le is then set b
3390: 79 20 63 61 6c 6c 69 6e 67 0a 5c 66 42 3a 3a 6d y calling.\fB::m
33a0: 73 67 63 61 74 3a 3a 6d 63 6c 6f 63 61 6c 65 5c sgcat::mclocale\
33b0: 66 52 20 77 69 74 68 20 74 68 65 20 61 72 67 75 fR with the argu
33c0: 6d 65 6e 74 0a 2e 50 50 0a 2e 43 53 0a 6c 61 6e ment..PP..CS.lan
33d0: 67 75 61 67 65 5b 5f 63 6f 75 6e 74 72 79 5d 5b guage[_country][
33e0: 5f 6d 6f 64 69 66 69 65 72 5d 0a 2e 43 45 0a 2e _modifier]..CE..
33f0: 50 50 0a 4f 6e 20 57 69 6e 64 6f 77 73 20 61 6e PP.On Windows an
3400: 64 20 43 79 67 77 69 6e 2c 20 69 66 20 6e 6f 6e d Cygwin, if non
3410: 65 20 6f 66 20 74 68 6f 73 65 20 65 6e 76 69 72 e of those envir
3420: 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 73 onment variables
3430: 20 69 73 20 73 65 74 2c 0a 6d 73 67 63 61 74 20 is set,.msgcat
3440: 77 69 6c 6c 20 61 74 74 65 6d 70 74 20 74 6f 20 will attempt to
3450: 65 78 74 72 61 63 74 20 6c 6f 63 61 6c 65 20 69 extract locale i
3460: 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 72 6f 6d 20 nformation from
3470: 74 68 65 20 72 65 67 69 73 74 72 79 2e 0a 46 72 the registry..Fr
3480: 6f 6d 20 57 69 6e 64 6f 77 73 20 56 69 73 74 61 om Windows Vista
3490: 20 6f 6e 2c 20 74 68 65 20 52 46 43 34 37 34 37 on, the RFC4747
34a0: 20 6c 6f 63 61 6c 65 20 6e 61 6d 65 20 22 6c 61 locale name "la
34b0: 6e 67 2d 73 63 72 69 70 74 2d 63 6f 75 6e 74 72 ng-script-countr
34c0: 79 2d 6f 70 74 69 6f 6e 73 22 0a 69 73 20 74 72 y-options".is tr
34d0: 61 6e 73 66 6f 72 6d 65 64 20 74 6f 20 74 68 65 ansformed to the
34e0: 20 6c 6f 63 61 6c 65 20 61 73 20 22 6c 61 6e 67 locale as "lang
34f0: 5f 63 6f 75 6e 74 72 79 5f 73 63 72 69 70 74 22 _country_script"
3500: 20 28 45 78 61 6d 70 6c 65 3a 0a 73 72 2d 4c 61 (Example:.sr-La
3510: 74 6e 2d 43 53 20 2d 3e 20 73 72 5f 63 73 5f 6c tn-CS -> sr_cs_l
3520: 61 74 69 6e 29 2e 20 46 6f 72 20 57 69 6e 64 6f atin). For Windo
3530: 77 73 20 58 50 2c 20 74 68 65 20 6c 61 6e 67 75 ws XP, the langu
3540: 61 67 65 20 69 64 20 69 73 0a 74 72 61 6e 73 66 age id is.transf
3550: 6f 72 6d 65 64 20 61 6e 61 6c 6f 67 75 6f 75 73 ormed analoguous
3560: 6c 79 20 28 45 78 61 6d 70 6c 65 3a 20 30 63 31 ly (Example: 0c1
3570: 61 20 2d 3e 20 73 72 5f 79 75 5f 63 79 72 69 6c a -> sr_yu_cyril
3580: 6c 69 63 29 2e 0a 49 66 20 61 6c 6c 20 74 68 65 lic)..If all the
3590: 73 65 20 61 74 74 65 6d 70 74 73 20 74 6f 20 64 se attempts to d
35a0: 69 73 63 6f 76 65 72 20 61 6e 20 69 6e 69 74 69 iscover an initi
35b0: 61 6c 20 6c 6f 63 61 6c 65 20 66 72 6f 6d 20 74 al locale from t
35c0: 68 65 20 75 73 65 72 27 73 0a 65 6e 76 69 72 6f he user's.enviro
35d0: 6e 6d 65 6e 74 20 66 61 69 6c 2c 20 6d 73 67 63 nment fail, msgc
35e0: 61 74 20 64 65 66 61 75 6c 74 73 20 74 6f 20 61 at defaults to a
35f0: 6e 20 69 6e 69 74 69 61 6c 20 6c 6f 63 61 6c 65 n initial locale
3600: 20 6f 66 0a 2e 51 57 20 43 20 2e 0a 2e 50 50 0a of..QW C ...PP.
3610: 57 68 65 6e 20 61 20 6c 6f 63 61 6c 65 20 69 73 When a locale is
3620: 20 73 70 65 63 69 66 69 65 64 20 62 79 20 74 68 specified by th
3630: 65 20 75 73 65 72 2c 20 61 0a 2e 51 57 20 22 62 e user, a..QW "b
3640: 65 73 74 20 6d 61 74 63 68 22 0a 73 65 61 72 63 est match".searc
3650: 68 20 69 73 20 70 65 72 66 6f 72 6d 65 64 20 64 h is performed d
3660: 75 72 69 6e 67 20 73 74 72 69 6e 67 20 74 72 61 uring string tra
3670: 6e 73 6c 61 74 69 6f 6e 2e 20 20 46 6f 72 20 65 nslation. For e
3680: 78 61 6d 70 6c 65 2c 20 69 66 20 61 20 75 73 65 xample, if a use
3690: 72 0a 73 70 65 63 69 66 69 65 73 0a 65 6e 5f 47 r.specifies.en_G
36a0: 42 5f 46 75 6e 6b 79 2c 20 74 68 65 20 6c 6f 63 B_Funky, the loc
36b0: 61 6c 65 73 0a 2e 51 57 20 65 6e 5f 67 62 5f 66 ales..QW en_gb_f
36c0: 75 6e 6b 79 20 2c 0a 2e 51 57 20 65 6e 5f 67 62 unky ,..QW en_gb
36d0: 20 2c 0a 2e 51 57 20 65 6e 0a 61 6e 64 0a 2e 4d ,..QW en.and..M
36e0: 54 0a 28 74 68 65 20 65 6d 70 74 79 20 73 74 72 T.(the empty str
36f0: 69 6e 67 29 0a 61 72 65 20 73 65 61 72 63 68 65 ing).are searche
3700: 64 20 69 6e 20 6f 72 64 65 72 20 75 6e 74 69 6c d in order until
3710: 20 61 20 6d 61 74 63 68 69 6e 67 20 74 72 61 6e a matching tran
3720: 73 6c 61 74 69 6f 6e 0a 73 74 72 69 6e 67 20 69 slation.string i
3730: 73 20 66 6f 75 6e 64 2e 20 20 49 66 20 6e 6f 20 s found. If no
3740: 74 72 61 6e 73 6c 61 74 69 6f 6e 20 73 74 72 69 translation stri
3750: 6e 67 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2c ng is available,
3760: 20 74 68 65 6e 0a 74 68 65 20 75 6e 6b 6e 6f 77 then.the unknow
3770: 6e 20 68 61 6e 64 6c 65 72 20 69 73 20 63 61 6c n handler is cal
3780: 6c 65 64 2e 0a 2e 53 48 20 22 4e 41 4d 45 53 50 led...SH "NAMESP
3790: 41 43 45 53 20 41 4e 44 20 4d 45 53 53 41 47 45 ACES AND MESSAGE
37a0: 20 43 41 54 41 4c 4f 47 53 22 0a 2e 50 50 0a 53 CATALOGS"..PP.S
37b0: 74 72 69 6e 67 73 20 73 74 6f 72 65 64 20 69 6e trings stored in
37c0: 20 74 68 65 20 6d 65 73 73 61 67 65 20 63 61 74 the message cat
37d0: 61 6c 6f 67 20 61 72 65 20 73 74 6f 72 65 64 20 alog are stored
37e0: 72 65 6c 61 74 69 76 65 0a 74 6f 20 74 68 65 20 relative.to the
37f0: 6e 61 6d 65 73 70 61 63 65 20 66 72 6f 6d 20 77 namespace from w
3800: 68 69 63 68 20 74 68 65 79 20 77 65 72 65 20 61 hich they were a
3810: 64 64 65 64 2e 20 20 54 68 69 73 20 61 6c 6c 6f dded. This allo
3820: 77 73 0a 6d 75 6c 74 69 70 6c 65 20 70 61 63 6b ws.multiple pack
3830: 61 67 65 73 20 74 6f 20 75 73 65 20 74 68 65 20 ages to use the
3840: 73 61 6d 65 20 73 74 72 69 6e 67 73 20 77 69 74 same strings wit
3850: 68 6f 75 74 20 66 65 61 72 0a 6f 66 20 63 6f 6c hout fear.of col
3860: 6c 69 73 69 6f 6e 73 20 77 69 74 68 20 6f 74 68 lisions with oth
3870: 65 72 20 70 61 63 6b 61 67 65 73 2e 20 20 49 74 er packages. It
3880: 20 61 6c 73 6f 20 61 6c 6c 6f 77 73 20 74 68 65 also allows the
3890: 0a 73 6f 75 72 63 65 20 73 74 72 69 6e 67 20 74 .source string t
38a0: 6f 20 62 65 20 73 68 6f 72 74 65 72 20 61 6e 64 o be shorter and
38b0: 20 6c 65 73 73 20 70 72 6f 6e 65 20 74 6f 20 74 less prone to t
38c0: 79 70 6f 67 72 61 70 68 69 63 61 6c 0a 65 72 72 ypographical.err
38d0: 6f 72 2e 0a 2e 50 50 0a 46 6f 72 20 65 78 61 6d or...PP.For exam
38e0: 70 6c 65 2c 20 65 78 65 63 75 74 69 6e 67 20 74 ple, executing t
38f0: 68 65 20 63 6f 64 65 0a 2e 50 50 0a 2e 43 53 0a he code..PP..CS.
3900: 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 73 \fB::msgcat::mcs
3910: 65 74 5c 66 52 20 65 6e 20 68 65 6c 6c 6f 20 22 et\fR en hello "
3920: 68 65 6c 6c 6f 20 66 72 6f 6d 20 3a 3a 22 0a 6e hello from ::".n
3930: 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 66 6f amespace eval fo
3940: 6f 20 7b 0a 20 20 20 20 5c 66 42 3a 3a 6d 73 67 o {. \fB::msg
3950: 63 61 74 3a 3a 6d 63 73 65 74 5c 66 52 20 65 6e cat::mcset\fR en
3960: 20 68 65 6c 6c 6f 20 22 68 65 6c 6c 6f 20 66 72 hello "hello fr
3970: 6f 6d 20 3a 3a 66 6f 6f 22 0a 7d 0a 70 75 74 73 om ::foo".}.puts
3980: 20 5b 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d [\fB::msgcat::m
3990: 63 5c 66 52 20 68 65 6c 6c 6f 5d 0a 6e 61 6d 65 c\fR hello].name
39a0: 73 70 61 63 65 20 65 76 61 6c 20 66 6f 6f 20 7b space eval foo {
39b0: 70 75 74 73 20 5b 5c 66 42 3a 3a 6d 73 67 63 61 puts [\fB::msgca
39c0: 74 3a 3a 6d 63 5c 66 52 20 68 65 6c 6c 6f 5d 7d t::mc\fR hello]}
39d0: 0a 2e 43 45 0a 2e 50 50 0a 77 69 6c 6c 20 70 72 ..CE..PP.will pr
39e0: 69 6e 74 0a 2e 50 50 0a 2e 43 53 0a 68 65 6c 6c int..PP..CS.hell
39f0: 6f 20 66 72 6f 6d 20 3a 3a 0a 68 65 6c 6c 6f 20 o from ::.hello
3a00: 66 72 6f 6d 20 3a 3a 66 6f 6f 0a 2e 43 45 0a 2e from ::foo..CE..
3a10: 50 50 0a 57 68 65 6e 20 73 65 61 72 63 68 69 6e PP.When searchin
3a20: 67 20 66 6f 72 20 61 20 74 72 61 6e 73 6c 61 74 g for a translat
3a30: 69 6f 6e 20 6f 66 20 61 20 6d 65 73 73 61 67 65 ion of a message
3a40: 2c 20 74 68 65 0a 6d 65 73 73 61 67 65 20 63 61 , the.message ca
3a50: 74 61 6c 6f 67 20 77 69 6c 6c 20 73 65 61 72 63 talog will searc
3a60: 68 20 66 69 72 73 74 20 74 68 65 20 63 75 72 72 h first the curr
3a70: 65 6e 74 20 6e 61 6d 65 73 70 61 63 65 2c 0a 74 ent namespace,.t
3a80: 68 65 6e 20 74 68 65 20 70 61 72 65 6e 74 20 6f hen the parent o
3a90: 66 20 74 68 65 20 63 75 72 72 65 6e 74 20 6e 61 f the current na
3aa0: 6d 65 73 70 61 63 65 2c 20 61 6e 64 20 73 6f 20 mespace, and so
3ab0: 6f 6e 20 75 6e 74 69 6c 0a 74 68 65 20 67 6c 6f on until.the glo
3ac0: 62 61 6c 20 6e 61 6d 65 73 70 61 63 65 20 69 73 bal namespace is
3ad0: 20 72 65 61 63 68 65 64 2e 20 20 54 68 69 73 20 reached. This
3ae0: 61 6c 6c 6f 77 73 20 63 68 69 6c 64 20 6e 61 6d allows child nam
3af0: 65 73 70 61 63 65 73 20 74 6f 0a 2e 51 57 20 69 espaces to..QW i
3b00: 6e 68 65 72 69 74 0a 6d 65 73 73 61 67 65 73 20 nherit.messages
3b10: 66 72 6f 6d 20 74 68 65 69 72 20 70 61 72 65 6e from their paren
3b20: 74 20 6e 61 6d 65 73 70 61 63 65 2e 0a 2e 50 50 t namespace...PP
3b30: 0a 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 65 78 .For example, ex
3b40: 65 63 75 74 69 6e 67 20 28 69 6e 20 74 68 65 0a ecuting (in the.
3b50: 2e 51 57 20 65 6e 0a 6c 6f 63 61 6c 65 29 20 74 .QW en.locale) t
3b60: 68 65 20 63 6f 64 65 0a 2e 50 50 0a 2e 43 53 0a he code..PP..CS.
3b70: 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 73 \fB::msgcat::mcs
3b80: 65 74 5c 66 52 20 65 6e 20 6d 31 20 22 3a 3a 20 et\fR en m1 "::
3b90: 6d 65 73 73 61 67 65 31 22 0a 5c 66 42 3a 3a 6d message1".\fB::m
3ba0: 73 67 63 61 74 3a 3a 6d 63 73 65 74 5c 66 52 20 sgcat::mcset\fR
3bb0: 65 6e 20 6d 32 20 22 3a 3a 20 6d 65 73 73 61 67 en m2 ":: messag
3bc0: 65 32 22 0a 5c 66 42 3a 3a 6d 73 67 63 61 74 3a e2".\fB::msgcat:
3bd0: 3a 6d 63 73 65 74 5c 66 52 20 65 6e 20 6d 33 20 :mcset\fR en m3
3be0: 22 3a 3a 20 6d 65 73 73 61 67 65 33 22 0a 6e 61 ":: message3".na
3bf0: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 66 mespace eval ::f
3c00: 6f 6f 20 7b 0a 20 20 20 20 5c 66 42 3a 3a 6d 73 oo {. \fB::ms
3c10: 67 63 61 74 3a 3a 6d 63 73 65 74 5c 66 52 20 65 gcat::mcset\fR e
3c20: 6e 20 6d 32 20 22 3a 3a 66 6f 6f 20 6d 65 73 73 n m2 "::foo mess
3c30: 61 67 65 32 22 0a 20 20 20 20 5c 66 42 3a 3a 6d age2". \fB::m
3c40: 73 67 63 61 74 3a 3a 6d 63 73 65 74 5c 66 52 20 sgcat::mcset\fR
3c50: 65 6e 20 6d 33 20 22 3a 3a 66 6f 6f 20 6d 65 73 en m3 "::foo mes
3c60: 73 61 67 65 33 22 0a 7d 0a 6e 61 6d 65 73 70 61 sage3".}.namespa
3c70: 63 65 20 65 76 61 6c 20 3a 3a 66 6f 6f 3a 3a 62 ce eval ::foo::b
3c80: 61 72 20 7b 0a 20 20 20 20 5c 66 42 3a 3a 6d 73 ar {. \fB::ms
3c90: 67 63 61 74 3a 3a 6d 63 73 65 74 5c 66 52 20 65 gcat::mcset\fR e
3ca0: 6e 20 6d 33 20 22 3a 3a 66 6f 6f 3a 3a 62 61 72 n m3 "::foo::bar
3cb0: 20 6d 65 73 73 61 67 65 33 22 0a 7d 0a 6e 61 6d message3".}.nam
3cc0: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 5c 66 espace import \f
3cd0: 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 5c 66 52 B::msgcat::mc\fR
3ce0: 0a 70 75 74 73 20 22 5b 5c 66 42 6d 63 5c 66 52 .puts "[\fBmc\fR
3cf0: 20 6d 31 5d 3b 20 5b 5c 66 42 6d 63 5c 66 52 20 m1]; [\fBmc\fR
3d00: 6d 32 5d 3b 20 5b 5c 66 42 6d 63 5c 66 52 20 6d m2]; [\fBmc\fR m
3d10: 33 5d 22 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 3]".namespace ev
3d20: 61 6c 20 3a 3a 66 6f 6f 20 7b 70 75 74 73 20 22 al ::foo {puts "
3d30: 5b 5c 66 42 6d 63 5c 66 52 20 6d 31 5d 3b 20 5b [\fBmc\fR m1]; [
3d40: 5c 66 42 6d 63 5c 66 52 20 6d 32 5d 3b 20 5b 5c \fBmc\fR m2]; [\
3d50: 66 42 6d 63 5c 66 52 20 6d 33 5d 22 7d 0a 6e 61 fBmc\fR m3]"}.na
3d60: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 66 mespace eval ::f
3d70: 6f 6f 3a 3a 62 61 72 20 7b 70 75 74 73 20 22 5b oo::bar {puts "[
3d80: 5c 66 42 6d 63 5c 66 52 20 6d 31 5d 3b 20 5b 5c \fBmc\fR m1]; [\
3d90: 66 42 6d 63 5c 66 52 20 6d 32 5d 3b 20 5b 5c 66 fBmc\fR m2]; [\f
3da0: 42 6d 63 5c 66 52 20 6d 33 5d 22 7d 0a 2e 43 45 Bmc\fR m3]"}..CE
3db0: 0a 2e 50 50 0a 77 69 6c 6c 20 70 72 69 6e 74 0a ..PP.will print.
3dc0: 2e 50 50 0a 2e 43 53 0a 3a 3a 20 6d 65 73 73 61 .PP..CS.:: messa
3dd0: 67 65 31 3b 20 3a 3a 20 6d 65 73 73 61 67 65 32 ge1; :: message2
3de0: 3b 20 3a 3a 20 6d 65 73 73 61 67 65 33 0a 3a 3a ; :: message3.::
3df0: 20 6d 65 73 73 61 67 65 31 3b 20 3a 3a 66 6f 6f message1; ::foo
3e00: 20 6d 65 73 73 61 67 65 32 3b 20 3a 3a 66 6f 6f message2; ::foo
3e10: 20 6d 65 73 73 61 67 65 33 0a 3a 3a 20 6d 65 73 message3.:: mes
3e20: 73 61 67 65 31 3b 20 3a 3a 66 6f 6f 20 6d 65 73 sage1; ::foo mes
3e30: 73 61 67 65 32 3b 20 3a 3a 66 6f 6f 3a 3a 62 61 sage2; ::foo::ba
3e40: 72 20 6d 65 73 73 61 67 65 33 0a 2e 43 45 0a 2e r message3..CE..
3e50: 53 48 20 22 4c 4f 43 41 54 49 4f 4e 20 41 4e 44 SH "LOCATION AND
3e60: 20 46 4f 52 4d 41 54 20 4f 46 20 4d 45 53 53 41 FORMAT OF MESSA
3e70: 47 45 20 46 49 4c 45 53 22 0a 2e 50 50 0a 4d 65 GE FILES"..PP.Me
3e80: 73 73 61 67 65 20 66 69 6c 65 73 20 63 61 6e 20 ssage files can
3e90: 62 65 20 6c 6f 63 61 74 65 64 20 69 6e 20 61 6e be located in an
3ea0: 79 20 64 69 72 65 63 74 6f 72 79 2c 20 73 75 62 y directory, sub
3eb0: 6a 65 63 74 0a 74 6f 20 74 68 65 20 66 6f 6c 6c ject.to the foll
3ec0: 6f 77 69 6e 67 20 63 6f 6e 64 69 74 69 6f 6e 73 owing conditions
3ed0: 3a 0a 2e 49 50 20 5b 31 5d 0a 41 6c 6c 20 6d 65 :..IP [1].All me
3ee0: 73 73 61 67 65 20 66 69 6c 65 73 20 66 6f 72 20 ssage files for
3ef0: 61 20 70 61 63 6b 61 67 65 20 61 72 65 20 69 6e a package are in
3f00: 20 74 68 65 20 73 61 6d 65 20 64 69 72 65 63 74 the same direct
3f10: 6f 72 79 2e 0a 2e 49 50 20 5b 32 5d 0a 54 68 65 ory...IP [2].The
3f20: 20 6d 65 73 73 61 67 65 20 66 69 6c 65 20 6e 61 message file na
3f30: 6d 65 20 69 73 20 61 20 6d 73 67 63 61 74 20 6c me is a msgcat l
3f40: 6f 63 61 6c 65 20 73 70 65 63 69 66 69 65 72 20 ocale specifier
3f50: 28 61 6c 6c 20 6c 6f 77 65 72 63 61 73 65 29 20 (all lowercase)
3f60: 66 6f 6c 6c 6f 77 65 64 20 62 79 0a 2e 51 57 20 followed by..QW
3f70: 2e 6d 73 67 20 2e 0a 46 6f 72 20 65 78 61 6d 70 .msg ..For examp
3f80: 6c 65 3a 0a 2e 50 50 0a 2e 43 53 0a 65 73 2e 6d le:..PP..CS.es.m
3f90: 73 67 20 20 20 20 5c 28 65 6d 20 73 70 61 6e 69 sg \(em spani
3fa0: 73 68 0a 65 6e 5f 67 62 2e 6d 73 67 20 5c 28 65 sh.en_gb.msg \(e
3fb0: 6d 20 55 6e 69 74 65 64 20 4b 69 6e 67 64 6f 6d m United Kingdom
3fc0: 20 45 6e 67 6c 69 73 68 0a 2e 43 45 0a 2e 50 50 English..CE..PP
3fd0: 0a 5c 66 49 45 78 63 65 70 74 69 6f 6e 3a 5c 66 .\fIException:\f
3fe0: 52 20 54 68 65 20 6d 65 73 73 61 67 65 20 66 69 R The message fi
3ff0: 6c 65 20 66 6f 72 20 74 68 65 20 72 6f 6f 74 20 le for the root
4000: 6c 6f 63 61 6c 65 0a 2e 4d 54 0a 69 73 20 63 61 locale..MT.is ca
4010: 6c 6c 65 64 0a 2e 51 57 20 5c 66 42 52 4f 4f 54 lled..QW \fBROOT
4020: 2e 6d 73 67 5c 66 52 20 2e 0a 54 68 69 73 20 65 .msg\fR ..This e
4030: 78 63 65 70 74 69 6f 6e 20 69 73 20 6d 61 64 65 xception is made
4040: 20 73 6f 20 61 73 20 6e 6f 74 20 74 6f 0a 63 61 so as not to.ca
4050: 75 73 65 20 70 65 63 75 6c 69 61 72 20 62 65 68 use peculiar beh
4060: 61 76 69 6f 72 2c 20 73 75 63 68 20 61 73 20 6d avior, such as m
4070: 61 72 6b 69 6e 67 20 74 68 65 20 6d 65 73 73 61 arking the messa
4080: 67 65 20 66 69 6c 65 20 61 73 0a 2e 51 57 20 68 ge file as..QW h
4090: 69 64 64 65 6e 0a 6f 6e 20 55 6e 69 78 20 66 69 idden.on Unix fi
40a0: 6c 65 20 73 79 73 74 65 6d 73 2e 0a 2e 49 50 20 le systems...IP
40b0: 5b 33 5d 0a 54 68 65 20 66 69 6c 65 20 63 6f 6e [3].The file con
40c0: 74 61 69 6e 73 20 61 20 73 65 72 69 65 73 20 6f tains a series o
40d0: 66 20 63 61 6c 6c 73 20 74 6f 20 5c 66 42 6d 63 f calls to \fBmc
40e0: 66 6c 73 65 74 5c 66 52 20 61 6e 64 0a 5c 66 42 flset\fR and.\fB
40f0: 6d 63 66 6c 6d 73 65 74 5c 66 52 2c 20 73 65 74 mcflmset\fR, set
4100: 74 69 6e 67 20 74 68 65 20 6e 65 63 65 73 73 61 ting the necessa
4110: 72 79 20 74 72 61 6e 73 6c 61 74 69 6f 6e 20 73 ry translation s
4120: 74 72 69 6e 67 73 0a 66 6f 72 20 74 68 65 20 6c trings.for the l
4130: 61 6e 67 75 61 67 65 2c 20 6c 69 6b 65 6c 79 20 anguage, likely
4140: 65 6e 63 6c 6f 73 65 64 20 69 6e 20 61 20 5c 66 enclosed in a \f
4150: 42 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 5c Bnamespace eval\
4160: 66 52 0a 73 6f 20 74 68 61 74 20 61 6c 6c 20 73 fR.so that all s
4170: 6f 75 72 63 65 20 73 74 72 69 6e 67 73 20 61 72 ource strings ar
4180: 65 20 74 69 65 64 20 74 6f 20 74 68 65 20 6e 61 e tied to the na
4190: 6d 65 73 70 61 63 65 20 6f 66 0a 74 68 65 20 70 mespace of.the p
41a0: 61 63 6b 61 67 65 2e 20 46 6f 72 20 65 78 61 6d ackage. For exam
41b0: 70 6c 65 2c 20 61 20 73 68 6f 72 74 20 5c 66 42 ple, a short \fB
41c0: 65 73 2e 6d 73 67 5c 66 52 20 6d 69 67 68 74 20 es.msg\fR might
41d0: 63 6f 6e 74 61 69 6e 3a 0a 2e 50 50 0a 2e 43 53 contain:..PP..CS
41e0: 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 .namespace eval
41f0: 3a 3a 6d 79 70 61 63 6b 61 67 65 20 7b 0a 20 20 ::mypackage {.
4200: 20 20 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d \fB::msgcat::m
4210: 63 66 6c 73 65 74 5c 66 52 20 22 46 72 65 65 20 cflset\fR "Free
4220: 42 65 65 72 22 20 22 43 65 72 76 65 7a 61 20 47 Beer" "Cerveza G
4230: 72 61 74 69 73 22 0a 7d 0a 2e 43 45 0a 2e 53 48 ratis".}..CE..SH
4240: 20 22 52 45 43 4f 4d 4d 45 4e 44 45 44 20 4d 45 "RECOMMENDED ME
4250: 53 53 41 47 45 20 53 45 54 55 50 20 46 4f 52 20 SSAGE SETUP FOR
4260: 50 41 43 4b 41 47 45 53 22 0a 2e 50 50 0a 49 66 PACKAGES"..PP.If
4270: 20 61 20 70 61 63 6b 61 67 65 20 69 73 20 69 6e a package is in
4280: 73 74 61 6c 6c 65 64 20 69 6e 74 6f 20 61 20 73 stalled into a s
4290: 75 62 64 69 72 65 63 74 6f 72 79 20 6f 66 20 74 ubdirectory of t
42a0: 68 65 0a 5c 66 42 74 63 6c 5f 70 6b 67 50 61 74 he.\fBtcl_pkgPat
42b0: 68 5c 66 52 20 61 6e 64 20 6c 6f 61 64 65 64 20 h\fR and loaded
42c0: 76 69 61 20 5c 66 42 70 61 63 6b 61 67 65 20 72 via \fBpackage r
42d0: 65 71 75 69 72 65 5c 66 52 2c 20 74 68 65 0a 66 equire\fR, the.f
42e0: 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 ollowing procedu
42f0: 72 65 20 69 73 20 72 65 63 6f 6d 6d 65 6e 64 65 re is recommende
4300: 64 2e 0a 2e 49 50 20 5b 31 5d 0a 44 75 72 69 6e d...IP [1].Durin
4310: 67 20 70 61 63 6b 61 67 65 20 69 6e 73 74 61 6c g package instal
4320: 6c 61 74 69 6f 6e 2c 20 63 72 65 61 74 65 20 61 lation, create a
4330: 20 73 75 62 64 69 72 65 63 74 6f 72 79 0a 5c 66 subdirectory.\f
4340: 42 6d 73 67 73 5c 66 52 20 75 6e 64 65 72 20 79 Bmsgs\fR under y
4350: 6f 75 72 20 70 61 63 6b 61 67 65 20 64 69 72 65 our package dire
4360: 63 74 6f 72 79 2e 0a 2e 49 50 20 5b 32 5d 0a 43 ctory...IP [2].C
4370: 6f 70 79 20 79 6f 75 72 20 2a 2e 6d 73 67 20 66 opy your *.msg f
4380: 69 6c 65 73 20 69 6e 74 6f 20 74 68 61 74 20 64 iles into that d
4390: 69 72 65 63 74 6f 72 79 2e 0a 2e 49 50 20 5b 33 irectory...IP [3
43a0: 5d 0a 41 64 64 20 74 68 65 20 66 6f 6c 6c 6f 77 ].Add the follow
43b0: 69 6e 67 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 79 ing command to y
43c0: 6f 75 72 20 70 61 63 6b 61 67 65 20 69 6e 69 74 our package init
43d0: 69 61 6c 69 7a 61 74 69 6f 6e 20 73 63 72 69 70 ialization scrip
43e0: 74 3a 0a 2e 50 50 0a 2e 43 53 0a 23 20 6c 6f 61 t:..PP..CS.# loa
43f0: 64 20 6c 61 6e 67 75 61 67 65 20 66 69 6c 65 73 d language files
4400: 2c 20 73 74 6f 72 65 64 20 69 6e 20 6d 73 67 73 , stored in msgs
4410: 20 73 75 62 64 69 72 65 63 74 6f 72 79 0a 5c 66 subdirectory.\f
4420: 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 6c 6f 61 B::msgcat::mcloa
4430: 64 5c 66 52 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 d\fR [file join
4440: 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 5b 69 [file dirname [i
4450: 6e 66 6f 20 73 63 72 69 70 74 5d 5d 20 6d 73 67 nfo script]] msg
4460: 73 5d 0a 2e 43 45 0a 2e 53 48 20 22 50 4f 53 49 s]..CE..SH "POSI
4470: 54 49 4f 4e 41 4c 20 43 4f 44 45 53 20 46 4f 52 TIONAL CODES FOR
4480: 20 46 4f 52 4d 41 54 20 41 4e 44 20 53 43 41 4e FORMAT AND SCAN
4490: 20 43 4f 4d 4d 41 4e 44 53 22 0a 2e 50 50 0a 49 COMMANDS"..PP.I
44a0: 74 20 69 73 20 70 6f 73 73 69 62 6c 65 20 74 68 t is possible th
44b0: 61 74 20 61 20 6d 65 73 73 61 67 65 20 73 74 72 at a message str
44c0: 69 6e 67 20 75 73 65 64 20 61 73 20 61 6e 20 61 ing used as an a
44d0: 72 67 75 6d 65 6e 74 0a 74 6f 20 5c 66 42 66 6f rgument.to \fBfo
44e0: 72 6d 61 74 5c 66 52 20 6d 69 67 68 74 20 68 61 rmat\fR might ha
44f0: 76 65 20 70 6f 73 69 74 69 6f 6e 61 6c 6c 79 20 ve positionally
4500: 64 65 70 65 6e 64 65 6e 74 20 70 61 72 61 6d 65 dependent parame
4510: 74 65 72 73 20 74 68 61 74 0a 6d 69 67 68 74 20 ters that.might
4520: 6e 65 65 64 20 74 6f 20 62 65 20 72 65 70 6f 73 need to be repos
4530: 69 74 69 6f 6e 65 64 2e 20 20 46 6f 72 20 65 78 itioned. For ex
4540: 61 6d 70 6c 65 2c 20 69 74 20 6d 69 67 68 74 20 ample, it might
4550: 62 65 0a 73 79 6e 74 61 63 74 69 63 61 6c 6c 79 be.syntactically
4560: 20 64 65 73 69 72 61 62 6c 65 20 74 6f 20 72 65 desirable to re
4570: 61 72 72 61 6e 67 65 20 74 68 65 20 73 65 6e 74 arrange the sent
4580: 65 6e 63 65 20 73 74 72 75 63 74 75 72 65 0a 77 ence structure.w
4590: 68 69 6c 65 20 74 72 61 6e 73 6c 61 74 69 6e 67 hile translating
45a0: 2e 0a 2e 50 50 0a 2e 43 53 0a 66 6f 72 6d 61 74 ...PP..CS.format
45b0: 20 22 57 65 20 70 72 6f 64 75 63 65 64 20 25 64 "We produced %d
45c0: 20 75 6e 69 74 73 20 69 6e 20 6c 6f 63 61 74 69 units in locati
45d0: 6f 6e 20 25 73 22 20 24 6e 75 6d 20 24 63 69 74 on %s" $num $cit
45e0: 79 0a 66 6f 72 6d 61 74 20 22 49 6e 20 6c 6f 63 y.format "In loc
45f0: 61 74 69 6f 6e 20 25 73 20 77 65 20 70 72 6f 64 ation %s we prod
4600: 75 63 65 64 20 25 64 20 75 6e 69 74 73 22 20 24 uced %d units" $
4610: 63 69 74 79 20 24 6e 75 6d 0a 2e 43 45 0a 2e 50 city $num..CE..P
4620: 50 0a 54 68 69 73 20 63 61 6e 20 62 65 20 68 61 P.This can be ha
4630: 6e 64 6c 65 64 20 62 79 20 75 73 69 6e 67 20 74 ndled by using t
4640: 68 65 20 70 6f 73 69 74 69 6f 6e 61 6c 0a 70 61 he positional.pa
4650: 72 61 6d 65 74 65 72 73 3a 0a 2e 50 50 0a 2e 43 rameters:..PP..C
4660: 53 0a 66 6f 72 6d 61 74 20 22 57 65 20 70 72 6f S.format "We pro
4670: 64 75 63 65 64 20 25 31 5c 65 24 64 20 75 6e 69 duced %1\e$d uni
4680: 74 73 20 69 6e 20 6c 6f 63 61 74 69 6f 6e 20 25 ts in location %
4690: 32 5c 65 24 73 22 20 24 6e 75 6d 20 24 63 69 74 2\e$s" $num $cit
46a0: 79 0a 66 6f 72 6d 61 74 20 22 49 6e 20 6c 6f 63 y.format "In loc
46b0: 61 74 69 6f 6e 20 25 32 5c 65 24 73 20 77 65 20 ation %2\e$s we
46c0: 70 72 6f 64 75 63 65 64 20 25 31 5c 65 24 64 20 produced %1\e$d
46d0: 75 6e 69 74 73 22 20 24 6e 75 6d 20 24 63 69 74 units" $num $cit
46e0: 79 0a 2e 43 45 0a 2e 50 50 0a 53 69 6d 69 6c 61 y..CE..PP.Simila
46f0: 72 6c 79 2c 20 70 6f 73 69 74 69 6f 6e 61 6c 20 rly, positional
4700: 70 61 72 61 6d 65 74 65 72 73 20 63 61 6e 20 62 parameters can b
4710: 65 20 75 73 65 64 20 77 69 74 68 20 5c 66 42 73 e used with \fBs
4720: 63 61 6e 5c 66 52 20 74 6f 0a 65 78 74 72 61 63 can\fR to.extrac
4730: 74 20 76 61 6c 75 65 73 20 66 72 6f 6d 20 69 6e t values from in
4740: 74 65 72 6e 61 74 69 6f 6e 61 6c 69 7a 65 64 20 ternationalized
4750: 73 74 72 69 6e 67 73 2e 20 4e 6f 74 65 20 74 68 strings. Note th
4760: 61 74 20 69 74 20 69 73 20 6e 6f 74 0a 6e 65 63 at it is not.nec
4770: 65 73 73 61 72 79 20 74 6f 20 70 61 73 73 20 74 essary to pass t
4780: 68 65 20 6f 75 74 70 75 74 20 6f 66 20 5c 66 42 he output of \fB
4790: 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 5c 66 52 20 ::msgcat::mc\fR
47a0: 74 6f 20 5c 66 42 66 6f 72 6d 61 74 5c 66 52 0a to \fBformat\fR.
47b0: 64 69 72 65 63 74 6c 79 3b 20 62 79 20 70 61 73 directly; by pas
47c0: 73 69 6e 67 20 74 68 65 20 76 61 6c 75 65 73 20 sing the values
47d0: 74 6f 20 73 75 62 73 74 69 74 75 74 65 20 69 6e to substitute in
47e0: 20 61 73 20 61 72 67 75 6d 65 6e 74 73 2c 20 74 as arguments, t
47f0: 68 65 0a 66 6f 72 6d 61 74 74 69 6e 67 20 73 75 he.formatting su
4800: 62 73 74 69 74 75 74 69 6f 6e 20 69 73 20 64 6f bstitution is do
4810: 6e 65 20 64 69 72 65 63 74 6c 79 2e 0a 2e 50 50 ne directly...PP
4820: 0a 2e 43 53 0a 5c 66 42 6d 73 67 63 61 74 3a 3a ..CS.\fBmsgcat::
4830: 6d 63 5c 66 52 20 7b 50 72 6f 64 75 63 65 64 20 mc\fR {Produced
4840: 25 31 24 64 20 61 74 20 25 32 24 73 7d 20 24 6e %1$d at %2$s} $n
4850: 75 6d 20 24 63 69 74 79 0a 23 20 2e 2e 2e 20 77 um $city.# ... w
4860: 68 65 72 65 20 74 68 61 74 20 6b 65 79 20 69 73 here that key is
4870: 20 6d 61 70 70 65 64 20 74 6f 20 6f 6e 65 20 6f mapped to one o
4880: 66 20 74 68 65 0a 23 20 68 75 6d 61 6e 2d 6f 72 f the.# human-or
4890: 69 65 6e 74 65 64 20 76 65 72 73 69 6f 6e 73 20 iented versions
48a0: 62 79 20 5c 66 42 6d 73 67 63 61 74 3a 3a 6d 63 by \fBmsgcat::mc
48b0: 73 65 74 5c 66 52 0a 2e 43 45 0a 2e 56 53 20 22 set\fR..CE..VS "
48c0: 54 49 50 20 34 31 32 22 0a 2e 53 48 20 22 50 41 TIP 412"..SH "PA
48d0: 43 4b 41 47 45 20 50 52 49 56 41 54 45 20 4c 4f CKAGE PRIVATE LO
48e0: 43 41 4c 45 22 0a 2e 50 50 0a 41 20 70 61 63 6b CALE"..PP.A pack
48f0: 61 67 65 20 75 73 69 6e 67 20 5c 66 42 6d 73 67 age using \fBmsg
4900: 63 61 74 5c 66 52 20 6d 61 79 20 63 68 6f 6f 73 cat\fR may choos
4910: 65 20 74 6f 20 75 73 65 20 69 74 73 20 6f 77 6e e to use its own
4920: 20 70 61 63 6b 61 67 65 20 70 72 69 76 61 74 65 package private
4930: 0a 6c 6f 63 61 6c 65 20 61 6e 64 20 69 74 73 20 .locale and its
4940: 6f 77 6e 20 73 65 74 20 6f 66 20 6c 6f 61 64 65 own set of loade
4950: 64 20 6c 6f 63 61 6c 65 73 2c 20 69 6e 64 65 70 d locales, indep
4960: 65 6e 64 65 6e 74 20 74 6f 20 74 68 65 20 67 6c endent to the gl
4970: 6f 62 61 6c 0a 6c 6f 63 61 6c 65 20 73 65 74 20 obal.locale set
4980: 62 79 20 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a by \fB::msgcat::
4990: 6d 63 6c 6f 63 61 6c 65 5c 66 52 2e 0a 2e 50 50 mclocale\fR...PP
49a0: 0a 54 68 69 73 20 61 6c 6c 6f 77 73 20 61 20 70 .This allows a p
49b0: 61 63 6b 61 67 65 20 74 6f 20 63 68 61 6e 67 65 ackage to change
49c0: 20 69 74 73 20 6c 6f 63 61 6c 65 20 77 69 74 68 its locale with
49d0: 6f 75 74 20 63 61 75 73 69 6e 67 20 61 6e 79 20 out causing any
49e0: 6c 6f 63 61 6c 65 73 20 6c 6f 61 64 20 6f 72 20 locales load or
49f0: 72 65 6d 6f 76 61 6c 20 69 6e 20 6f 74 68 65 72 removal in other
4a00: 20 70 61 63 6b 61 67 65 73 20 61 6e 64 20 6e 6f packages and no
4a10: 74 20 74 6f 20 69 6e 76 6f 6b 65 20 74 68 65 20 t to invoke the
4a20: 67 6c 6f 62 61 6c 20 6c 6f 63 61 6c 65 20 63 68 global locale ch
4a30: 61 6e 67 65 20 63 61 6c 6c 62 61 63 6b 20 28 73 ange callback (s
4a40: 65 65 20 62 65 6c 6f 77 29 2e 0a 2e 50 50 0a 54 ee below)...PP.T
4a50: 68 69 73 20 61 63 74 69 6f 6e 20 69 73 20 63 6f his action is co
4a60: 6e 74 72 6f 6c 65 64 20 62 79 20 74 68 65 20 66 ntroled by the f
4a70: 6f 6c 6c 6f 77 69 6e 67 20 65 6e 73 65 6d 62 6c ollowing ensembl
4a80: 65 3a 0a 2e 54 50 0a 5c 66 42 3a 3a 6d 73 67 63 e:..TP.\fB::msgc
4a90: 61 74 3a 3a 6d 63 70 61 63 6b 61 67 65 6c 6f 63 at::mcpackageloc
4aa0: 61 6c 65 20 73 65 74 5c 66 52 20 3f 5c 66 49 6c ale set\fR ?\fIl
4ab0: 6f 63 61 6c 65 5c 66 52 3f 0a 2e 0a 53 65 74 20 ocale\fR?...Set
4ac0: 6f 72 20 63 68 61 6e 67 65 20 61 20 70 61 63 6b or change a pack
4ad0: 61 67 65 20 70 72 69 76 61 74 65 20 6c 6f 63 61 age private loca
4ae0: 6c 65 2e 0a 54 68 65 20 70 61 63 6b 61 67 65 20 le..The package
4af0: 70 72 69 76 61 74 65 20 6c 6f 63 61 6c 65 20 69 private locale i
4b00: 73 20 73 65 74 20 74 6f 20 74 68 65 20 67 69 76 s set to the giv
4b10: 65 6e 20 5c 66 49 6c 6f 63 61 6c 65 5c 66 52 20 en \fIlocale\fR
4b20: 69 66 20 74 68 65 20 5c 66 49 6c 6f 63 61 6c 65 if the \fIlocale
4b30: 5c 66 52 20 69 73 20 67 69 76 65 6e 2e 0a 49 66 \fR is given..If
4b40: 20 74 68 65 20 6f 70 74 69 6f 6e 20 5c 66 49 6c the option \fIl
4b50: 6f 63 61 6c 65 5c 66 52 20 69 73 20 6e 6f 74 20 ocale\fR is not
4b60: 67 69 76 65 6e 2c 20 74 68 65 20 70 61 63 6b 61 given, the packa
4b70: 67 65 20 69 73 20 73 65 74 20 74 6f 20 70 61 63 ge is set to pac
4b80: 6b 61 67 65 20 70 72 69 76 61 74 65 20 6c 6f 63 kage private loc
4b90: 61 6c 65 20 6d 6f 64 65 2c 20 62 75 74 20 6e 6f ale mode, but no
4ba0: 20 6c 6f 63 61 6c 65 20 69 73 20 63 68 61 6e 67 locale is chang
4bb0: 65 64 20 28 65 2e 67 2e 20 69 66 20 74 68 65 20 ed (e.g. if the
4bc0: 67 6c 6f 62 61 6c 20 6c 6f 63 61 6c 65 20 77 61 global locale wa
4bd0: 73 20 76 61 6c 69 64 20 66 6f 72 20 74 68 65 20 s valid for the
4be0: 70 61 63 6b 61 67 65 20 62 65 66 6f 72 65 2c 20 package before,
4bf0: 69 74 20 69 73 20 63 6f 70 69 65 64 20 74 6f 20 it is copied to
4c00: 74 68 65 20 70 61 63 6b 61 67 65 20 70 72 69 76 the package priv
4c10: 61 74 65 20 6c 6f 63 61 6c 65 29 2e 0a 2e 50 50 ate locale)...PP
4c20: 0a 2e 52 53 0a 54 68 69 73 20 63 6f 6d 6d 61 6e ..RS.This comman
4c30: 64 20 6d 61 79 20 63 61 75 73 65 20 74 68 65 20 d may cause the
4c40: 6c 6f 61 64 20 6f 66 20 6c 6f 63 61 6c 65 73 2e load of locales.
4c50: 0a 2e 52 45 0a 2e 54 50 0a 5c 66 42 3a 3a 6d 73 ..RE..TP.\fB::ms
4c60: 67 63 61 74 3a 3a 6d 63 70 61 63 6b 61 67 65 6c gcat::mcpackagel
4c70: 6f 63 61 6c 65 20 67 65 74 5c 66 52 0a 2e 0a 52 ocale get\fR...R
4c80: 65 74 75 72 6e 20 74 68 65 20 70 61 63 6b 61 67 eturn the packag
4c90: 65 20 70 72 69 76 61 74 65 20 6c 6f 63 61 6c 65 e private locale
4ca0: 20 6f 72 20 74 68 65 20 67 6c 6f 62 61 6c 20 6c or the global l
4cb0: 6f 63 61 6c 65 2c 20 69 66 20 6e 6f 20 70 61 63 ocale, if no pac
4cc0: 6b 61 67 65 20 70 72 69 76 61 74 65 20 6c 6f 63 kage private loc
4cd0: 61 6c 65 20 69 73 20 73 65 74 2e 0a 2e 54 50 0a ale is set...TP.
4ce0: 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 70 \fB::msgcat::mcp
4cf0: 61 63 6b 61 67 65 6c 6f 63 61 6c 65 20 70 72 65 ackagelocale pre
4d00: 66 65 72 65 6e 63 65 73 5c 66 52 20 3f 5c 66 49 ferences\fR ?\fI
4d10: 6c 6f 63 61 6c 65 20 70 72 65 66 65 72 65 6e 63 locale preferenc
4d20: 65 5c 66 52 3f 20 2e 2e 2e 0a 2e 0a 57 69 74 68 e\fR? ......With
4d30: 20 6e 6f 20 70 61 72 61 6d 65 74 65 72 73 2c 20 no parameters,
4d40: 72 65 74 75 72 6e 20 74 68 65 20 70 61 63 6b 61 return the packa
4d50: 67 65 20 70 72 69 76 61 74 65 20 70 72 65 66 65 ge private prefe
4d60: 72 65 6e 63 65 73 20 6f 72 20 74 68 65 20 67 6c rences or the gl
4d70: 6f 62 61 6c 20 70 72 65 66 65 72 65 6e 63 65 73 obal preferences
4d80: 2c 0a 69 66 20 6e 6f 20 70 61 63 6b 61 67 65 20 ,.if no package
4d90: 70 72 69 76 61 74 65 20 6c 6f 63 61 6c 65 20 69 private locale i
4da0: 73 20 73 65 74 2e 0a 54 68 65 20 70 61 63 6b 61 s set..The packa
4db0: 67 65 20 6c 6f 63 61 6c 65 20 73 74 61 74 65 20 ge locale state
4dc0: 28 73 65 74 20 6f 72 20 6e 6f 74 29 20 69 73 20 (set or not) is
4dd0: 6e 6f 74 20 63 68 61 6e 67 65 64 20 28 69 6e 20 not changed (in
4de0: 63 6f 6e 74 72 61 73 74 20 74 6f 20 74 68 65 20 contrast to the
4df0: 63 6f 6d 6d 61 6e 64 20 5c 66 42 3a 3a 6d 73 67 command \fB::msg
4e00: 63 61 74 3a 3a 6d 63 70 61 63 6b 61 67 65 6c 6f cat::mcpackagelo
4e10: 63 61 6c 65 20 73 65 74 5c 66 52 29 2e 0a 2e 50 cale set\fR)...P
4e20: 50 0a 2e 52 53 0a 2e 56 53 20 22 54 49 50 20 34 P..RS..VS "TIP 4
4e30: 39 39 22 0a 49 66 20 61 20 73 65 74 20 6f 66 20 99".If a set of
4e40: 6c 6f 63 61 6c 65 20 70 72 65 66 65 72 65 6e 63 locale preferenc
4e50: 65 73 20 69 73 20 67 69 76 65 6e 2c 20 69 74 20 es is given, it
4e60: 69 73 20 73 65 74 20 61 73 20 70 61 63 6b 61 67 is set as packag
4e70: 65 20 6c 6f 63 61 6c 65 20 70 72 65 66 65 72 65 e locale prefere
4e80: 6e 63 65 20 6c 69 73 74 2e 0a 54 68 65 20 70 61 nce list..The pa
4e90: 63 6b 61 67 65 20 6c 6f 63 61 6c 65 20 69 73 20 ckage locale is
4ea0: 73 65 74 20 74 6f 20 74 68 65 20 66 69 72 73 74 set to the first
4eb0: 20 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 element of the
4ec0: 70 72 65 66 65 72 65 6e 63 65 20 6c 69 73 74 2e preference list.
4ed0: 0a 41 20 70 61 63 6b 61 67 65 20 6c 6f 63 61 6c .A package local
4ee0: 65 20 69 73 20 61 63 74 69 76 61 74 65 64 2c 20 e is activated,
4ef0: 69 66 20 69 74 20 77 61 73 20 6e 6f 74 20 73 65 if it was not se
4f00: 74 20 73 6f 20 66 61 72 2e 0a 2e 50 50 0a 4c 6f t so far...PP.Lo
4f10: 63 61 6c 65 20 70 72 65 66 65 72 65 6e 63 65 73 cale preferences
4f20: 20 61 72 65 20 6c 6f 61 64 65 64 20 6e 6f 77 20 are loaded now
4f30: 66 6f 72 20 74 68 65 20 70 61 63 6b 61 67 65 2c for the package,
4f40: 20 69 66 20 6e 6f 74 20 6a 65 74 20 6c 6f 61 64 if not jet load
4f50: 65 64 2e 0a 2e 56 45 20 22 54 49 50 20 34 39 39 ed...VE "TIP 499
4f60: 22 0a 2e 52 45 0a 2e 50 50 0a 2e 54 50 0a 5c 66 "..RE..PP..TP.\f
4f70: 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 70 61 63 B::msgcat::mcpac
4f80: 6b 61 67 65 6c 6f 63 61 6c 65 20 6c 6f 61 64 65 kagelocale loade
4f90: 64 5c 66 52 0a 2e 0a 52 65 74 75 72 6e 20 74 68 d\fR...Return th
4fa0: 65 20 6c 69 73 74 20 6f 66 20 6c 6f 63 61 6c 65 e list of locale
4fb0: 73 20 6c 6f 61 64 65 64 20 66 6f 72 20 74 68 69 s loaded for thi
4fc0: 73 20 70 61 63 6b 61 67 65 2e 0a 2e 54 50 0a 5c s package...TP.\
4fd0: 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 70 61 fB::msgcat::mcpa
4fe0: 63 6b 61 67 65 6c 6f 63 61 6c 65 20 69 73 73 65 ckagelocale isse
4ff0: 74 5c 66 52 0a 2e 0a 52 65 74 75 72 6e 73 20 74 t\fR...Returns t
5000: 72 75 65 2c 20 69 66 20 61 20 70 61 63 6b 61 67 rue, if a packag
5010: 65 20 70 72 69 76 61 74 65 20 6c 6f 63 61 6c 65 e private locale
5020: 20 69 73 20 73 65 74 2e 0a 2e 54 50 0a 5c 66 42 is set...TP.\fB
5030: 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 70 61 63 6b ::msgcat::mcpack
5040: 61 67 65 6c 6f 63 61 6c 65 20 75 6e 73 65 74 5c agelocale unset\
5050: 66 52 0a 2e 0a 55 6e 73 65 74 20 74 68 65 20 70 fR...Unset the p
5060: 61 63 6b 61 67 65 20 70 72 69 76 61 74 65 20 6c ackage private l
5070: 6f 63 61 6c 65 20 61 6e 64 20 75 73 65 20 74 68 ocale and use th
5080: 65 20 67 6c 6f 62 61 6c 65 20 6c 6f 63 61 6c 65 e globale locale
5090: 2e 0a 4c 6f 61 64 20 61 6e 64 20 72 65 6d 6f 76 ..Load and remov
50a0: 65 20 6c 6f 63 61 6c 65 73 20 74 6f 20 61 64 6a e locales to adj
50b0: 75 73 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20 ust the list of
50c0: 6c 6f 61 64 65 64 20 6c 6f 63 61 6c 65 73 20 66 loaded locales f
50d0: 6f 72 20 74 68 65 0a 70 61 63 6b 61 67 65 20 74 or the.package t
50e0: 6f 20 74 68 65 20 67 6c 6f 62 61 6c 20 6c 6f 61 o the global loa
50f0: 64 65 64 20 6c 6f 63 61 6c 65 73 20 6c 69 73 74 ded locales list
5100: 2e 0a 2e 54 50 0a 5c 66 42 3a 3a 6d 73 67 63 61 ...TP.\fB::msgca
5110: 74 3a 3a 6d 63 70 61 63 6b 61 67 65 6c 6f 63 61 t::mcpackageloca
5120: 6c 65 20 70 72 65 73 65 6e 74 5c 66 52 20 5c 66 le present\fR \f
5130: 49 6c 6f 63 61 6c 65 5c 66 52 0a 2e 0a 52 65 74 Ilocale\fR...Ret
5140: 75 72 6e 73 20 74 72 75 65 2c 20 69 66 20 74 68 urns true, if th
5150: 65 20 67 69 76 65 6e 20 6c 6f 63 61 6c 65 20 69 e given locale i
5160: 73 20 6c 6f 61 64 65 64 20 66 6f 72 20 74 68 65 s loaded for the
5170: 20 70 61 63 6b 61 67 65 2e 0a 2e 54 50 0a 5c 66 package...TP.\f
5180: 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 70 61 63 B::msgcat::mcpac
5190: 6b 61 67 65 6c 6f 63 61 6c 65 20 63 6c 65 61 72 kagelocale clear
51a0: 5c 66 52 0a 2e 0a 43 6c 65 61 72 20 61 6e 79 20 \fR...Clear any
51b0: 6c 6f 61 64 65 64 20 6c 6f 63 61 6c 65 73 20 6f loaded locales o
51c0: 66 20 74 68 65 20 70 61 63 6b 61 67 65 20 6e 6f f the package no
51d0: 74 20 70 72 65 73 65 6e 74 20 69 6e 20 74 68 65 t present in the
51e0: 20 70 61 63 6b 61 67 65 20 70 72 65 66 65 72 65 package prefere
51f0: 6e 63 65 73 2e 0a 2e 50 50 0a 2e 53 48 20 22 43 nces...PP..SH "C
5200: 48 41 4e 47 49 4e 47 20 50 41 43 4b 41 47 45 20 HANGING PACKAGE
5210: 4f 50 54 49 4f 4e 53 22 0a 2e 50 50 0a 45 61 63 OPTIONS"..PP.Eac
5220: 68 20 70 61 63 6b 61 67 65 20 75 73 69 6e 67 20 h package using
5230: 6d 73 67 63 61 74 20 68 61 73 20 61 20 73 65 74 msgcat has a set
5240: 20 6f 66 20 6f 70 74 69 6f 6e 73 20 77 69 74 68 of options with
5250: 69 6e 20 5c 66 42 6d 73 67 63 61 74 5c 66 52 2e in \fBmsgcat\fR.
5260: 0a 54 68 65 20 70 61 63 6b 61 67 65 20 6f 70 74 .The package opt
5270: 69 6f 6e 73 20 61 72 65 20 64 65 73 63 72 69 62 ions are describ
5280: 65 64 20 69 6e 20 74 68 65 20 6e 65 78 74 20 73 ed in the next s
5290: 65 63 74 69 6f 6e 50 61 63 6b 61 67 65 20 6f 70 ectionPackage op
52a0: 74 69 6f 6e 73 2e 0a 45 61 63 68 20 70 61 63 6b tions..Each pack
52b0: 61 67 65 20 6f 70 74 69 6f 6e 20 6d 61 79 20 62 age option may b
52c0: 65 20 73 65 74 20 6f 72 20 75 6e 73 65 74 20 69 e set or unset i
52d0: 6e 64 69 76 69 64 75 61 6c 6c 79 20 75 73 69 6e ndividually usin
52e0: 67 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 g the following
52f0: 65 6e 73 65 6d 62 6c 65 3a 0a 2e 54 50 0a 5c 66 ensemble:..TP.\f
5300: 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 70 61 63 B::msgcat::mcpac
5310: 6b 61 67 65 63 6f 6e 66 69 67 20 67 65 74 5c 66 kageconfig get\f
5320: 52 20 5c 66 49 6f 70 74 69 6f 6e 5c 66 52 0a 2e R \fIoption\fR..
5330: 0a 52 65 74 75 72 6e 20 74 68 65 20 63 75 72 72 .Return the curr
5340: 65 6e 74 20 76 61 6c 75 65 20 6f 66 20 74 68 65 ent value of the
5350: 20 67 69 76 65 6e 20 5c 66 49 6f 70 74 69 6f 6e given \fIoption
5360: 5c 66 52 2e 0a 54 68 69 73 20 63 61 6c 6c 20 72 \fR..This call r
5370: 65 74 75 72 6e 73 20 61 6e 20 65 72 72 6f 72 20 eturns an error
5380: 69 66 20 74 68 65 20 6f 70 74 69 6f 6e 20 69 73 if the option is
5390: 20 6e 6f 74 20 73 65 74 20 66 6f 72 20 74 68 65 not set for the
53a0: 20 70 61 63 6b 61 67 65 2e 0a 2e 54 50 0a 5c 66 package...TP.\f
53b0: 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 70 61 63 B::msgcat::mcpac
53c0: 6b 61 67 65 63 6f 6e 66 69 67 20 69 73 73 65 74 kageconfig isset
53d0: 5c 66 52 20 5c 66 49 6f 70 74 69 6f 6e 5c 66 52 \fR \fIoption\fR
53e0: 0a 2e 0a 52 65 74 75 72 6e 73 20 31 2c 20 69 66 ...Returns 1, if
53f0: 20 74 68 65 20 67 69 76 65 6e 20 5c 66 49 6f 70 the given \fIop
5400: 74 69 6f 6e 5c 66 52 20 69 73 20 73 65 74 20 66 tion\fR is set f
5410: 6f 72 20 74 68 65 20 70 61 63 6b 61 67 65 2c 20 or the package,
5420: 30 20 6f 74 68 65 72 77 69 73 65 2e 0a 2e 54 50 0 otherwise...TP
5430: 0a 5c 66 42 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 .\fB::msgcat::mc
5440: 70 61 63 6b 61 67 65 63 6f 6e 66 69 67 20 73 65 packageconfig se
5450: 74 5c 66 52 20 5c 66 49 6f 70 74 69 6f 6e 5c 66 t\fR \fIoption\f
5460: 52 20 5c 66 49 76 61 6c 75 65 5c 66 52 0a 2e 0a R \fIvalue\fR...
5470: 53 65 74 20 74 68 65 20 67 69 76 65 6e 20 5c 66 Set the given \f
5480: 49 6f 70 74 69 6f 6e 5c 66 52 20 74 6f 20 74 68 Ioption\fR to th
5490: 65 20 67 69 76 65 6e 20 5c 66 49 76 61 6c 75 65 e given \fIvalue
54a0: 5c 66 52 2e 0a 54 68 69 73 20 6d 61 79 20 69 6e \fR..This may in
54b0: 76 6f 6b 65 20 61 64 64 69 74 69 6f 6e 61 6c 20 voke additional
54c0: 61 63 74 69 6f 6e 73 20 69 6e 20 64 65 70 65 6e actions in depen
54d0: 64 65 6e 63 79 20 6f 66 20 74 68 65 20 5c 66 49 dency of the \fI
54e0: 6f 70 74 69 6f 6e 5c 66 52 2e 0a 54 68 65 20 72 option\fR..The r
54f0: 65 74 75 72 6e 20 76 61 6c 75 65 20 69 73 20 30 eturn value is 0
5500: 20 6f 72 20 74 68 65 20 6e 75 6d 62 65 72 20 6f or the number o
5510: 66 20 6c 6f 61 64 65 64 20 70 61 63 6b 61 67 65 f loaded package
5520: 73 20 66 6f 72 20 74 68 65 20 6f 70 74 69 6f 6e s for the option
5530: 20 5c 66 42 6d 63 66 6f 6c 64 65 72 5c 66 52 2e \fBmcfolder\fR.
5540: 0a 2e 54 50 0a 5c 66 42 3a 3a 6d 73 67 63 61 74 ..TP.\fB::msgcat
5550: 3a 3a 6d 63 70 61 63 6b 61 67 65 63 6f 6e 66 69 ::mcpackageconfi
5560: 67 20 75 6e 73 65 74 5c 66 52 20 5c 66 49 6f 70 g unset\fR \fIop
5570: 74 69 6f 6e 5c 66 52 0a 2e 0a 55 6e 73 65 74 73 tion\fR...Unsets
5580: 20 74 68 65 20 67 69 76 65 6e 20 5c 66 49 6f 70 the given \fIop
5590: 74 69 6f 6e 5c 66 52 20 66 6f 72 20 74 68 65 20 tion\fR for the
55a0: 70 61 63 6b 61 67 65 2e 0a 4e 6f 20 61 63 74 69 package..No acti
55b0: 6f 6e 20 69 73 20 74 61 6b 65 6e 20 69 66 20 74 on is taken if t
55c0: 68 65 20 5c 66 49 6f 70 74 69 6f 6e 5c 66 52 20 he \fIoption\fR
55d0: 69 73 20 6e 6f 74 20 73 65 74 20 66 6f 72 20 74 is not set for t
55e0: 68 65 20 70 61 63 6b 61 67 65 2e 0a 54 68 65 20 he package..The
55f0: 65 6d 70 74 79 20 73 74 72 69 6e 67 20 69 73 20 empty string is
5600: 72 65 74 75 72 6e 65 64 2e 0a 2e 53 53 20 50 61 returned...SS Pa
5610: 63 6b 61 67 65 20 6f 70 74 69 6f 6e 73 0a 2e 50 ckage options..P
5620: 50 0a 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 P.The following
5630: 70 61 63 6b 61 67 65 20 6f 70 74 69 6f 6e 73 20 package options
5640: 61 72 65 20 61 76 61 69 6c 61 62 6c 65 20 66 6f are available fo
5650: 72 20 65 61 63 68 20 70 61 63 6b 61 67 65 3a 0a r each package:.
5660: 2e 54 50 0a 5c 66 42 6d 63 66 6f 6c 64 65 72 5c .TP.\fBmcfolder\
5670: 66 52 0a 2e 0a 54 68 69 73 20 69 73 20 74 68 65 fR...This is the
5680: 20 6d 65 73 73 61 67 65 20 66 6f 6c 64 65 72 20 message folder
5690: 6f 66 20 74 68 65 20 70 61 63 6b 61 67 65 2e 20 of the package.
56a0: 54 68 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 73 This option is s
56b0: 65 74 20 62 79 20 6d 63 6c 6f 61 64 20 61 6e 64 et by mcload and
56c0: 20 62 79 20 74 68 65 20 73 75 62 63 6f 6d 6d 61 by the subcomma
56d0: 6e 64 20 73 65 74 2e 20 42 6f 74 68 20 61 72 65 nd set. Both are
56e0: 20 69 64 65 6e 74 69 63 61 6c 20 61 6e 64 20 62 identical and b
56f0: 6f 74 68 20 72 65 74 75 72 6e 20 74 68 65 20 6e oth return the n
5700: 75 6d 62 65 72 20 6f 66 20 6c 6f 61 64 65 64 20 umber of loaded
5710: 6d 65 73 73 61 67 65 20 63 61 74 61 6c 6f 67 20 message catalog
5720: 66 69 6c 65 73 2e 0a 2e 52 53 0a 2e 50 50 0a 53 files...RS..PP.S
5730: 65 74 74 69 6e 67 20 6f 72 20 63 68 61 6e 67 69 etting or changi
5740: 6e 67 20 74 68 69 73 20 76 61 6c 75 65 20 77 69 ng this value wi
5750: 6c 6c 20 6c 6f 61 64 20 61 6c 6c 20 6c 6f 63 61 ll load all loca
5760: 6c 65 73 20 63 6f 6e 74 61 69 6e 65 64 20 69 6e les contained in
5770: 20 74 68 65 20 70 72 65 66 65 72 65 6e 63 65 73 the preferences
5780: 20 76 61 6c 69 64 20 66 6f 72 20 74 68 65 20 70 valid for the p
5790: 61 63 6b 61 67 65 2e 20 54 68 69 73 20 69 6d 70 ackage. This imp
57a0: 6c 69 65 73 20 61 6c 73 6f 20 74 6f 20 69 6e 76 lies also to inv
57b0: 6f 6b 65 20 61 6e 79 20 73 65 74 20 6c 6f 61 64 oke any set load
57c0: 63 6d 64 20 28 73 65 65 20 62 65 6c 6f 77 29 2e cmd (see below).
57d0: 0a 2e 50 50 0a 55 6e 73 65 74 74 69 6e 67 20 74 ..PP.Unsetting t
57e0: 68 69 73 20 76 61 6c 75 65 20 77 69 6c 6c 20 64 his value will d
57f0: 69 73 61 62 6c 65 20 6d 65 73 73 61 67 65 20 66 isable message f
5800: 69 6c 65 20 6c 6f 61 64 20 66 6f 72 20 74 68 65 ile load for the
5810: 20 70 61 63 6b 61 67 65 2e 0a 2e 52 45 0a 2e 54 package...RE..T
5820: 50 0a 5c 66 42 6c 6f 61 64 63 6d 64 5c 66 52 0a P.\fBloadcmd\fR.
5830: 2e 0a 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 ..This callback
5840: 69 73 20 69 6e 76 6f 6b 65 64 20 62 65 66 6f 72 is invoked befor
5850: 65 20 61 20 73 65 74 20 6f 66 20 6d 65 73 73 61 e a set of messa
5860: 67 65 20 63 61 74 61 6c 6f 67 20 66 69 6c 65 73 ge catalog files
5870: 20 61 72 65 20 6c 6f 61 64 65 64 20 66 6f 72 20 are loaded for
5880: 74 68 65 20 70 61 63 6b 61 67 65 20 77 68 69 63 the package whic
5890: 68 20 68 61 73 20 74 68 69 73 20 70 72 6f 70 65 h has this prope
58a0: 72 74 79 20 73 65 74 2e 0a 2e 50 50 0a 2e 52 53 rty set...PP..RS
58b0: 0a 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 6d .This callback m
58c0: 61 79 20 62 65 20 75 73 65 64 20 74 6f 20 64 6f ay be used to do
58d0: 20 61 6e 79 20 70 72 65 70 61 72 61 74 69 6f 6e any preparation
58e0: 20 77 6f 72 6b 20 66 6f 72 20 6d 65 73 73 61 67 work for messag
58f0: 65 20 66 69 6c 65 20 6c 6f 61 64 20 6f 72 20 74 e file load or t
5900: 6f 20 67 65 74 20 74 68 65 20 6d 65 73 73 61 67 o get the messag
5910: 65 20 64 61 74 61 20 66 72 6f 6d 20 61 6e 6f 74 e data from anot
5920: 68 65 72 20 73 6f 75 72 63 65 20 6c 69 6b 65 20 her source like
5930: 61 20 64 61 74 61 20 62 61 73 65 2e 20 49 6e 20 a data base. In
5940: 74 68 69 73 20 63 61 73 65 2c 20 6e 6f 20 6d 65 this case, no me
5950: 73 73 61 67 65 20 66 69 6c 65 73 20 61 72 65 20 ssage files are
5960: 75 73 65 64 20 28 6d 63 66 6f 6c 64 65 72 20 69 used (mcfolder i
5970: 73 20 75 6e 73 65 74 29 2e 0a 2e 50 50 0a 53 65 s unset)...PP.Se
5980: 65 20 73 65 63 74 69 6f 6e 20 5c 66 42 63 61 6c e section \fBcal
5990: 6c 62 61 63 6b 20 69 6e 76 6f 63 61 74 69 6f 6e lback invocation
59a0: 5c 66 52 20 62 65 6c 6f 77 2e 0a 54 68 65 20 70 \fR below..The p
59b0: 61 72 61 6d 65 74 65 72 20 6c 69 73 74 20 61 70 arameter list ap
59c0: 70 65 6e 64 65 64 20 74 6f 20 74 68 69 73 20 63 pended to this c
59d0: 61 6c 6c 62 61 63 6b 20 69 73 20 74 68 65 20 6c allback is the l
59e0: 69 73 74 20 6f 66 20 6c 6f 63 61 6c 65 73 20 74 ist of locales t
59f0: 6f 20 6c 6f 61 64 2e 0a 2e 50 50 0a 49 66 20 74 o load...PP.If t
5a00: 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 his callback is
5a10: 63 68 61 6e 67 65 64 2c 20 69 74 20 69 73 20 63 changed, it is c
5a20: 61 6c 6c 65 64 20 77 69 74 68 20 74 68 65 20 70 alled with the p
5a30: 72 65 66 65 72 65 6e 63 65 73 20 76 61 6c 69 64 references valid
5a40: 20 66 6f 72 20 74 68 65 20 70 61 63 6b 61 67 65 for the package
5a50: 2e 0a 2e 52 45 0a 2e 54 50 0a 5c 66 42 63 68 61 ...RE..TP.\fBcha
5a60: 6e 67 65 63 6d 64 5c 66 52 0a 2e 0a 54 68 69 73 ngecmd\fR...This
5a70: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 callback is inv
5a80: 6f 6b 65 64 20 77 68 65 6e 20 61 20 64 65 66 61 oked when a defa
5a90: 75 6c 74 20 6c 6f 63 61 6c 20 63 68 61 6e 67 65 ult local change
5aa0: 20 77 61 73 20 70 65 72 66 6f 72 6d 65 64 2e 20 was performed.
5ab0: 49 74 73 20 70 75 72 70 6f 73 65 20 69 73 20 74 Its purpose is t
5ac0: 6f 20 61 6c 6c 6f 77 20 61 20 70 61 63 6b 61 67 o allow a packag
5ad0: 65 20 74 6f 20 75 70 64 61 74 65 20 61 6e 79 20 e to update any
5ae0: 64 65 70 65 6e 64 65 6e 63 79 20 6f 6e 20 74 68 dependency on th
5af0: 65 20 64 65 66 61 75 6c 74 20 6c 6f 63 61 6c 65 e default locale
5b00: 20 6c 69 6b 65 20 73 68 6f 77 69 6e 67 20 74 68 like showing th
5b10: 65 20 47 55 49 20 69 6e 20 61 6e 6f 74 68 65 72 e GUI in another
5b20: 20 6c 61 6e 67 75 61 67 65 2e 0a 2e 50 50 0a 2e language...PP..
5b30: 52 53 0a 53 65 65 20 74 68 65 20 63 61 6c 6c 62 RS.See the callb
5b40: 61 63 6b 20 69 6e 76 6f 63 61 74 69 6f 6e 20 73 ack invocation s
5b50: 65 63 74 69 6f 6e 20 62 65 6c 6f 77 2e 0a 54 68 ection below..Th
5b60: 65 20 70 61 72 61 6d 65 74 65 72 20 6c 69 73 74 e parameter list
5b70: 20 61 70 70 65 6e 64 65 64 20 74 6f 20 74 68 69 appended to thi
5b80: 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 5c 66 s callback is \f
5b90: 42 6d 63 70 72 65 66 65 72 65 6e 63 65 73 5c 66 Bmcpreferences\f
5ba0: 52 2e 0a 54 68 65 20 72 65 67 69 73 74 65 72 65 R..The registere
5bb0: 64 20 63 61 6c 6c 62 61 63 6b 73 20 61 72 65 20 d callbacks are
5bc0: 69 6e 76 6f 6b 65 64 20 69 6e 20 6e 6f 20 70 61 invoked in no pa
5bd0: 72 74 69 63 75 6c 61 72 20 6f 72 64 65 72 2e 0a rticular order..
5be0: 2e 52 45 0a 2e 54 50 0a 5c 66 42 75 6e 6b 6e 6f .RE..TP.\fBunkno
5bf0: 77 6e 63 6d 64 5c 66 52 0a 2e 0a 55 73 65 20 61 wncmd\fR...Use a
5c00: 20 70 61 63 6b 61 67 65 20 6c 6f 63 61 6c 65 20 package locale
5c10: 6d 63 75 6e 6b 6e 6f 77 6e 20 70 72 6f 63 65 64 mcunknown proced
5c20: 75 72 65 20 69 6e 73 74 65 61 64 20 6f 66 20 74 ure instead of t
5c30: 68 65 20 73 74 61 6e 64 61 72 64 20 76 65 72 73 he standard vers
5c40: 69 6f 6e 20 73 75 70 70 6c 69 65 64 20 62 79 20 ion supplied by
5c50: 74 68 65 20 6d 73 67 63 61 74 20 70 61 63 6b 61 the msgcat packa
5c60: 67 65 20 28 6d 73 67 63 61 74 3a 3a 6d 63 75 6e ge (msgcat::mcun
5c70: 6b 6e 6f 77 6e 29 2e 0a 2e 50 50 0a 2e 52 53 0a known)...PP..RS.
5c80: 54 68 65 20 63 61 6c 6c 65 64 20 70 72 6f 63 65 The called proce
5c90: 64 75 72 65 20 6d 75 73 74 20 72 65 74 75 72 6e dure must return
5ca0: 20 74 68 65 20 66 6f 72 6d 61 74 74 65 64 20 6d the formatted m
5cb0: 65 73 73 61 67 65 20 77 68 69 63 68 20 77 69 6c essage which wil
5cc0: 6c 20 66 69 6e 61 6c 6c 79 20 62 65 20 72 65 74 l finally be ret
5cd0: 75 72 6e 65 64 20 62 79 20 6d 73 67 63 61 74 3a urned by msgcat:
5ce0: 3a 6d 63 2e 0a 2e 50 50 0a 41 20 67 65 6e 65 72 :mc...PP.A gener
5cf0: 69 63 20 75 6e 6b 6e 6f 77 6e 20 68 61 6e 64 6c ic unknown handl
5d00: 65 72 20 69 73 20 75 73 65 64 20 69 66 20 73 65 er is used if se
5d10: 74 20 74 6f 20 74 68 65 20 65 6d 70 74 79 20 73 t to the empty s
5d20: 74 72 69 6e 67 2e 20 54 68 69 73 20 63 6f 6e 73 tring. This cons
5d30: 69 73 74 73 20 69 6e 20 72 65 74 75 72 6e 69 6e ists in returnin
5d40: 67 20 74 68 65 20 6b 65 79 20 69 66 20 6e 6f 20 g the key if no
5d50: 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20 67 69 arguments are gi
5d60: 76 65 6e 2e 20 57 69 74 68 20 67 69 76 65 6e 20 ven. With given
5d70: 61 72 67 75 6d 65 6e 74 73 2c 20 66 6f 72 6d 61 arguments, forma
5d80: 74 20 69 73 20 75 73 65 64 20 74 6f 20 70 72 6f t is used to pro
5d90: 63 65 73 73 20 74 68 65 20 61 72 67 75 6d 65 6e cess the argumen
5da0: 74 73 2e 0a 2e 50 50 0a 53 65 65 20 73 65 63 74 ts...PP.See sect
5db0: 69 6f 6e 20 5c 66 42 63 61 6c 6c 62 61 63 6b 20 ion \fBcallback
5dc0: 69 6e 76 6f 63 61 74 69 6f 6e 5c 66 52 20 62 65 invocation\fR be
5dd0: 6c 6f 77 2e 0a 54 68 65 20 61 70 70 65 6e 64 65 low..The appende
5de0: 64 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20 d arguments are
5df0: 69 64 65 6e 74 69 63 61 6c 20 74 6f 20 5c 66 42 identical to \fB
5e00: 3a 3a 6d 73 67 63 61 74 3a 3a 6d 63 75 6e 6b 6e ::msgcat::mcunkn
5e10: 6f 77 6e 5c 66 52 2e 0a 2e 52 45 0a 2e 53 48 20 own\fR...RE..SH
5e20: 22 43 61 6c 6c 62 61 63 6b 20 69 6e 76 6f 63 61 "Callback invoca
5e30: 74 69 6f 6e 22 0a 41 20 70 61 63 6b 61 67 65 20 tion".A package
5e40: 6d 61 79 20 64 65 63 69 64 65 20 74 6f 20 72 65 may decide to re
5e50: 67 69 73 74 65 72 20 6f 6e 65 20 6f 72 20 6d 75 gister one or mu
5e60: 6c 74 69 70 6c 65 20 63 61 6c 6c 62 61 63 6b 73 ltiple callbacks
5e70: 2c 20 61 73 20 64 65 73 63 72 69 62 65 64 20 61 , as described a
5e80: 62 6f 76 65 2e 0a 2e 50 50 0a 43 61 6c 6c 62 61 bove...PP.Callba
5e90: 63 6b 73 20 61 72 65 20 69 6e 76 6f 6b 65 64 2c cks are invoked,
5ea0: 20 69 66 3a 0a 2e 50 50 0a 31 2e 20 74 68 65 20 if:..PP.1. the
5eb0: 63 61 6c 6c 62 61 63 6b 20 63 6f 6d 6d 61 6e 64 callback command
5ec0: 20 69 73 20 73 65 74 2c 0a 2e 50 50 0a 32 2e 20 is set,..PP.2.
5ed0: 74 68 65 20 63 6f 6d 6d 61 6e 64 20 69 73 20 6e the command is n
5ee0: 6f 74 20 74 68 65 20 65 6d 70 74 79 20 73 74 72 ot the empty str
5ef0: 69 6e 67 2c 0a 2e 50 50 0a 33 2e 20 74 68 65 20 ing,..PP.3. the
5f00: 72 65 67 69 73 74 65 72 69 6e 67 20 6e 61 6d 65 registering name
5f10: 73 70 61 63 65 20 65 78 69 73 74 73 2e 0a 2e 50 space exists...P
5f20: 50 0a 49 66 20 61 20 63 61 6c 6c 65 64 20 72 6f P.If a called ro
5f30: 75 74 69 6e 65 20 66 61 69 6c 73 20 77 69 74 68 utine fails with
5f40: 20 61 6e 20 65 72 72 6f 72 2c 20 74 68 65 20 5c an error, the \
5f50: 66 42 62 67 65 72 72 6f 72 5c 66 52 20 72 6f 75 fBbgerror\fR rou
5f60: 74 69 6e 65 20 66 6f 72 20 74 68 65 20 69 6e 74 tine for the int
5f70: 65 72 70 72 65 74 65 72 20 69 73 20 69 6e 76 6f erpreter is invo
5f80: 6b 65 64 20 61 66 74 65 72 20 63 6f 6d 6d 61 6e ked after comman
5f90: 64 20 63 6f 6d 70 6c 65 74 69 6f 6e 2e 0a 4f 6e d completion..On
5fa0: 6c 79 20 65 78 63 65 70 74 69 6f 6e 20 69 73 20 ly exception is
5fb0: 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 5c 66 42 the callback \fB
5fc0: 75 6e 6b 6e 6f 77 6e 63 6d 64 5c 66 52 2c 20 77 unknowncmd\fR, w
5fd0: 68 65 72 65 20 61 6e 20 65 72 72 6f 72 20 63 61 here an error ca
5fe0: 75 73 65 73 20 74 68 65 20 69 6e 76 6f 6b 69 6e uses the invokin
5ff0: 67 20 5c 66 42 6d 63 5c 66 52 2d 63 6f 6d 6d 61 g \fBmc\fR-comma
6000: 6e 64 20 74 6f 20 66 61 69 6c 20 77 69 74 68 20 nd to fail with
6010: 74 68 61 74 20 65 72 72 6f 72 2e 0a 2e 50 50 0a that error...PP.
6020: 2e 56 53 20 74 69 70 34 39 30 0a 2e 53 48 20 22 .VS tip490..SH "
6030: 4f 42 4a 45 43 54 20 4f 52 49 45 4e 54 45 44 20 OBJECT ORIENTED
6040: 50 52 4f 47 52 41 4d 4d 49 4e 47 22 0a 5c 66 42 PROGRAMMING".\fB
6050: 6d 73 67 63 61 74 5c 66 52 20 73 75 70 70 6f 72 msgcat\fR suppor
6060: 74 73 20 70 61 63 6b 61 67 65 73 20 69 6d 70 6c ts packages impl
6070: 65 6d 65 6e 74 65 64 20 62 79 20 6f 62 6a 65 63 emented by objec
6080: 74 20 6f 72 69 65 6e 74 65 64 20 70 72 6f 67 72 t oriented progr
6090: 61 6d 6d 69 6e 67 2e 0a 4f 62 6a 65 63 74 73 20 amming..Objects
60a0: 61 6e 64 20 63 6c 61 73 73 65 73 20 73 68 6f 75 and classes shou
60b0: 6c 64 20 62 65 20 64 65 66 69 6e 65 64 20 77 69 ld be defined wi
60c0: 74 68 69 6e 20 61 20 70 61 63 6b 61 67 65 20 6e thin a package n
60d0: 61 6d 65 73 70 61 63 65 2e 0a 2e 50 50 0a 54 68 amespace...PP.Th
60e0: 65 72 65 20 61 72 65 20 33 20 73 75 70 70 6f 72 ere are 3 suppor
60f0: 74 65 64 20 63 61 73 65 73 20 77 68 65 72 65 20 ted cases where
6100: 70 61 63 6b 61 67 65 20 6e 61 6d 65 73 70 61 63 package namespac
6110: 65 20 73 65 6e 73 69 74 69 76 65 20 63 6f 6d 6d e sensitive comm
6120: 61 6e 64 73 20 6f 66 20 6d 73 67 63 61 74 20 28 ands of msgcat (
6130: 5c 66 42 6d 63 5c 66 52 2c 20 5c 66 42 6d 63 65 \fBmc\fR, \fBmce
6140: 78 69 73 74 73 5c 66 52 2c 20 5c 66 42 6d 63 70 xists\fR, \fBmcp
6150: 61 63 6b 61 67 65 6c 6f 63 61 6c 65 5c 66 52 2c ackagelocale\fR,
6160: 20 5c 66 42 6d 63 66 6f 72 67 65 74 70 61 63 6b \fBmcforgetpack
6170: 61 67 65 5c 66 52 2c 20 5c 66 42 6d 63 70 61 63 age\fR, \fBmcpac
6180: 6b 61 67 65 6e 61 6d 65 73 70 61 63 65 67 65 74 kagenamespaceget
6190: 5c 66 52 2c 20 5c 66 42 6d 63 70 61 63 6b 61 67 \fR, \fBmcpackag
61a0: 65 63 6f 6e 66 69 67 5c 66 52 2c 20 5c 66 42 6d econfig\fR, \fBm
61b0: 63 73 65 74 5c 66 52 20 61 6e 64 20 5c 66 42 6d cset\fR and \fBm
61c0: 63 6d 73 65 74 5c 66 52 29 20 6d 61 79 20 62 65 cmset\fR) may be
61d0: 20 63 61 6c 6c 65 64 3a 0a 2e 50 50 0a 2e 54 50 called:..PP..TP
61e0: 0a 5c 66 42 31 29 20 49 6e 20 63 6c 61 73 73 20 .\fB1) In class
61f0: 64 65 66 69 6e 69 74 69 6f 6e 20 73 63 72 69 70 definition scrip
6200: 74 5c 66 52 0a 2e 0a 5c 66 42 6d 73 67 63 61 74 t\fR...\fBmsgcat
6210: 5c 66 52 20 63 6f 6d 6d 61 6e 64 20 69 73 20 63 \fR command is c
6220: 61 6c 6c 65 64 20 77 69 74 68 69 6e 20 61 20 63 alled within a c
6230: 6c 61 73 73 20 64 65 66 69 6e 69 74 69 6f 6e 20 lass definition
6240: 73 63 72 69 70 74 2e 0a 2e 43 53 0a 6e 61 6d 65 script...CS.name
6250: 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 4e 32 20 space eval ::N2
6260: 7b 0a 20 20 20 20 6d 63 6c 6f 61 64 20 24 64 69 {. mcload $di
6270: 72 2f 6d 73 67 73 0a 20 20 20 20 6f 6f 3a 3a 63 r/msgs. oo::c
6280: 6c 61 73 73 20 63 72 65 61 74 65 20 43 31 20 7b lass create C1 {
6290: 70 75 74 73 20 5b 6d 63 20 48 69 21 5d 7d 0a 7d puts [mc Hi!]}.}
62a0: 0a 2e 43 45 0a 2e 50 50 0a 2e 54 50 0a 5c 66 42 ..CE..PP..TP.\fB
62b0: 32 29 20 6d 65 74 68 6f 64 20 64 65 66 69 6e 65 2) method define
62c0: 64 20 69 6e 20 61 20 63 6c 61 73 73 5c 66 52 0a d in a class\fR.
62d0: 2e 0a 5c 66 42 6d 73 67 63 61 74 5c 66 52 20 63 ..\fBmsgcat\fR c
62e0: 6f 6d 6d 61 6e 64 20 69 73 20 63 61 6c 6c 65 64 ommand is called
62f0: 20 66 72 6f 6d 20 61 20 6d 65 74 68 6f 64 20 69 from a method i
6300: 6e 20 61 6e 20 6f 62 6a 65 63 74 20 61 6e 64 20 n an object and
6310: 74 68 65 20 6d 65 74 68 6f 64 20 69 73 20 64 65 the method is de
6320: 66 69 6e 65 64 20 69 6e 20 61 20 63 6c 61 73 73 fined in a class
6330: 2e 0a 2e 43 53 0a 6e 61 6d 65 73 70 61 63 65 20 ...CS.namespace
6340: 65 76 61 6c 20 3a 3a 4e 33 43 6c 61 73 73 20 7b eval ::N3Class {
6350: 0a 20 20 20 20 6d 63 6c 6f 61 64 20 24 64 69 72 . mcload $dir
6360: 2f 6d 73 67 73 0a 20 20 20 20 6f 6f 3a 3a 63 6c /msgs. oo::cl
6370: 61 73 73 20 63 72 65 61 74 65 20 43 31 0a 20 20 ass create C1.
6380: 20 20 6f 6f 3a 3a 64 65 66 69 6e 65 20 43 31 20 oo::define C1
6390: 6d 65 74 68 6f 64 20 6d 31 20 7b 0a 20 20 20 20 method m1 {.
63a0: 20 20 20 20 70 75 74 73 20 5b 6d 63 20 48 69 21 puts [mc Hi!
63b0: 5d 0a 20 20 20 20 7d 0a 7d 0a 2e 43 45 0a 2e 50 ]. }.}..CE..P
63c0: 50 0a 2e 54 50 0a 5c 66 42 33 29 20 6d 65 74 68 P..TP.\fB3) meth
63d0: 6f 64 20 64 65 66 69 6e 65 64 20 69 6e 20 61 20 od defined in a
63e0: 63 6c 61 73 73 6c 65 73 73 20 6f 62 6a 65 63 74 classless object
63f0: 5c 66 52 0a 2e 0a 5c 66 42 6d 73 67 63 61 74 5c \fR...\fBmsgcat\
6400: 66 52 20 63 6f 6d 6d 61 6e 64 20 69 73 20 63 61 fR command is ca
6410: 6c 6c 65 64 20 66 72 6f 6d 20 61 20 6d 65 74 68 lled from a meth
6420: 6f 64 20 6f 66 20 61 20 63 6c 61 73 73 6c 65 73 od of a classles
6430: 73 20 6f 62 6a 65 63 74 2e 0a 2e 43 53 0a 6e 61 s object...CS.na
6440: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 4e mespace eval ::N
6450: 34 20 7b 0a 20 20 20 20 6d 63 6c 6f 61 64 20 24 4 {. mcload $
6460: 64 69 72 2f 6d 73 67 73 0a 20 20 20 20 6f 6f 3a dir/msgs. oo:
6470: 3a 6f 62 6a 65 63 74 20 63 72 65 61 74 65 20 4f :object create O
6480: 31 0a 20 20 20 20 6f 6f 3a 3a 6f 62 6a 64 65 66 1. oo::objdef
6490: 69 6e 65 20 4f 31 20 6d 65 74 68 6f 64 20 6d 31 ine O1 method m1
64a0: 20 7b 7d 20 7b 0a 20 20 20 20 20 20 20 20 70 75 {} {. pu
64b0: 74 73 20 5b 6d 63 20 48 69 21 5d 0a 20 20 20 20 ts [mc Hi!].
64c0: 7d 0a 7d 0a 2e 43 45 0a 2e 50 50 0a 2e 56 45 20 }.}..CE..PP..VE
64d0: 74 69 70 34 39 30 0a 2e 53 48 20 45 58 41 4d 50 tip490..SH EXAMP
64e0: 4c 45 53 0a 50 61 63 6b 61 67 65 73 20 77 68 69 LES.Packages whi
64f0: 63 68 20 64 69 73 70 6c 61 79 20 61 20 47 55 49 ch display a GUI
6500: 20 6d 61 79 20 75 70 64 61 74 65 20 74 68 65 69 may update thei
6510: 72 20 77 69 64 67 65 74 73 20 77 68 65 6e 20 74 r widgets when t
6520: 68 65 20 67 6c 6f 62 61 6c 20 6c 6f 63 61 6c 65 he global locale
6530: 20 63 68 61 6e 67 65 73 2e 0a 54 6f 20 72 65 67 changes..To reg
6540: 69 73 74 65 72 20 74 6f 20 61 20 63 61 6c 6c 62 ister to a callb
6550: 61 63 6b 2c 20 75 73 65 3a 0a 2e 43 53 0a 6e 61 ack, use:..CS.na
6560: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 67 75 69 mespace eval gui
6570: 20 7b 0a 20 20 20 20 6d 73 67 63 61 74 3a 3a 6d {. msgcat::m
6580: 63 70 61 63 6b 61 67 65 63 6f 6e 66 69 67 20 63 cpackageconfig c
6590: 68 61 6e 67 65 63 6d 64 20 75 70 64 61 74 65 47 hangecmd updateG
65a0: 55 49 0a 0a 20 20 20 20 70 72 6f 63 20 75 70 64 UI.. proc upd
65b0: 61 74 65 47 75 69 20 61 72 67 73 20 7b 0a 20 20 ateGui args {.
65c0: 20 20 20 20 20 20 70 75 74 73 20 22 4e 65 77 20 puts "New
65d0: 6c 6f 63 61 6c 65 20 69 73 20 27 5b 6c 69 6e 64 locale is '[lind
65e0: 65 78 20 24 61 72 67 73 20 30 5d 27 2e 22 0a 20 ex $args 0]'.".
65f0: 20 20 20 7d 0a 7d 0a 25 20 6d 73 67 63 61 74 3a }.}.% msgcat:
6600: 3a 6d 63 6c 6f 63 61 6c 65 20 66 72 0a 66 72 0a :mclocale fr.fr.
6610: 25 20 4e 65 77 20 6c 6f 63 61 6c 65 20 69 73 20 % New locale is
6620: 27 66 72 27 2e 0a 2e 43 45 0a 2e 50 50 0a 49 66 'fr'...CE..PP.If
6630: 20 6c 6f 63 61 6c 65 73 20 28 6f 72 20 61 64 64 locales (or add
6640: 69 74 69 6f 6e 61 6c 20 6c 6f 63 61 6c 65 73 29 itional locales)
6650: 20 61 72 65 20 63 6f 6e 74 61 69 6e 65 64 20 69 are contained i
6660: 6e 20 61 6e 6f 74 68 65 72 20 73 6f 75 72 63 65 n another source
6670: 20 6c 69 6b 65 20 61 20 64 61 74 61 20 62 61 73 like a data bas
6680: 65 2c 20 61 20 70 61 63 6b 61 67 65 20 6d 61 79 e, a package may
6690: 20 75 73 65 20 74 68 65 20 6c 6f 61 64 20 63 61 use the load ca
66a0: 6c 6c 62 61 63 6b 20 61 6e 64 20 6e 6f 74 20 6d llback and not m
66b0: 63 6c 6f 61 64 3a 0a 2e 43 53 0a 6e 61 6d 65 73 cload:..CS.names
66c0: 70 61 63 65 20 65 76 61 6c 20 64 62 20 7b 0a 20 pace eval db {.
66d0: 20 20 20 6d 73 67 63 61 74 3a 3a 6d 63 70 61 63 msgcat::mcpac
66e0: 6b 61 67 65 63 6f 6e 66 69 67 20 6c 6f 61 64 63 kageconfig loadc
66f0: 6d 64 20 6c 6f 61 64 4d 65 73 73 61 67 65 73 0a md loadMessages.
6700: 0a 20 20 20 20 70 72 6f 63 20 6c 6f 61 64 4d 65 . proc loadMe
6710: 73 73 61 67 65 73 20 61 72 67 73 20 7b 0a 20 20 ssages args {.
6720: 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 6c 6f foreach lo
6730: 63 61 6c 65 20 24 61 72 67 73 20 7b 0a 20 20 20 cale $args {.
6740: 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 4c 6f if {[Lo
6750: 63 61 6c 65 49 6e 44 42 20 24 6c 6f 63 61 6c 65 caleInDB $locale
6760: 5d 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 ]} {.
6770: 20 20 20 20 20 6d 73 67 63 61 74 3a 3a 6d 63 6d msgcat::mcm
6780: 73 65 74 20 24 6c 6f 63 61 6c 65 20 5b 47 65 74 set $locale [Get
6790: 4c 6f 63 61 6c 65 4c 69 73 74 20 24 6c 6f 63 61 LocaleList $loca
67a0: 6c 65 5d 0a 20 20 20 20 20 20 20 20 20 20 20 20 le].
67b0: 7d 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 }. }.
67c0: 7d 0a 7d 0a 2e 43 45 0a 2e 50 50 0a 54 68 65 20 }.}..CE..PP.The
67d0: 5c 66 42 63 6c 6f 63 6b 5c 66 52 20 63 6f 6d 6d \fBclock\fR comm
67e0: 61 6e 64 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 and implementati
67f0: 6f 6e 20 75 73 65 73 20 5c 66 42 6d 73 67 63 61 on uses \fBmsgca
6800: 74 5c 66 52 20 77 69 74 68 20 61 20 70 61 63 6b t\fR with a pack
6810: 61 67 65 20 6c 6f 63 61 6c 65 20 74 6f 20 69 6d age locale to im
6820: 70 6c 65 6d 65 6e 74 20 74 68 65 20 63 6f 6d 6d plement the comm
6830: 61 6e 64 20 6c 69 6e 65 20 70 61 72 61 6d 65 74 and line paramet
6840: 65 72 20 5c 66 42 2d 6c 6f 63 61 6c 65 5c 66 52 er \fB-locale\fR
6850: 2e 0a 48 65 72 65 20 61 72 65 20 73 6f 6d 65 20 ..Here are some
6860: 73 6b 65 74 63 68 65 73 20 6f 66 20 74 68 65 20 sketches of the
6870: 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 3a 0a implementation:.
6880: 2e 50 50 0a 46 69 72 73 74 2c 20 61 20 70 61 63 .PP.First, a pac
6890: 6b 61 67 65 20 6c 6f 63 61 6c 65 20 69 73 20 69 kage locale is i
68a0: 6e 69 74 69 61 6c 69 7a 65 64 20 61 6e 64 20 74 nitialized and t
68b0: 68 65 20 67 65 6e 65 72 69 63 20 75 6e 6b 6e 6f he generic unkno
68c0: 77 6e 20 66 75 6e 63 74 69 6f 6e 20 69 73 20 64 wn function is d
68d0: 65 73 61 63 74 69 76 61 74 65 64 3a 0a 2e 43 53 esactivated:..CS
68e0: 0a 6d 73 67 63 61 74 3a 3a 6d 63 70 61 63 6b 61 .msgcat::mcpacka
68f0: 67 65 6c 6f 63 61 6c 65 20 73 65 74 0a 6d 73 67 gelocale set.msg
6900: 63 61 74 3a 3a 6d 63 70 61 63 6b 61 67 65 63 6f cat::mcpackageco
6910: 6e 66 69 67 20 75 6e 6b 6e 6f 77 6e 63 6d 64 20 nfig unknowncmd
6920: 22 22 0a 2e 43 45 0a 41 73 20 61 6e 20 65 78 61 ""..CE.As an exa
6930: 6d 70 6c 65 2c 20 74 68 65 20 75 73 65 72 20 72 mple, the user r
6940: 65 71 75 69 72 65 73 20 74 68 65 20 77 65 65 6b equires the week
6950: 20 64 61 79 20 69 6e 20 61 20 63 65 72 74 61 69 day in a certai
6960: 6e 20 6c 6f 63 61 6c 65 20 61 73 20 66 6f 6c 6c n locale as foll
6970: 6f 77 73 3a 0a 2e 43 53 0a 63 6c 6f 63 6b 20 66 ows:..CS.clock f
6980: 6f 72 6d 61 74 20 63 6c 6f 63 6b 20 73 65 63 6f ormat clock seco
6990: 6e 64 73 20 2d 66 6f 72 6d 61 74 20 25 41 20 2d nds -format %A -
69a0: 6c 6f 63 61 6c 65 20 66 72 0a 2e 43 45 0a 5c 66 locale fr..CE.\f
69b0: 42 63 6c 6f 63 6b 5c 66 52 20 73 65 74 73 20 74 Bclock\fR sets t
69c0: 68 65 20 70 61 63 6b 61 67 65 20 6c 6f 63 61 6c he package local
69d0: 65 20 74 6f 20 5c 66 42 66 72 5c 66 52 20 61 6e e to \fBfr\fR an
69e0: 64 20 6c 6f 6f 6b 73 20 66 6f 72 20 74 68 65 20 d looks for the
69f0: 64 61 79 20 6e 61 6d 65 20 61 73 20 66 6f 6c 6c day name as foll
6a00: 6f 77 73 3a 0a 2e 43 53 0a 6d 73 67 63 61 74 3a ows:..CS.msgcat:
6a10: 3a 6d 63 70 61 63 6b 61 67 65 6c 6f 63 61 6c 65 :mcpackagelocale
6a20: 20 73 65 74 20 24 6c 6f 63 61 6c 65 0a 72 65 74 set $locale.ret
6a30: 75 72 6e 20 5b 6c 69 6e 64 65 78 20 5b 6d 73 67 urn [lindex [msg
6a40: 63 61 74 3a 3a 6d 63 20 44 41 59 53 5f 4f 46 5f cat::mc DAYS_OF_
6a50: 57 45 45 4b 5f 46 55 4c 4c 5d 20 24 64 61 79 5d WEEK_FULL] $day]
6a60: 0a 23 23 23 20 52 65 74 75 72 6e 73 20 22 6d 65 .### Returns "me
6a70: 72 63 72 65 64 69 22 0a 2e 43 45 0a 57 69 74 68 rcredi"..CE.With
6a80: 69 6e 20 5c 66 42 63 6c 6f 63 6b 5c 66 52 2c 20 in \fBclock\fR,
6a90: 73 6f 6d 65 20 6d 65 73 73 61 67 65 2d 63 61 74 some message-cat
6aa0: 61 6c 6f 67 20 69 74 65 6d 73 20 61 72 65 20 68 alog items are h
6ab0: 65 61 76 79 20 69 6e 20 63 6f 6d 70 75 74 61 74 eavy in computat
6ac0: 69 6f 6e 20 61 6e 64 20 74 68 75 73 20 61 72 65 ion and thus are
6ad0: 20 64 79 6e 61 6d 69 63 61 6c 6c 79 20 63 61 63 dynamically cac
6ae0: 68 65 64 20 75 73 69 6e 67 3a 0a 2e 43 53 0a 70 hed using:..CS.p
6af0: 72 6f 63 20 3a 3a 74 63 6c 3a 3a 63 6c 6f 63 6b roc ::tcl::clock
6b00: 3a 3a 4c 6f 63 61 6c 69 7a 65 46 6f 72 6d 61 74 ::LocalizeFormat
6b10: 20 7b 20 6c 6f 63 61 6c 65 20 66 6f 72 6d 61 74 { locale format
6b20: 20 7d 20 7b 0a 20 20 20 20 73 65 74 20 6b 65 79 } {. set key
6b30: 20 46 4f 52 4d 41 54 5f 24 66 6f 72 6d 61 74 0a FORMAT_$format.
6b40: 20 20 20 20 69 66 20 7b 20 5b 3a 3a 6d 73 67 63 if { [::msgc
6b50: 61 74 3a 3a 6d 63 65 78 69 73 74 73 20 2d 65 78 at::mcexists -ex
6b60: 61 63 74 6c 6f 63 61 6c 65 20 2d 65 78 61 63 74 actlocale -exact
6b70: 6e 61 6d 65 73 70 61 63 65 20 24 6b 65 79 5d 20 namespace $key]
6b80: 7d 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 } {. retu
6b90: 72 6e 20 5b 6d 63 20 24 6b 65 79 5d 0a 20 20 20 rn [mc $key].
6ba0: 20 7d 0a 20 20 20 20 23 2e 2e 2e 65 78 70 65 6e }. #...expen
6bb0: 73 69 76 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e sive computation
6bc0: 20 6f 66 20 66 6f 72 6d 61 74 20 63 6c 69 70 70 of format clipp
6bd0: 65 64 2e 2e 2e 0a 20 20 20 20 6d 63 73 65 74 20 ed.... mcset
6be0: 24 6c 6f 63 61 6c 65 20 24 6b 65 79 20 24 66 6f $locale $key $fo
6bf0: 72 6d 61 74 0a 20 20 20 20 72 65 74 75 72 6e 20 rmat. return
6c00: 24 66 6f 72 6d 61 74 0a 7d 0a 2e 43 45 0a 2e 56 $format.}..CE..V
6c10: 45 20 22 54 49 50 20 34 31 32 22 0a 2e 53 48 20 E "TIP 412"..SH
6c20: 43 52 45 44 49 54 53 0a 2e 50 50 0a 54 68 65 20 CREDITS..PP.The
6c30: 6d 65 73 73 61 67 65 20 63 61 74 61 6c 6f 67 20 message catalog
6c40: 63 6f 64 65 20 77 61 73 20 64 65 76 65 6c 6f 70 code was develop
6c50: 65 64 20 62 79 20 4d 61 72 6b 20 48 61 72 72 69 ed by Mark Harri
6c60: 73 6f 6e 2e 0a 2e 53 48 20 22 53 45 45 20 41 4c son...SH "SEE AL
6c70: 53 4f 22 0a 66 6f 72 6d 61 74 28 6e 29 2c 20 73 SO".format(n), s
6c80: 63 61 6e 28 6e 29 2c 20 6e 61 6d 65 73 70 61 63 can(n), namespac
6c90: 65 28 6e 29 2c 20 70 61 63 6b 61 67 65 28 6e 29 e(n), package(n)
6ca0: 2c 20 6f 6f 3a 3a 63 6c 61 73 73 28 6e 29 2c 20 , oo::class(n),
6cb0: 6f 6f 3a 3a 6f 62 6a 65 63 74 0a 2e 53 48 20 4b oo::object..SH K
6cc0: 45 59 57 4f 52 44 53 0a 69 6e 74 65 72 6e 61 74 EYWORDS.internat
6cd0: 69 6f 6e 61 6c 69 7a 61 74 69 6f 6e 2c 20 69 31 ionalization, i1
6ce0: 38 6e 2c 20 6c 6f 63 61 6c 69 7a 61 74 69 6f 6e 8n, localization
6cf0: 2c 20 6c 31 30 6e 2c 20 6d 65 73 73 61 67 65 2c , l10n, message,
6d00: 20 74 65 78 74 2c 20 74 72 61 6e 73 6c 61 74 69 text, translati
6d10: 6f 6e 2c 20 63 6c 61 73 73 2c 20 6f 62 6a 65 63 on, class, objec
6d20: 74 0a 2e 5c 22 20 4c 6f 63 61 6c 20 56 61 72 69 t..\" Local Vari
6d30: 61 62 6c 65 73 3a 0a 2e 5c 22 20 6d 6f 64 65 3a ables:..\" mode:
6d40: 20 6e 72 6f 66 66 0a 2e 5c 22 20 45 6e 64 3a 0a nroff..\" End:.