1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
-
+
-
+
|
'\"
'\" Copyright (c) 1998 Mark Harrison.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" SCCS: @(#) msgcat.n
'\"
.so man.macros
.TH "msgcat" n 1.3 msgcat "Tcl Bundled Packages"
.TH "msgcat" n 1.4 msgcat "Tcl Bundled Packages"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
msgcat \- Tcl message catalog
.SH SYNOPSIS
\fBpackage require Tcl 8.2\fR
.sp
\fBpackage require msgcat 1.3\fR
\fBpackage require msgcat 1.4\fR
.sp
\fB::msgcat::mc \fIsrc-string\fR ?\fIarg arg ...\fR?
.sp
\fB::msgcat::mcmax ?\fIsrc-string src-string ...\fR?
.sp
\fB::msgcat::mclocale \fR?\fInewLocale\fR?
.sp
|
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
+
-
+
+
|
Returns an ordered list of the locales preferred by
the user, based on the user's language specification.
The list is ordered from most specific to least
preference. The list is derived from the current
locale set in msgcat by \fBmsgcat::mclocale\fR, and
cannot be set independently. For example, if the
current locale is en_US_funky, then \fBmsgcat::mcpreferences\fR
.VS 1.4
returns {en_US_funky en_US en}.
returns \fB{en_US_funky en_US en {}}\fR.
.VE
.TP
\fB::msgcat::mcload \fIdirname\fR
Searches the specified directory for files that match
the language specifications returned by \fB::msgcat::mcpreferences\fR
(note that these are all lowercase), extended by the file
extension ``.msg''. Each matching file is
read in order, assuming a UTF-8 encoding. The file contents are
|
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
+
-
-
-
-
+
+
+
+
+
+
|
attempt to extract locale information from the
registry. If all these attempts to discover an initial locale
from the user's environment fail, msgcat defaults to an initial
locale of ``C''.
.PP
When a locale is specified by the user, a ``best match'' search is
performed during string translation. For example, if a user specifies
.VS 1.4
en_GB_Funky, the locales ``en_GB_Funky'', ``en_GB'', and ``en'' are
searched in order until a matching translation string is found. If no
translation string is available, then \fB::msgcat::unknown\fR is
called.
en_GB_Funky, the locales ``en_GB_Funky'', ``en_GB'', ``en'' and ``''
(the empty string)
.VE
are searched in order until a matching translation
string is found. If no translation string is available, then
\fB::msgcat::unknown\fR is called.
.SH "NAMESPACES AND MESSAGE CATALOGS"
.PP
Strings stored in the message catalog are stored relative
to the namespace from which they were added. This allows
multiple packages to use the same strings without fear
of collisions with other packages. It also allows the
|
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
+
+
+
+
+
+
|
.IP [2]
The message file name is a msgcat locale specifier (all lowercase)
followed by ``.msg''. For example:
.CS
es.msg -- spanish
en_gb.msg -- United Kingdom English
.CE
.VS
\fIException:\fR The message file for the root locale ``'' is
called \fBROOT.msg\fR. This exception is made so as not to
cause peculiar behavior, such as marking the message file as
``hidden'' on Unix file systems.
.VE
.IP [3]
The file contains a series of calls to \fBmcset\fR and
\fBmcmset\fR, setting the necessary translation strings
for the language, likely enclosed in a \fBnamespace eval\fR
so that all source strings are tied to the namespace of
the package. For example, a short \fBes.msg\fR might contain:
.CS
|