jpayne@68
|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
|
jpayne@68
|
2 <html>
|
jpayne@68
|
3 <!-- Created on February, 21 2024 by texi2html 1.78a -->
|
jpayne@68
|
4 <!--
|
jpayne@68
|
5 Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
|
jpayne@68
|
6 Karl Berry <karl@freefriends.org>
|
jpayne@68
|
7 Olaf Bachmann <obachman@mathematik.uni-kl.de>
|
jpayne@68
|
8 and many others.
|
jpayne@68
|
9 Maintained by: Many creative people.
|
jpayne@68
|
10 Send bugs and suggestions to <texi2html-bug@nongnu.org>
|
jpayne@68
|
11
|
jpayne@68
|
12 -->
|
jpayne@68
|
13 <head>
|
jpayne@68
|
14 <title>GNU gettext utilities: 10. Producing Binary MO Files</title>
|
jpayne@68
|
15
|
jpayne@68
|
16 <meta name="description" content="GNU gettext utilities: 10. Producing Binary MO Files">
|
jpayne@68
|
17 <meta name="keywords" content="GNU gettext utilities: 10. Producing Binary MO Files">
|
jpayne@68
|
18 <meta name="resource-type" content="document">
|
jpayne@68
|
19 <meta name="distribution" content="global">
|
jpayne@68
|
20 <meta name="Generator" content="texi2html 1.78a">
|
jpayne@68
|
21 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
jpayne@68
|
22 <style type="text/css">
|
jpayne@68
|
23 <!--
|
jpayne@68
|
24 a.summary-letter {text-decoration: none}
|
jpayne@68
|
25 pre.display {font-family: serif}
|
jpayne@68
|
26 pre.format {font-family: serif}
|
jpayne@68
|
27 pre.menu-comment {font-family: serif}
|
jpayne@68
|
28 pre.menu-preformatted {font-family: serif}
|
jpayne@68
|
29 pre.smalldisplay {font-family: serif; font-size: smaller}
|
jpayne@68
|
30 pre.smallexample {font-size: smaller}
|
jpayne@68
|
31 pre.smallformat {font-family: serif; font-size: smaller}
|
jpayne@68
|
32 pre.smalllisp {font-size: smaller}
|
jpayne@68
|
33 span.roman {font-family:serif; font-weight:normal;}
|
jpayne@68
|
34 span.sansserif {font-family:sans-serif; font-weight:normal;}
|
jpayne@68
|
35 ul.toc {list-style: none}
|
jpayne@68
|
36 -->
|
jpayne@68
|
37 </style>
|
jpayne@68
|
38
|
jpayne@68
|
39
|
jpayne@68
|
40 </head>
|
jpayne@68
|
41
|
jpayne@68
|
42 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
jpayne@68
|
43
|
jpayne@68
|
44 <table cellpadding="1" cellspacing="1" border="0">
|
jpayne@68
|
45 <tr><td valign="middle" align="left">[<a href="gettext_9.html#SEC87" title="Beginning of this chapter or previous chapter"> << </a>]</td>
|
jpayne@68
|
46 <td valign="middle" align="left">[<a href="gettext_11.html#SEC197" title="Next chapter"> >> </a>]</td>
|
jpayne@68
|
47 <td valign="middle" align="left"> </td>
|
jpayne@68
|
48 <td valign="middle" align="left"> </td>
|
jpayne@68
|
49 <td valign="middle" align="left"> </td>
|
jpayne@68
|
50 <td valign="middle" align="left"> </td>
|
jpayne@68
|
51 <td valign="middle" align="left"> </td>
|
jpayne@68
|
52 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
|
jpayne@68
|
53 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
|
jpayne@68
|
54 <td valign="middle" align="left">[<a href="gettext_21.html#SEC389" title="Index">Index</a>]</td>
|
jpayne@68
|
55 <td valign="middle" align="left">[<a href="gettext_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
|
jpayne@68
|
56 </tr></table>
|
jpayne@68
|
57
|
jpayne@68
|
58 <hr size="2">
|
jpayne@68
|
59 <a name="Binaries"></a>
|
jpayne@68
|
60 <a name="SEC173"></a>
|
jpayne@68
|
61 <h1 class="chapter"> <a href="gettext_toc.html#TOC166">10. Producing Binary MO Files</a> </h1>
|
jpayne@68
|
62
|
jpayne@68
|
63
|
jpayne@68
|
64
|
jpayne@68
|
65
|
jpayne@68
|
66 <a name="msgfmt-Invocation"></a>
|
jpayne@68
|
67 <a name="SEC174"></a>
|
jpayne@68
|
68 <h2 class="section"> <a href="gettext_toc.html#TOC167">10.1 Invoking the <code>msgfmt</code> Program</a> </h2>
|
jpayne@68
|
69
|
jpayne@68
|
70
|
jpayne@68
|
71 <table><tr><td> </td><td><pre class="example">msgfmt [<var>option</var>] <var>filename</var>.po …
|
jpayne@68
|
72 </pre></td></tr></table>
|
jpayne@68
|
73
|
jpayne@68
|
74 <a name="IDX928"></a>
|
jpayne@68
|
75 <p>The <code>msgfmt</code> programs generates a binary message catalog from a textual
|
jpayne@68
|
76 translation description.
|
jpayne@68
|
77 </p>
|
jpayne@68
|
78
|
jpayne@68
|
79 <a name="SEC175"></a>
|
jpayne@68
|
80 <h3 class="subsection"> <a href="gettext_toc.html#TOC168">10.1.1 Input file location</a> </h3>
|
jpayne@68
|
81
|
jpayne@68
|
82 <dl compact="compact">
|
jpayne@68
|
83 <dt> ‘<samp><var>filename</var>.po …</samp>’</dt>
|
jpayne@68
|
84 <dt> ‘<samp>-D <var>directory</var></samp>’</dt>
|
jpayne@68
|
85 <dt> ‘<samp>--directory=<var>directory</var></samp>’</dt>
|
jpayne@68
|
86 <dd><a name="IDX929"></a>
|
jpayne@68
|
87 <a name="IDX930"></a>
|
jpayne@68
|
88 <p>Add <var>directory</var> to the list of directories. Source files are
|
jpayne@68
|
89 searched relative to this list of directories. The resulting binary
|
jpayne@68
|
90 file will be written relative to the current directory, though.
|
jpayne@68
|
91 </p>
|
jpayne@68
|
92 </dd>
|
jpayne@68
|
93 </dl>
|
jpayne@68
|
94
|
jpayne@68
|
95 <p>If an input file is ‘<samp>-</samp>’, standard input is read.
|
jpayne@68
|
96 </p>
|
jpayne@68
|
97
|
jpayne@68
|
98 <a name="SEC176"></a>
|
jpayne@68
|
99 <h3 class="subsection"> <a href="gettext_toc.html#TOC169">10.1.2 Operation mode</a> </h3>
|
jpayne@68
|
100
|
jpayne@68
|
101 <dl compact="compact">
|
jpayne@68
|
102 <dt> ‘<samp>-j</samp>’</dt>
|
jpayne@68
|
103 <dt> ‘<samp>--java</samp>’</dt>
|
jpayne@68
|
104 <dd><a name="IDX931"></a>
|
jpayne@68
|
105 <a name="IDX932"></a>
|
jpayne@68
|
106 <a name="IDX933"></a>
|
jpayne@68
|
107 <p>Java mode: generate a Java <code>ResourceBundle</code> class.
|
jpayne@68
|
108 </p>
|
jpayne@68
|
109 </dd>
|
jpayne@68
|
110 <dt> ‘<samp>--java2</samp>’</dt>
|
jpayne@68
|
111 <dd><a name="IDX934"></a>
|
jpayne@68
|
112 <p>Like –java, and assume Java2 (JDK 1.2 or higher).
|
jpayne@68
|
113 </p>
|
jpayne@68
|
114 </dd>
|
jpayne@68
|
115 <dt> ‘<samp>--csharp</samp>’</dt>
|
jpayne@68
|
116 <dd><a name="IDX935"></a>
|
jpayne@68
|
117 <a name="IDX936"></a>
|
jpayne@68
|
118 <p>C# mode: generate a .NET .dll file containing a subclass of
|
jpayne@68
|
119 <code>GettextResourceSet</code>.
|
jpayne@68
|
120 </p>
|
jpayne@68
|
121 </dd>
|
jpayne@68
|
122 <dt> ‘<samp>--csharp-resources</samp>’</dt>
|
jpayne@68
|
123 <dd><a name="IDX937"></a>
|
jpayne@68
|
124 <a name="IDX938"></a>
|
jpayne@68
|
125 <p>C# resources mode: generate a .NET ‘<tt>.resources</tt>’ file.
|
jpayne@68
|
126 </p>
|
jpayne@68
|
127 </dd>
|
jpayne@68
|
128 <dt> ‘<samp>--tcl</samp>’</dt>
|
jpayne@68
|
129 <dd><a name="IDX939"></a>
|
jpayne@68
|
130 <a name="IDX940"></a>
|
jpayne@68
|
131 <p>Tcl mode: generate a tcl/msgcat ‘<tt>.msg</tt>’ file.
|
jpayne@68
|
132 </p>
|
jpayne@68
|
133 </dd>
|
jpayne@68
|
134 <dt> ‘<samp>--qt</samp>’</dt>
|
jpayne@68
|
135 <dd><a name="IDX941"></a>
|
jpayne@68
|
136 <a name="IDX942"></a>
|
jpayne@68
|
137 <p>Qt mode: generate a Qt ‘<tt>.qm</tt>’ file.
|
jpayne@68
|
138 </p>
|
jpayne@68
|
139 </dd>
|
jpayne@68
|
140 <dt> ‘<samp>--desktop</samp>’</dt>
|
jpayne@68
|
141 <dd><a name="IDX943"></a>
|
jpayne@68
|
142 <a name="IDX944"></a>
|
jpayne@68
|
143 <p>Desktop Entry mode: generate a ‘<tt>.desktop</tt>’ file.
|
jpayne@68
|
144 </p>
|
jpayne@68
|
145 </dd>
|
jpayne@68
|
146 <dt> ‘<samp>--xml</samp>’</dt>
|
jpayne@68
|
147 <dd><a name="IDX945"></a>
|
jpayne@68
|
148 <a name="IDX946"></a>
|
jpayne@68
|
149 <p>XML mode: generate an XML file.
|
jpayne@68
|
150 </p>
|
jpayne@68
|
151 </dd>
|
jpayne@68
|
152 </dl>
|
jpayne@68
|
153
|
jpayne@68
|
154
|
jpayne@68
|
155 <a name="SEC177"></a>
|
jpayne@68
|
156 <h3 class="subsection"> <a href="gettext_toc.html#TOC170">10.1.3 Output file location</a> </h3>
|
jpayne@68
|
157
|
jpayne@68
|
158 <dl compact="compact">
|
jpayne@68
|
159 <dt> ‘<samp>-o <var>file</var></samp>’</dt>
|
jpayne@68
|
160 <dt> ‘<samp>--output-file=<var>file</var></samp>’</dt>
|
jpayne@68
|
161 <dd><a name="IDX947"></a>
|
jpayne@68
|
162 <a name="IDX948"></a>
|
jpayne@68
|
163 <p>Write output to specified file.
|
jpayne@68
|
164 </p>
|
jpayne@68
|
165 </dd>
|
jpayne@68
|
166 <dt> ‘<samp>--strict</samp>’</dt>
|
jpayne@68
|
167 <dd><a name="IDX949"></a>
|
jpayne@68
|
168 <p>Direct the program to work strictly following the Uniforum/Sun
|
jpayne@68
|
169 implementation. Currently this only affects the naming of the output
|
jpayne@68
|
170 file. If this option is not given the name of the output file is the
|
jpayne@68
|
171 same as the domain name. If the strict Uniforum mode is enabled the
|
jpayne@68
|
172 suffix ‘<tt>.mo</tt>’ is added to the file name if it is not already
|
jpayne@68
|
173 present.
|
jpayne@68
|
174 </p>
|
jpayne@68
|
175 <p>We find this behaviour of Sun's implementation rather silly and so by
|
jpayne@68
|
176 default this mode is <em>not</em> selected.
|
jpayne@68
|
177 </p>
|
jpayne@68
|
178 </dd>
|
jpayne@68
|
179 </dl>
|
jpayne@68
|
180
|
jpayne@68
|
181 <p>If the output <var>file</var> is ‘<samp>-</samp>’, output is written to standard output.
|
jpayne@68
|
182 </p>
|
jpayne@68
|
183
|
jpayne@68
|
184 <a name="SEC178"></a>
|
jpayne@68
|
185 <h3 class="subsection"> <a href="gettext_toc.html#TOC171">10.1.4 Output file location in Java mode</a> </h3>
|
jpayne@68
|
186
|
jpayne@68
|
187 <dl compact="compact">
|
jpayne@68
|
188 <dt> ‘<samp>-r <var>resource</var></samp>’</dt>
|
jpayne@68
|
189 <dt> ‘<samp>--resource=<var>resource</var></samp>’</dt>
|
jpayne@68
|
190 <dd><a name="IDX950"></a>
|
jpayne@68
|
191 <a name="IDX951"></a>
|
jpayne@68
|
192 <p>Specify the resource name.
|
jpayne@68
|
193 </p>
|
jpayne@68
|
194 </dd>
|
jpayne@68
|
195 <dt> ‘<samp>-l <var>locale</var></samp>’</dt>
|
jpayne@68
|
196 <dt> ‘<samp>--locale=<var>locale</var></samp>’</dt>
|
jpayne@68
|
197 <dd><a name="IDX952"></a>
|
jpayne@68
|
198 <a name="IDX953"></a>
|
jpayne@68
|
199 <p>Specify the locale name, either a language specification of the form <var>ll</var>
|
jpayne@68
|
200 or a combined language and country specification of the form <var>ll_CC</var>.
|
jpayne@68
|
201 </p>
|
jpayne@68
|
202 </dd>
|
jpayne@68
|
203 <dt> ‘<samp>-d <var>directory</var></samp>’</dt>
|
jpayne@68
|
204 <dd><a name="IDX954"></a>
|
jpayne@68
|
205 <p>Specify the base directory of classes directory hierarchy.
|
jpayne@68
|
206 </p>
|
jpayne@68
|
207 </dd>
|
jpayne@68
|
208 <dt> ‘<samp>--source</samp>’</dt>
|
jpayne@68
|
209 <dd><a name="IDX955"></a>
|
jpayne@68
|
210 <p>Produce a .java source file, instead of a compiled .class file.
|
jpayne@68
|
211 </p>
|
jpayne@68
|
212 </dd>
|
jpayne@68
|
213 </dl>
|
jpayne@68
|
214
|
jpayne@68
|
215 <p>The class name is determined by appending the locale name to the resource name,
|
jpayne@68
|
216 separated with an underscore. The ‘<samp>-d</samp>’ option is mandatory. The class
|
jpayne@68
|
217 is written under the specified directory.
|
jpayne@68
|
218 </p>
|
jpayne@68
|
219
|
jpayne@68
|
220 <a name="SEC179"></a>
|
jpayne@68
|
221 <h3 class="subsection"> <a href="gettext_toc.html#TOC172">10.1.5 Output file location in C# mode</a> </h3>
|
jpayne@68
|
222
|
jpayne@68
|
223 <dl compact="compact">
|
jpayne@68
|
224 <dt> ‘<samp>-r <var>resource</var></samp>’</dt>
|
jpayne@68
|
225 <dt> ‘<samp>--resource=<var>resource</var></samp>’</dt>
|
jpayne@68
|
226 <dd><a name="IDX956"></a>
|
jpayne@68
|
227 <a name="IDX957"></a>
|
jpayne@68
|
228 <p>Specify the resource name.
|
jpayne@68
|
229 </p>
|
jpayne@68
|
230 </dd>
|
jpayne@68
|
231 <dt> ‘<samp>-l <var>locale</var></samp>’</dt>
|
jpayne@68
|
232 <dt> ‘<samp>--locale=<var>locale</var></samp>’</dt>
|
jpayne@68
|
233 <dd><a name="IDX958"></a>
|
jpayne@68
|
234 <a name="IDX959"></a>
|
jpayne@68
|
235 <p>Specify the locale name, either a language specification of the form <var>ll</var>
|
jpayne@68
|
236 or a combined language and country specification of the form <var>ll_CC</var>.
|
jpayne@68
|
237 </p>
|
jpayne@68
|
238 </dd>
|
jpayne@68
|
239 <dt> ‘<samp>-d <var>directory</var></samp>’</dt>
|
jpayne@68
|
240 <dd><a name="IDX960"></a>
|
jpayne@68
|
241 <p>Specify the base directory for locale dependent ‘<tt>.dll</tt>’ files.
|
jpayne@68
|
242 </p>
|
jpayne@68
|
243 </dd>
|
jpayne@68
|
244 </dl>
|
jpayne@68
|
245
|
jpayne@68
|
246 <p>The ‘<samp>-l</samp>’ and ‘<samp>-d</samp>’ options are mandatory. The ‘<tt>.dll</tt>’ file is
|
jpayne@68
|
247 written in a subdirectory of the specified directory whose name depends on the
|
jpayne@68
|
248 locale.
|
jpayne@68
|
249 </p>
|
jpayne@68
|
250
|
jpayne@68
|
251 <a name="SEC180"></a>
|
jpayne@68
|
252 <h3 class="subsection"> <a href="gettext_toc.html#TOC173">10.1.6 Output file location in Tcl mode</a> </h3>
|
jpayne@68
|
253
|
jpayne@68
|
254 <dl compact="compact">
|
jpayne@68
|
255 <dt> ‘<samp>-l <var>locale</var></samp>’</dt>
|
jpayne@68
|
256 <dt> ‘<samp>--locale=<var>locale</var></samp>’</dt>
|
jpayne@68
|
257 <dd><a name="IDX961"></a>
|
jpayne@68
|
258 <a name="IDX962"></a>
|
jpayne@68
|
259 <p>Specify the locale name, either a language specification of the form <var>ll</var>
|
jpayne@68
|
260 or a combined language and country specification of the form <var>ll_CC</var>.
|
jpayne@68
|
261 </p>
|
jpayne@68
|
262 </dd>
|
jpayne@68
|
263 <dt> ‘<samp>-d <var>directory</var></samp>’</dt>
|
jpayne@68
|
264 <dd><a name="IDX963"></a>
|
jpayne@68
|
265 <p>Specify the base directory of ‘<tt>.msg</tt>’ message catalogs.
|
jpayne@68
|
266 </p>
|
jpayne@68
|
267 </dd>
|
jpayne@68
|
268 </dl>
|
jpayne@68
|
269
|
jpayne@68
|
270 <p>The ‘<samp>-l</samp>’ and ‘<samp>-d</samp>’ options are mandatory. The ‘<tt>.msg</tt>’ file is
|
jpayne@68
|
271 written in the specified directory.
|
jpayne@68
|
272 </p>
|
jpayne@68
|
273
|
jpayne@68
|
274 <a name="SEC181"></a>
|
jpayne@68
|
275 <h3 class="subsection"> <a href="gettext_toc.html#TOC174">10.1.7 Desktop Entry mode operations</a> </h3>
|
jpayne@68
|
276
|
jpayne@68
|
277 <dl compact="compact">
|
jpayne@68
|
278 <dt> ‘<samp>--template=<var>template</var></samp>’</dt>
|
jpayne@68
|
279 <dd><a name="IDX964"></a>
|
jpayne@68
|
280 <p>Specify a .desktop file used as a template.
|
jpayne@68
|
281 </p>
|
jpayne@68
|
282 </dd>
|
jpayne@68
|
283 <dt> ‘<samp>-k[<var>keywordspec</var>]</samp>’</dt>
|
jpayne@68
|
284 <dt> ‘<samp>--keyword[=<var>keywordspec</var>]</samp>’</dt>
|
jpayne@68
|
285 <dd><a name="IDX965"></a>
|
jpayne@68
|
286 <a name="IDX966"></a>
|
jpayne@68
|
287 <p>Specify <var>keywordspec</var> as an additional keyword to be looked for.
|
jpayne@68
|
288 Without a <var>keywordspec</var>, the option means to not use default keywords.
|
jpayne@68
|
289 </p>
|
jpayne@68
|
290 </dd>
|
jpayne@68
|
291 <dt> ‘<samp>-l <var>locale</var></samp>’</dt>
|
jpayne@68
|
292 <dt> ‘<samp>--locale=<var>locale</var></samp>’</dt>
|
jpayne@68
|
293 <dd><a name="IDX967"></a>
|
jpayne@68
|
294 <a name="IDX968"></a>
|
jpayne@68
|
295 <p>Specify the locale name, either a language specification of the form <var>ll</var>
|
jpayne@68
|
296 or a combined language and country specification of the form <var>ll_CC</var>.
|
jpayne@68
|
297 </p>
|
jpayne@68
|
298 </dd>
|
jpayne@68
|
299 <dt> ‘<samp>-d <var>directory</var></samp>’</dt>
|
jpayne@68
|
300 <dd><a name="IDX969"></a>
|
jpayne@68
|
301 <p>Specify the directory where PO files are read. The directory must
|
jpayne@68
|
302 contain the ‘<samp>LINGUAS</samp>’ file.
|
jpayne@68
|
303 </p>
|
jpayne@68
|
304 </dd>
|
jpayne@68
|
305 </dl>
|
jpayne@68
|
306
|
jpayne@68
|
307 <p>To generate a ‘<samp>.desktop</samp>’ file for a single locale, you can use it
|
jpayne@68
|
308 as follows.
|
jpayne@68
|
309 </p>
|
jpayne@68
|
310 <table><tr><td> </td><td><pre class="example">msgfmt --desktop --template=<var>template</var> --locale=<var>locale</var> \
|
jpayne@68
|
311 -o <var>file</var> <var>filename</var>.po …
|
jpayne@68
|
312 </pre></td></tr></table>
|
jpayne@68
|
313
|
jpayne@68
|
314 <p>msgfmt provides a special "bulk" operation mode to process multiple
|
jpayne@68
|
315 ‘<tt>.po</tt>’ files at a time.
|
jpayne@68
|
316 </p>
|
jpayne@68
|
317 <table><tr><td> </td><td><pre class="example">msgfmt --desktop --template=<var>template</var> -d <var>directory</var> -o <var>file</var>
|
jpayne@68
|
318 </pre></td></tr></table>
|
jpayne@68
|
319
|
jpayne@68
|
320 <p>msgfmt first reads the ‘<samp>LINGUAS</samp>’ file under <var>directory</var>, and
|
jpayne@68
|
321 then processes all ‘<samp>.po</samp>’ files listed there. You can also limit
|
jpayne@68
|
322 the locales to a subset, through the ‘<samp>LINGUAS</samp>’ environment
|
jpayne@68
|
323 variable.
|
jpayne@68
|
324 </p>
|
jpayne@68
|
325 <p>For either operation modes, the ‘<samp>-o</samp>’ and ‘<samp>--template</samp>’
|
jpayne@68
|
326 options are mandatory.
|
jpayne@68
|
327 </p>
|
jpayne@68
|
328
|
jpayne@68
|
329 <a name="SEC182"></a>
|
jpayne@68
|
330 <h3 class="subsection"> <a href="gettext_toc.html#TOC175">10.1.8 XML mode operations</a> </h3>
|
jpayne@68
|
331
|
jpayne@68
|
332 <dl compact="compact">
|
jpayne@68
|
333 <dt> ‘<samp>--template=<var>template</var></samp>’</dt>
|
jpayne@68
|
334 <dd><a name="IDX970"></a>
|
jpayne@68
|
335 <p>Specify an XML file used as a template.
|
jpayne@68
|
336 </p>
|
jpayne@68
|
337 </dd>
|
jpayne@68
|
338 <dt> ‘<samp>-L <var>name</var></samp>’</dt>
|
jpayne@68
|
339 <dt> ‘<samp>--language=<var>name</var></samp>’</dt>
|
jpayne@68
|
340 <dd><a name="IDX971"></a>
|
jpayne@68
|
341 <a name="IDX972"></a>
|
jpayne@68
|
342 <a name="IDX973"></a>
|
jpayne@68
|
343 <p>Specifies the language of the input files.
|
jpayne@68
|
344 </p>
|
jpayne@68
|
345 </dd>
|
jpayne@68
|
346 <dt> ‘<samp>-l <var>locale</var></samp>’</dt>
|
jpayne@68
|
347 <dt> ‘<samp>--locale=<var>locale</var></samp>’</dt>
|
jpayne@68
|
348 <dd><a name="IDX974"></a>
|
jpayne@68
|
349 <a name="IDX975"></a>
|
jpayne@68
|
350 <p>Specify the locale name, either a language specification of the form <var>ll</var>
|
jpayne@68
|
351 or a combined language and country specification of the form <var>ll_CC</var>.
|
jpayne@68
|
352 </p>
|
jpayne@68
|
353 </dd>
|
jpayne@68
|
354 <dt> ‘<samp>-d <var>directory</var></samp>’</dt>
|
jpayne@68
|
355 <dd><a name="IDX976"></a>
|
jpayne@68
|
356 <p>Specify the base directory of ‘<tt>.po</tt>’ message catalogs.
|
jpayne@68
|
357 </p>
|
jpayne@68
|
358 </dd>
|
jpayne@68
|
359 </dl>
|
jpayne@68
|
360
|
jpayne@68
|
361 <p>To generate an XML file for a single locale, you can use it as follows.
|
jpayne@68
|
362 </p>
|
jpayne@68
|
363 <table><tr><td> </td><td><pre class="example">msgfmt --xml --template=<var>template</var> --locale=<var>locale</var> \
|
jpayne@68
|
364 -o <var>file</var> <var>filename</var>.po …
|
jpayne@68
|
365 </pre></td></tr></table>
|
jpayne@68
|
366
|
jpayne@68
|
367 <p>msgfmt provides a special "bulk" operation mode to process multiple
|
jpayne@68
|
368 ‘<tt>.po</tt>’ files at a time.
|
jpayne@68
|
369 </p>
|
jpayne@68
|
370 <table><tr><td> </td><td><pre class="example">msgfmt --xml --template=<var>template</var> -d <var>directory</var> -o <var>file</var>
|
jpayne@68
|
371 </pre></td></tr></table>
|
jpayne@68
|
372
|
jpayne@68
|
373 <p>msgfmt first reads the ‘<samp>LINGUAS</samp>’ file under <var>directory</var>, and
|
jpayne@68
|
374 then processes all ‘<samp>.po</samp>’ files listed there. You can also limit
|
jpayne@68
|
375 the locales to a subset, through the ‘<samp>LINGUAS</samp>’ environment
|
jpayne@68
|
376 variable.
|
jpayne@68
|
377 </p>
|
jpayne@68
|
378 <p>For either operation modes, the ‘<samp>-o</samp>’ and ‘<samp>--template</samp>’
|
jpayne@68
|
379 options are mandatory.
|
jpayne@68
|
380 </p>
|
jpayne@68
|
381
|
jpayne@68
|
382 <a name="SEC183"></a>
|
jpayne@68
|
383 <h3 class="subsection"> <a href="gettext_toc.html#TOC176">10.1.9 Input file syntax</a> </h3>
|
jpayne@68
|
384
|
jpayne@68
|
385 <dl compact="compact">
|
jpayne@68
|
386 <dt> ‘<samp>-P</samp>’</dt>
|
jpayne@68
|
387 <dt> ‘<samp>--properties-input</samp>’</dt>
|
jpayne@68
|
388 <dd><a name="IDX977"></a>
|
jpayne@68
|
389 <a name="IDX978"></a>
|
jpayne@68
|
390 <p>Assume the input files are Java ResourceBundles in Java <code>.properties</code>
|
jpayne@68
|
391 syntax, not in PO file syntax.
|
jpayne@68
|
392 </p>
|
jpayne@68
|
393 </dd>
|
jpayne@68
|
394 <dt> ‘<samp>--stringtable-input</samp>’</dt>
|
jpayne@68
|
395 <dd><a name="IDX979"></a>
|
jpayne@68
|
396 <p>Assume the input files are NeXTstep/GNUstep localized resource files in
|
jpayne@68
|
397 <code>.strings</code> syntax, not in PO file syntax.
|
jpayne@68
|
398 </p>
|
jpayne@68
|
399 </dd>
|
jpayne@68
|
400 </dl>
|
jpayne@68
|
401
|
jpayne@68
|
402
|
jpayne@68
|
403 <a name="SEC184"></a>
|
jpayne@68
|
404 <h3 class="subsection"> <a href="gettext_toc.html#TOC177">10.1.10 Input file interpretation</a> </h3>
|
jpayne@68
|
405
|
jpayne@68
|
406 <dl compact="compact">
|
jpayne@68
|
407 <dt> ‘<samp>-c</samp>’</dt>
|
jpayne@68
|
408 <dt> ‘<samp>--check</samp>’</dt>
|
jpayne@68
|
409 <dd><a name="IDX980"></a>
|
jpayne@68
|
410 <a name="IDX981"></a>
|
jpayne@68
|
411 <p>Perform all the checks implied by <code>--check-format</code>, <code>--check-header</code>,
|
jpayne@68
|
412 <code>--check-domain</code>.
|
jpayne@68
|
413 </p>
|
jpayne@68
|
414 </dd>
|
jpayne@68
|
415 <dt> ‘<samp>--check-format</samp>’</dt>
|
jpayne@68
|
416 <dd><a name="IDX982"></a>
|
jpayne@68
|
417 <a name="IDX983"></a>
|
jpayne@68
|
418 <p>Check language dependent format strings.
|
jpayne@68
|
419 </p>
|
jpayne@68
|
420 <p>If the string represents a format string used in a
|
jpayne@68
|
421 <code>printf</code>-like function both strings should have the same number of
|
jpayne@68
|
422 ‘<samp>%</samp>’ format specifiers, with matching types. If the flag
|
jpayne@68
|
423 <code>c-format</code> or <code>possible-c-format</code> appears in the special
|
jpayne@68
|
424 comment <#,> for this entry a check is performed. For example, the
|
jpayne@68
|
425 check will diagnose using ‘<samp>%.*s</samp>’ against ‘<samp>%s</samp>’, or ‘<samp>%d</samp>’
|
jpayne@68
|
426 against ‘<samp>%s</samp>’, or ‘<samp>%d</samp>’ against ‘<samp>%x</samp>’. It can even handle
|
jpayne@68
|
427 positional parameters.
|
jpayne@68
|
428 </p>
|
jpayne@68
|
429 <p>Normally the <code>xgettext</code> program automatically decides whether a
|
jpayne@68
|
430 string is a format string or not. This algorithm is not perfect,
|
jpayne@68
|
431 though. It might regard a string as a format string though it is not
|
jpayne@68
|
432 used in a <code>printf</code>-like function and so <code>msgfmt</code> might report
|
jpayne@68
|
433 errors where there are none.
|
jpayne@68
|
434 </p>
|
jpayne@68
|
435 <p>To solve this problem the programmer can dictate the decision to the
|
jpayne@68
|
436 <code>xgettext</code> program (see section <a href="gettext_15.html#SEC267">C Format Strings</a>). The translator should not
|
jpayne@68
|
437 consider removing the flag from the <#,> line. This "fix" would be
|
jpayne@68
|
438 reversed again as soon as <code>msgmerge</code> is called the next time.
|
jpayne@68
|
439 </p>
|
jpayne@68
|
440 </dd>
|
jpayne@68
|
441 <dt> ‘<samp>--check-header</samp>’</dt>
|
jpayne@68
|
442 <dd><a name="IDX984"></a>
|
jpayne@68
|
443 <p>Verify presence and contents of the header entry. See section <a href="gettext_6.html#SEC52">Filling in the Header Entry</a>,
|
jpayne@68
|
444 for a description of the various fields in the header entry.
|
jpayne@68
|
445 </p>
|
jpayne@68
|
446 </dd>
|
jpayne@68
|
447 <dt> ‘<samp>--check-domain</samp>’</dt>
|
jpayne@68
|
448 <dd><a name="IDX985"></a>
|
jpayne@68
|
449 <p>Check for conflicts between domain directives and the <code>--output-file</code>
|
jpayne@68
|
450 option
|
jpayne@68
|
451 </p>
|
jpayne@68
|
452 </dd>
|
jpayne@68
|
453 <dt> ‘<samp>-C</samp>’</dt>
|
jpayne@68
|
454 <dt> ‘<samp>--check-compatibility</samp>’</dt>
|
jpayne@68
|
455 <dd><a name="IDX986"></a>
|
jpayne@68
|
456 <a name="IDX987"></a>
|
jpayne@68
|
457 <a name="IDX988"></a>
|
jpayne@68
|
458 <p>Check that GNU msgfmt behaves like X/Open msgfmt. This will give an error
|
jpayne@68
|
459 when attempting to use the GNU extensions.
|
jpayne@68
|
460 </p>
|
jpayne@68
|
461 </dd>
|
jpayne@68
|
462 <dt> ‘<samp>--check-accelerators[=<var>char</var>]</samp>’</dt>
|
jpayne@68
|
463 <dd><a name="IDX989"></a>
|
jpayne@68
|
464 <a name="IDX990"></a>
|
jpayne@68
|
465 <a name="IDX991"></a>
|
jpayne@68
|
466 <a name="IDX992"></a>
|
jpayne@68
|
467 <p>Check presence of keyboard accelerators for menu items. This is based on
|
jpayne@68
|
468 the convention used in some GUIs that a keyboard accelerator in a menu
|
jpayne@68
|
469 item string is designated by an immediately preceding ‘<samp>&</samp>’ character.
|
jpayne@68
|
470 Sometimes a keyboard accelerator is also called "keyboard mnemonic".
|
jpayne@68
|
471 This check verifies that if the untranslated string has exactly one
|
jpayne@68
|
472 ‘<samp>&</samp>’ character, the translated string has exactly one ‘<samp>&</samp>’ as well.
|
jpayne@68
|
473 If this option is given with a <var>char</var> argument, this <var>char</var> should
|
jpayne@68
|
474 be a non-alphanumeric character and is used as keyboard accelerator mark
|
jpayne@68
|
475 instead of ‘<samp>&</samp>’.
|
jpayne@68
|
476 </p>
|
jpayne@68
|
477 </dd>
|
jpayne@68
|
478 <dt> ‘<samp>-f</samp>’</dt>
|
jpayne@68
|
479 <dt> ‘<samp>--use-fuzzy</samp>’</dt>
|
jpayne@68
|
480 <dd><a name="IDX993"></a>
|
jpayne@68
|
481 <a name="IDX994"></a>
|
jpayne@68
|
482 <a name="IDX995"></a>
|
jpayne@68
|
483 <p>Use fuzzy entries in output. Note that using this option is usually wrong,
|
jpayne@68
|
484 because fuzzy messages are exactly those which have not been validated by
|
jpayne@68
|
485 a human translator.
|
jpayne@68
|
486 </p>
|
jpayne@68
|
487 </dd>
|
jpayne@68
|
488 </dl>
|
jpayne@68
|
489
|
jpayne@68
|
490
|
jpayne@68
|
491 <a name="SEC185"></a>
|
jpayne@68
|
492 <h3 class="subsection"> <a href="gettext_toc.html#TOC178">10.1.11 Output details</a> </h3>
|
jpayne@68
|
493
|
jpayne@68
|
494 <dl compact="compact">
|
jpayne@68
|
495 <dt> ‘<samp>--no-convert</samp>’</dt>
|
jpayne@68
|
496 <dd><a name="IDX996"></a>
|
jpayne@68
|
497 <p>Don't convert the messages to UTF-8 encoding. By default, messages are
|
jpayne@68
|
498 converted to UTF-8 encoding before being stored in a MO file; this helps
|
jpayne@68
|
499 avoiding conversions at run time, since nowadays most locales use the
|
jpayne@68
|
500 UTF-8 encoding.
|
jpayne@68
|
501 </p>
|
jpayne@68
|
502 </dd>
|
jpayne@68
|
503 <dt> ‘<samp>--no-redundancy</samp>’</dt>
|
jpayne@68
|
504 <dd><a name="IDX997"></a>
|
jpayne@68
|
505 <p>Don't pre-expand ISO C 99 <inttypes.h> format string directive macros.
|
jpayne@68
|
506 By default, messages that are marked as <code>c-format</code> and contain
|
jpayne@68
|
507 ISO C 99 <inttypes.h> format string directive macros are pre-expanded
|
jpayne@68
|
508 for selected platforms, and these redundant expansions are stored in the
|
jpayne@68
|
509 MO file. These redundant expansions make the translations of these
|
jpayne@68
|
510 messages work with the <code>gettext</code> implementation in the <code>libc</code>
|
jpayne@68
|
511 of that platform, without requiring GNU <code>gettext</code>'s <code>libintl</code>.
|
jpayne@68
|
512 The platforms that benefit from this pre-expansion are those with the
|
jpayne@68
|
513 musl libc.
|
jpayne@68
|
514 </p>
|
jpayne@68
|
515 </dd>
|
jpayne@68
|
516 <dt> ‘<samp>-a <var>number</var></samp>’</dt>
|
jpayne@68
|
517 <dt> ‘<samp>--alignment=<var>number</var></samp>’</dt>
|
jpayne@68
|
518 <dd><a name="IDX998"></a>
|
jpayne@68
|
519 <a name="IDX999"></a>
|
jpayne@68
|
520 <p>Align strings to <var>number</var> bytes (default: 1).
|
jpayne@68
|
521 </p>
|
jpayne@68
|
522 </dd>
|
jpayne@68
|
523 <dt> ‘<samp>--endianness=<var>byteorder</var></samp>’</dt>
|
jpayne@68
|
524 <dd><a name="IDX1000"></a>
|
jpayne@68
|
525 <p>Write out 32-bit numbers in the given byte order. The possible values are
|
jpayne@68
|
526 <code>big</code> and <code>little</code>. The default is <code>little</code>.
|
jpayne@68
|
527 </p>
|
jpayne@68
|
528 <p>MO files of any endianness can be used on any platform. When a MO file has
|
jpayne@68
|
529 an endianness other than the platform's one, the 32-bit numbers from the MO
|
jpayne@68
|
530 file are swapped at runtime. The performance impact is negligible.
|
jpayne@68
|
531 </p>
|
jpayne@68
|
532 <p>This option can be useful to produce MO files that are optimized for one
|
jpayne@68
|
533 platform.
|
jpayne@68
|
534 </p>
|
jpayne@68
|
535 </dd>
|
jpayne@68
|
536 <dt> ‘<samp>--no-hash</samp>’</dt>
|
jpayne@68
|
537 <dd><a name="IDX1001"></a>
|
jpayne@68
|
538 <p>Don't include a hash table in the binary file. Lookup will be more expensive
|
jpayne@68
|
539 at run time (binary search instead of hash table lookup).
|
jpayne@68
|
540 </p>
|
jpayne@68
|
541 </dd>
|
jpayne@68
|
542 </dl>
|
jpayne@68
|
543
|
jpayne@68
|
544
|
jpayne@68
|
545 <a name="SEC186"></a>
|
jpayne@68
|
546 <h3 class="subsection"> <a href="gettext_toc.html#TOC179">10.1.12 Informative output</a> </h3>
|
jpayne@68
|
547
|
jpayne@68
|
548 <dl compact="compact">
|
jpayne@68
|
549 <dt> ‘<samp>-h</samp>’</dt>
|
jpayne@68
|
550 <dt> ‘<samp>--help</samp>’</dt>
|
jpayne@68
|
551 <dd><a name="IDX1002"></a>
|
jpayne@68
|
552 <a name="IDX1003"></a>
|
jpayne@68
|
553 <p>Display this help and exit.
|
jpayne@68
|
554 </p>
|
jpayne@68
|
555 </dd>
|
jpayne@68
|
556 <dt> ‘<samp>-V</samp>’</dt>
|
jpayne@68
|
557 <dt> ‘<samp>--version</samp>’</dt>
|
jpayne@68
|
558 <dd><a name="IDX1004"></a>
|
jpayne@68
|
559 <a name="IDX1005"></a>
|
jpayne@68
|
560 <p>Output version information and exit.
|
jpayne@68
|
561 </p>
|
jpayne@68
|
562 </dd>
|
jpayne@68
|
563 <dt> ‘<samp>--statistics</samp>’</dt>
|
jpayne@68
|
564 <dd><a name="IDX1006"></a>
|
jpayne@68
|
565 <p>Print statistics about translations. When the option <code>--verbose</code> is used
|
jpayne@68
|
566 in combination with <code>--statistics</code>, the input file name is printed in
|
jpayne@68
|
567 front of the statistics line.
|
jpayne@68
|
568 </p>
|
jpayne@68
|
569 </dd>
|
jpayne@68
|
570 <dt> ‘<samp>-v</samp>’</dt>
|
jpayne@68
|
571 <dt> ‘<samp>--verbose</samp>’</dt>
|
jpayne@68
|
572 <dd><a name="IDX1007"></a>
|
jpayne@68
|
573 <a name="IDX1008"></a>
|
jpayne@68
|
574 <p>Increase verbosity level.
|
jpayne@68
|
575 </p>
|
jpayne@68
|
576 </dd>
|
jpayne@68
|
577 </dl>
|
jpayne@68
|
578
|
jpayne@68
|
579
|
jpayne@68
|
580 <a name="msgunfmt-Invocation"></a>
|
jpayne@68
|
581 <a name="SEC187"></a>
|
jpayne@68
|
582 <h2 class="section"> <a href="gettext_toc.html#TOC180">10.2 Invoking the <code>msgunfmt</code> Program</a> </h2>
|
jpayne@68
|
583
|
jpayne@68
|
584
|
jpayne@68
|
585 <table><tr><td> </td><td><pre class="example">msgunfmt [<var>option</var>] [<var>file</var>]...
|
jpayne@68
|
586 </pre></td></tr></table>
|
jpayne@68
|
587
|
jpayne@68
|
588 <a name="IDX1009"></a>
|
jpayne@68
|
589 <p>The <code>msgunfmt</code> program converts a binary message catalog to a
|
jpayne@68
|
590 Uniforum style .po file.
|
jpayne@68
|
591 </p>
|
jpayne@68
|
592
|
jpayne@68
|
593 <a name="SEC188"></a>
|
jpayne@68
|
594 <h3 class="subsection"> <a href="gettext_toc.html#TOC181">10.2.1 Operation mode</a> </h3>
|
jpayne@68
|
595
|
jpayne@68
|
596 <dl compact="compact">
|
jpayne@68
|
597 <dt> ‘<samp>-j</samp>’</dt>
|
jpayne@68
|
598 <dt> ‘<samp>--java</samp>’</dt>
|
jpayne@68
|
599 <dd><a name="IDX1010"></a>
|
jpayne@68
|
600 <a name="IDX1011"></a>
|
jpayne@68
|
601 <a name="IDX1012"></a>
|
jpayne@68
|
602 <p>Java mode: input is a Java <code>ResourceBundle</code> class.
|
jpayne@68
|
603 </p>
|
jpayne@68
|
604 </dd>
|
jpayne@68
|
605 <dt> ‘<samp>--csharp</samp>’</dt>
|
jpayne@68
|
606 <dd><a name="IDX1013"></a>
|
jpayne@68
|
607 <a name="IDX1014"></a>
|
jpayne@68
|
608 <p>C# mode: input is a .NET .dll file containing a subclass of
|
jpayne@68
|
609 <code>GettextResourceSet</code>.
|
jpayne@68
|
610 </p>
|
jpayne@68
|
611 </dd>
|
jpayne@68
|
612 <dt> ‘<samp>--csharp-resources</samp>’</dt>
|
jpayne@68
|
613 <dd><a name="IDX1015"></a>
|
jpayne@68
|
614 <a name="IDX1016"></a>
|
jpayne@68
|
615 <p>C# resources mode: input is a .NET ‘<tt>.resources</tt>’ file.
|
jpayne@68
|
616 </p>
|
jpayne@68
|
617 </dd>
|
jpayne@68
|
618 <dt> ‘<samp>--tcl</samp>’</dt>
|
jpayne@68
|
619 <dd><a name="IDX1017"></a>
|
jpayne@68
|
620 <a name="IDX1018"></a>
|
jpayne@68
|
621 <p>Tcl mode: input is a tcl/msgcat ‘<tt>.msg</tt>’ file.
|
jpayne@68
|
622 </p>
|
jpayne@68
|
623 </dd>
|
jpayne@68
|
624 </dl>
|
jpayne@68
|
625
|
jpayne@68
|
626
|
jpayne@68
|
627 <a name="SEC189"></a>
|
jpayne@68
|
628 <h3 class="subsection"> <a href="gettext_toc.html#TOC182">10.2.2 Input file location</a> </h3>
|
jpayne@68
|
629
|
jpayne@68
|
630 <dl compact="compact">
|
jpayne@68
|
631 <dt> ‘<samp><var>file</var> …</samp>’</dt>
|
jpayne@68
|
632 <dd><p>Input .mo files.
|
jpayne@68
|
633 </p>
|
jpayne@68
|
634 </dd>
|
jpayne@68
|
635 </dl>
|
jpayne@68
|
636
|
jpayne@68
|
637 <p>If no input <var>file</var> is given or if it is ‘<samp>-</samp>’, standard input is read.
|
jpayne@68
|
638 </p>
|
jpayne@68
|
639
|
jpayne@68
|
640 <a name="SEC190"></a>
|
jpayne@68
|
641 <h3 class="subsection"> <a href="gettext_toc.html#TOC183">10.2.3 Input file location in Java mode</a> </h3>
|
jpayne@68
|
642
|
jpayne@68
|
643 <dl compact="compact">
|
jpayne@68
|
644 <dt> ‘<samp>-r <var>resource</var></samp>’</dt>
|
jpayne@68
|
645 <dt> ‘<samp>--resource=<var>resource</var></samp>’</dt>
|
jpayne@68
|
646 <dd><a name="IDX1019"></a>
|
jpayne@68
|
647 <a name="IDX1020"></a>
|
jpayne@68
|
648 <p>Specify the resource name.
|
jpayne@68
|
649 </p>
|
jpayne@68
|
650 </dd>
|
jpayne@68
|
651 <dt> ‘<samp>-l <var>locale</var></samp>’</dt>
|
jpayne@68
|
652 <dt> ‘<samp>--locale=<var>locale</var></samp>’</dt>
|
jpayne@68
|
653 <dd><a name="IDX1021"></a>
|
jpayne@68
|
654 <a name="IDX1022"></a>
|
jpayne@68
|
655 <p>Specify the locale name, either a language specification of the form <var>ll</var>
|
jpayne@68
|
656 or a combined language and country specification of the form <var>ll_CC</var>.
|
jpayne@68
|
657 </p>
|
jpayne@68
|
658 </dd>
|
jpayne@68
|
659 </dl>
|
jpayne@68
|
660
|
jpayne@68
|
661 <p>The class name is determined by appending the locale name to the resource name,
|
jpayne@68
|
662 separated with an underscore. The class is located using the <code>CLASSPATH</code>.
|
jpayne@68
|
663 </p>
|
jpayne@68
|
664
|
jpayne@68
|
665 <a name="SEC191"></a>
|
jpayne@68
|
666 <h3 class="subsection"> <a href="gettext_toc.html#TOC184">10.2.4 Input file location in C# mode</a> </h3>
|
jpayne@68
|
667
|
jpayne@68
|
668 <dl compact="compact">
|
jpayne@68
|
669 <dt> ‘<samp>-r <var>resource</var></samp>’</dt>
|
jpayne@68
|
670 <dt> ‘<samp>--resource=<var>resource</var></samp>’</dt>
|
jpayne@68
|
671 <dd><a name="IDX1023"></a>
|
jpayne@68
|
672 <a name="IDX1024"></a>
|
jpayne@68
|
673 <p>Specify the resource name.
|
jpayne@68
|
674 </p>
|
jpayne@68
|
675 </dd>
|
jpayne@68
|
676 <dt> ‘<samp>-l <var>locale</var></samp>’</dt>
|
jpayne@68
|
677 <dt> ‘<samp>--locale=<var>locale</var></samp>’</dt>
|
jpayne@68
|
678 <dd><a name="IDX1025"></a>
|
jpayne@68
|
679 <a name="IDX1026"></a>
|
jpayne@68
|
680 <p>Specify the locale name, either a language specification of the form <var>ll</var>
|
jpayne@68
|
681 or a combined language and country specification of the form <var>ll_CC</var>.
|
jpayne@68
|
682 </p>
|
jpayne@68
|
683 </dd>
|
jpayne@68
|
684 <dt> ‘<samp>-d <var>directory</var></samp>’</dt>
|
jpayne@68
|
685 <dd><a name="IDX1027"></a>
|
jpayne@68
|
686 <p>Specify the base directory for locale dependent ‘<tt>.dll</tt>’ files.
|
jpayne@68
|
687 </p>
|
jpayne@68
|
688 </dd>
|
jpayne@68
|
689 </dl>
|
jpayne@68
|
690
|
jpayne@68
|
691 <p>The ‘<samp>-l</samp>’ and ‘<samp>-d</samp>’ options are mandatory. The ‘<tt>.msg</tt>’ file is
|
jpayne@68
|
692 located in a subdirectory of the specified directory whose name depends on the
|
jpayne@68
|
693 locale.
|
jpayne@68
|
694 </p>
|
jpayne@68
|
695
|
jpayne@68
|
696 <a name="SEC192"></a>
|
jpayne@68
|
697 <h3 class="subsection"> <a href="gettext_toc.html#TOC185">10.2.5 Input file location in Tcl mode</a> </h3>
|
jpayne@68
|
698
|
jpayne@68
|
699 <dl compact="compact">
|
jpayne@68
|
700 <dt> ‘<samp>-l <var>locale</var></samp>’</dt>
|
jpayne@68
|
701 <dt> ‘<samp>--locale=<var>locale</var></samp>’</dt>
|
jpayne@68
|
702 <dd><a name="IDX1028"></a>
|
jpayne@68
|
703 <a name="IDX1029"></a>
|
jpayne@68
|
704 <p>Specify the locale name, either a language specification of the form <var>ll</var>
|
jpayne@68
|
705 or a combined language and country specification of the form <var>ll_CC</var>.
|
jpayne@68
|
706 </p>
|
jpayne@68
|
707 </dd>
|
jpayne@68
|
708 <dt> ‘<samp>-d <var>directory</var></samp>’</dt>
|
jpayne@68
|
709 <dd><a name="IDX1030"></a>
|
jpayne@68
|
710 <p>Specify the base directory of ‘<tt>.msg</tt>’ message catalogs.
|
jpayne@68
|
711 </p>
|
jpayne@68
|
712 </dd>
|
jpayne@68
|
713 </dl>
|
jpayne@68
|
714
|
jpayne@68
|
715 <p>The ‘<samp>-l</samp>’ and ‘<samp>-d</samp>’ options are mandatory. The ‘<tt>.msg</tt>’ file is
|
jpayne@68
|
716 located in the specified directory.
|
jpayne@68
|
717 </p>
|
jpayne@68
|
718
|
jpayne@68
|
719 <a name="SEC193"></a>
|
jpayne@68
|
720 <h3 class="subsection"> <a href="gettext_toc.html#TOC186">10.2.6 Output file location</a> </h3>
|
jpayne@68
|
721
|
jpayne@68
|
722 <dl compact="compact">
|
jpayne@68
|
723 <dt> ‘<samp>-o <var>file</var></samp>’</dt>
|
jpayne@68
|
724 <dt> ‘<samp>--output-file=<var>file</var></samp>’</dt>
|
jpayne@68
|
725 <dd><a name="IDX1031"></a>
|
jpayne@68
|
726 <a name="IDX1032"></a>
|
jpayne@68
|
727 <p>Write output to specified file.
|
jpayne@68
|
728 </p>
|
jpayne@68
|
729 </dd>
|
jpayne@68
|
730 </dl>
|
jpayne@68
|
731
|
jpayne@68
|
732 <p>The results are written to standard output if no output file is specified
|
jpayne@68
|
733 or if it is ‘<samp>-</samp>’.
|
jpayne@68
|
734 </p>
|
jpayne@68
|
735
|
jpayne@68
|
736 <a name="SEC194"></a>
|
jpayne@68
|
737 <h3 class="subsection"> <a href="gettext_toc.html#TOC187">10.2.7 Output details</a> </h3>
|
jpayne@68
|
738
|
jpayne@68
|
739
|
jpayne@68
|
740 <dl compact="compact">
|
jpayne@68
|
741 <dt> ‘<samp>--color</samp>’</dt>
|
jpayne@68
|
742 <dt> ‘<samp>--color=<var>when</var></samp>’</dt>
|
jpayne@68
|
743 <dd><a name="IDX1033"></a>
|
jpayne@68
|
744 <p>Specify whether or when to use colors and other text attributes.
|
jpayne@68
|
745 See <a href="gettext_9.html#SEC158">The <code>--color</code> option</a> for details.
|
jpayne@68
|
746 </p>
|
jpayne@68
|
747 </dd>
|
jpayne@68
|
748 <dt> ‘<samp>--style=<var>style_file</var></samp>’</dt>
|
jpayne@68
|
749 <dd><a name="IDX1034"></a>
|
jpayne@68
|
750 <p>Specify the CSS style rule file to use for <code>--color</code>.
|
jpayne@68
|
751 See <a href="gettext_9.html#SEC160">The <code>--style</code> option</a> for details.
|
jpayne@68
|
752 </p>
|
jpayne@68
|
753 </dd>
|
jpayne@68
|
754 <dt> ‘<samp>--force-po</samp>’</dt>
|
jpayne@68
|
755 <dd><a name="IDX1035"></a>
|
jpayne@68
|
756 <p>Always write an output file even if it contains no message.
|
jpayne@68
|
757 </p>
|
jpayne@68
|
758 </dd>
|
jpayne@68
|
759 <dt> ‘<samp>-i</samp>’</dt>
|
jpayne@68
|
760 <dt> ‘<samp>--indent</samp>’</dt>
|
jpayne@68
|
761 <dd><a name="IDX1036"></a>
|
jpayne@68
|
762 <a name="IDX1037"></a>
|
jpayne@68
|
763 <p>Write the .po file using indented style.
|
jpayne@68
|
764 </p>
|
jpayne@68
|
765 </dd>
|
jpayne@68
|
766 <dt> ‘<samp>--strict</samp>’</dt>
|
jpayne@68
|
767 <dd><a name="IDX1038"></a>
|
jpayne@68
|
768 <p>Write out a strict Uniforum conforming PO file. Note that this
|
jpayne@68
|
769 Uniforum format should be avoided because it doesn't support the
|
jpayne@68
|
770 GNU extensions.
|
jpayne@68
|
771 </p>
|
jpayne@68
|
772 </dd>
|
jpayne@68
|
773 <dt> ‘<samp>-p</samp>’</dt>
|
jpayne@68
|
774 <dt> ‘<samp>--properties-output</samp>’</dt>
|
jpayne@68
|
775 <dd><a name="IDX1039"></a>
|
jpayne@68
|
776 <a name="IDX1040"></a>
|
jpayne@68
|
777 <p>Write out a Java ResourceBundle in Java <code>.properties</code> syntax. Note
|
jpayne@68
|
778 that this file format doesn't support plural forms and silently drops
|
jpayne@68
|
779 obsolete messages.
|
jpayne@68
|
780 </p>
|
jpayne@68
|
781 </dd>
|
jpayne@68
|
782 <dt> ‘<samp>--stringtable-output</samp>’</dt>
|
jpayne@68
|
783 <dd><a name="IDX1041"></a>
|
jpayne@68
|
784 <p>Write out a NeXTstep/GNUstep localized resource file in <code>.strings</code> syntax.
|
jpayne@68
|
785 Note that this file format doesn't support plural forms.
|
jpayne@68
|
786 </p>
|
jpayne@68
|
787 </dd>
|
jpayne@68
|
788 <dt> ‘<samp>-w <var>number</var></samp>’</dt>
|
jpayne@68
|
789 <dt> ‘<samp>--width=<var>number</var></samp>’</dt>
|
jpayne@68
|
790 <dd><a name="IDX1042"></a>
|
jpayne@68
|
791 <a name="IDX1043"></a>
|
jpayne@68
|
792 <p>Set the output page width. Long strings in the output files will be
|
jpayne@68
|
793 split across multiple lines in order to ensure that each line's width
|
jpayne@68
|
794 (= number of screen columns) is less or equal to the given <var>number</var>.
|
jpayne@68
|
795 </p>
|
jpayne@68
|
796 </dd>
|
jpayne@68
|
797 <dt> ‘<samp>--no-wrap</samp>’</dt>
|
jpayne@68
|
798 <dd><a name="IDX1044"></a>
|
jpayne@68
|
799 <p>Do not break long message lines. Message lines whose width exceeds the
|
jpayne@68
|
800 output page width will not be split into several lines. Only file reference
|
jpayne@68
|
801 lines which are wider than the output page width will be split.
|
jpayne@68
|
802 </p>
|
jpayne@68
|
803 </dd>
|
jpayne@68
|
804 <dt> ‘<samp>-s</samp>’</dt>
|
jpayne@68
|
805 <dt> ‘<samp>--sort-output</samp>’</dt>
|
jpayne@68
|
806 <dd><a name="IDX1045"></a>
|
jpayne@68
|
807 <a name="IDX1046"></a>
|
jpayne@68
|
808 <a name="IDX1047"></a>
|
jpayne@68
|
809 <p>Generate sorted output. Note that using this option makes it much harder
|
jpayne@68
|
810 for the translator to understand each message's context.
|
jpayne@68
|
811 </p>
|
jpayne@68
|
812 </dd>
|
jpayne@68
|
813 </dl>
|
jpayne@68
|
814
|
jpayne@68
|
815
|
jpayne@68
|
816 <a name="SEC195"></a>
|
jpayne@68
|
817 <h3 class="subsection"> <a href="gettext_toc.html#TOC188">10.2.8 Informative output</a> </h3>
|
jpayne@68
|
818
|
jpayne@68
|
819 <dl compact="compact">
|
jpayne@68
|
820 <dt> ‘<samp>-h</samp>’</dt>
|
jpayne@68
|
821 <dt> ‘<samp>--help</samp>’</dt>
|
jpayne@68
|
822 <dd><a name="IDX1048"></a>
|
jpayne@68
|
823 <a name="IDX1049"></a>
|
jpayne@68
|
824 <p>Display this help and exit.
|
jpayne@68
|
825 </p>
|
jpayne@68
|
826 </dd>
|
jpayne@68
|
827 <dt> ‘<samp>-V</samp>’</dt>
|
jpayne@68
|
828 <dt> ‘<samp>--version</samp>’</dt>
|
jpayne@68
|
829 <dd><a name="IDX1050"></a>
|
jpayne@68
|
830 <a name="IDX1051"></a>
|
jpayne@68
|
831 <p>Output version information and exit.
|
jpayne@68
|
832 </p>
|
jpayne@68
|
833 </dd>
|
jpayne@68
|
834 <dt> ‘<samp>-v</samp>’</dt>
|
jpayne@68
|
835 <dt> ‘<samp>--verbose</samp>’</dt>
|
jpayne@68
|
836 <dd><a name="IDX1052"></a>
|
jpayne@68
|
837 <a name="IDX1053"></a>
|
jpayne@68
|
838 <p>Increase verbosity level.
|
jpayne@68
|
839 </p>
|
jpayne@68
|
840 </dd>
|
jpayne@68
|
841 </dl>
|
jpayne@68
|
842
|
jpayne@68
|
843
|
jpayne@68
|
844 <a name="MO-Files"></a>
|
jpayne@68
|
845 <a name="SEC196"></a>
|
jpayne@68
|
846 <h2 class="section"> <a href="gettext_toc.html#TOC189">10.3 The Format of GNU MO Files</a> </h2>
|
jpayne@68
|
847
|
jpayne@68
|
848 <p>The format of the generated MO files is best described by a picture,
|
jpayne@68
|
849 which appears below.
|
jpayne@68
|
850 </p>
|
jpayne@68
|
851 <a name="IDX1054"></a>
|
jpayne@68
|
852 <p>The first two words serve the identification of the file. The magic
|
jpayne@68
|
853 number will always signal GNU MO files. The number is stored in the
|
jpayne@68
|
854 byte order used when the MO file was generated, so the magic number
|
jpayne@68
|
855 really is two numbers: <code>0x950412de</code> and <code>0xde120495</code>.
|
jpayne@68
|
856 </p>
|
jpayne@68
|
857 <p>The second word describes the current revision of the file format,
|
jpayne@68
|
858 composed of a major and a minor revision number. The revision numbers
|
jpayne@68
|
859 ensure that the readers of MO files can distinguish new formats from
|
jpayne@68
|
860 old ones and handle their contents, as far as possible. For now the
|
jpayne@68
|
861 major revision is 0 or 1, and the minor revision is also 0 or 1. More
|
jpayne@68
|
862 revisions might be added in the future. A program seeing an unexpected
|
jpayne@68
|
863 major revision number should stop reading the MO file entirely; whereas
|
jpayne@68
|
864 an unexpected minor revision number means that the file can be read but
|
jpayne@68
|
865 will not reveal its full contents, when parsed by a program that
|
jpayne@68
|
866 supports only smaller minor revision numbers.
|
jpayne@68
|
867 </p>
|
jpayne@68
|
868 <p>The version is kept
|
jpayne@68
|
869 separate from the magic number, instead of using different magic
|
jpayne@68
|
870 numbers for different formats, mainly because ‘<tt>/etc/magic</tt>’ is
|
jpayne@68
|
871 not updated often.
|
jpayne@68
|
872 </p>
|
jpayne@68
|
873 <p>Follow a number of pointers to later tables in the file, allowing
|
jpayne@68
|
874 for the extension of the prefix part of MO files without having to
|
jpayne@68
|
875 recompile programs reading them. This might become useful for later
|
jpayne@68
|
876 inserting a few flag bits, indication about the charset used, new
|
jpayne@68
|
877 tables, or other things.
|
jpayne@68
|
878 </p>
|
jpayne@68
|
879 <p>Then, at offset <var>O</var> and offset <var>T</var> in the picture, two tables
|
jpayne@68
|
880 of string descriptors can be found. In both tables, each string
|
jpayne@68
|
881 descriptor uses two 32 bits integers, one for the string length,
|
jpayne@68
|
882 another for the offset of the string in the MO file, counting in bytes
|
jpayne@68
|
883 from the start of the file. The first table contains descriptors
|
jpayne@68
|
884 for the original strings, and is sorted so the original strings
|
jpayne@68
|
885 are in increasing lexicographical order. The second table contains
|
jpayne@68
|
886 descriptors for the translated strings, and is parallel to the first
|
jpayne@68
|
887 table: to find the corresponding translation one has to access the
|
jpayne@68
|
888 array slot in the second array with the same index.
|
jpayne@68
|
889 </p>
|
jpayne@68
|
890 <p>Having the original strings sorted enables the use of simple binary
|
jpayne@68
|
891 search, for when the MO file does not contain an hashing table, or
|
jpayne@68
|
892 for when it is not practical to use the hashing table provided in
|
jpayne@68
|
893 the MO file. This also has another advantage, as the empty string
|
jpayne@68
|
894 in a PO file GNU <code>gettext</code> is usually <em>translated</em> into
|
jpayne@68
|
895 some system information attached to that particular MO file, and the
|
jpayne@68
|
896 empty string necessarily becomes the first in both the original and
|
jpayne@68
|
897 translated tables, making the system information very easy to find.
|
jpayne@68
|
898 </p>
|
jpayne@68
|
899 <a name="IDX1055"></a>
|
jpayne@68
|
900 <p>The size <var>S</var> of the hash table can be zero. In this case, the
|
jpayne@68
|
901 hash table itself is not contained in the MO file. Some people might
|
jpayne@68
|
902 prefer this because a precomputed hashing table takes disk space, and
|
jpayne@68
|
903 does not win <em>that</em> much speed. The hash table contains indices
|
jpayne@68
|
904 to the sorted array of strings in the MO file. Conflict resolution is
|
jpayne@68
|
905 done by double hashing. The precise hashing algorithm used is fairly
|
jpayne@68
|
906 dependent on GNU <code>gettext</code> code, and is not documented here.
|
jpayne@68
|
907 </p>
|
jpayne@68
|
908 <p>As for the strings themselves, they follow the hash file, and each
|
jpayne@68
|
909 is terminated with a <NUL>, and this <NUL> is not counted in
|
jpayne@68
|
910 the length which appears in the string descriptor. The <code>msgfmt</code>
|
jpayne@68
|
911 program has an option selecting the alignment for MO file strings.
|
jpayne@68
|
912 With this option, each string is separately aligned so it starts at
|
jpayne@68
|
913 an offset which is a multiple of the alignment value. On some RISC
|
jpayne@68
|
914 machines, a correct alignment will speed things up.
|
jpayne@68
|
915 </p>
|
jpayne@68
|
916 <a name="IDX1056"></a>
|
jpayne@68
|
917 <p>Contexts are stored by storing the concatenation of the context, a
|
jpayne@68
|
918 <EOT> byte, and the original string, instead of the original string.
|
jpayne@68
|
919 </p>
|
jpayne@68
|
920 <a name="IDX1057"></a>
|
jpayne@68
|
921 <p>Plural forms are stored by letting the plural of the original string
|
jpayne@68
|
922 follow the singular of the original string, separated through a
|
jpayne@68
|
923 <NUL> byte. The length which appears in the string descriptor
|
jpayne@68
|
924 includes both. However, only the singular of the original string
|
jpayne@68
|
925 takes part in the hash table lookup. The plural variants of the
|
jpayne@68
|
926 translation are all stored consecutively, separated through a
|
jpayne@68
|
927 <NUL> byte. Here also, the length in the string descriptor
|
jpayne@68
|
928 includes all of them.
|
jpayne@68
|
929 </p>
|
jpayne@68
|
930 <a name="IDX1058"></a>
|
jpayne@68
|
931 <p>The character encoding of the strings can be any standard ASCII-compatible
|
jpayne@68
|
932 encoding, such as UTF-8, ISO-8859-1, EUC-JP, etc., as long as the
|
jpayne@68
|
933 encoding's name is stated in the header entry (see section <a href="gettext_6.html#SEC52">Filling in the Header Entry</a>).
|
jpayne@68
|
934 Starting with GNU <code>gettext</code> version 0.22, the MO files produced by
|
jpayne@68
|
935 <code>msgfmt</code> have them in UTF-8 encoding, unless the <code>msgfmt</code>
|
jpayne@68
|
936 option ‘<samp>--no-convert</samp>’ is used.
|
jpayne@68
|
937 </p>
|
jpayne@68
|
938 <p>Nothing prevents a MO file from having embedded <NUL>s in strings.
|
jpayne@68
|
939 However, the program interface currently used already presumes
|
jpayne@68
|
940 that strings are <NUL> terminated, so embedded <NUL>s are
|
jpayne@68
|
941 somewhat useless. But the MO file format is general enough so other
|
jpayne@68
|
942 interfaces would be later possible, if for example, we ever want to
|
jpayne@68
|
943 implement wide characters right in MO files, where <NUL> bytes may
|
jpayne@68
|
944 accidentally appear. (No, we don't want to have wide characters in MO
|
jpayne@68
|
945 files. They would make the file unnecessarily large, and the
|
jpayne@68
|
946 ‘<samp>wchar_t</samp>’ type being platform dependent, MO files would be
|
jpayne@68
|
947 platform dependent as well.)
|
jpayne@68
|
948 </p>
|
jpayne@68
|
949 <p>This particular issue has been strongly debated in the GNU
|
jpayne@68
|
950 <code>gettext</code> development forum, and it is expectable that MO file
|
jpayne@68
|
951 format will evolve or change over time. It is even possible that many
|
jpayne@68
|
952 formats may later be supported concurrently. But surely, we have to
|
jpayne@68
|
953 start somewhere, and the MO file format described here is a good start.
|
jpayne@68
|
954 Nothing is cast in concrete, and the format may later evolve fairly
|
jpayne@68
|
955 easily, so we should feel comfortable with the current approach.
|
jpayne@68
|
956 </p>
|
jpayne@68
|
957 <table><tr><td> </td><td><pre class="example"> byte
|
jpayne@68
|
958 +------------------------------------------+
|
jpayne@68
|
959 0 | magic number = 0x950412de |
|
jpayne@68
|
960 | |
|
jpayne@68
|
961 4 | file format revision = 0 |
|
jpayne@68
|
962 | |
|
jpayne@68
|
963 8 | number of strings | == N
|
jpayne@68
|
964 | |
|
jpayne@68
|
965 12 | offset of table with original strings | == O
|
jpayne@68
|
966 | |
|
jpayne@68
|
967 16 | offset of table with translation strings | == T
|
jpayne@68
|
968 | |
|
jpayne@68
|
969 20 | size of hashing table | == S
|
jpayne@68
|
970 | |
|
jpayne@68
|
971 24 | offset of hashing table | == H
|
jpayne@68
|
972 | |
|
jpayne@68
|
973 . .
|
jpayne@68
|
974 . (possibly more entries later) .
|
jpayne@68
|
975 . .
|
jpayne@68
|
976 | |
|
jpayne@68
|
977 O | length & offset 0th string ----------------.
|
jpayne@68
|
978 O + 8 | length & offset 1st string ------------------.
|
jpayne@68
|
979 ... ... | |
|
jpayne@68
|
980 O + ((N-1)*8)| length & offset (N-1)th string | | |
|
jpayne@68
|
981 | | | |
|
jpayne@68
|
982 T | length & offset 0th translation ---------------.
|
jpayne@68
|
983 T + 8 | length & offset 1st translation -----------------.
|
jpayne@68
|
984 ... ... | | | |
|
jpayne@68
|
985 T + ((N-1)*8)| length & offset (N-1)th translation | | | | |
|
jpayne@68
|
986 | | | | | |
|
jpayne@68
|
987 H | start hash table | | | | |
|
jpayne@68
|
988 ... ... | | | |
|
jpayne@68
|
989 H + S * 4 | end hash table | | | | |
|
jpayne@68
|
990 | | | | | |
|
jpayne@68
|
991 | NUL terminated 0th string <----------------' | | |
|
jpayne@68
|
992 | | | | |
|
jpayne@68
|
993 | NUL terminated 1st string <------------------' | |
|
jpayne@68
|
994 | | | |
|
jpayne@68
|
995 ... ... | |
|
jpayne@68
|
996 | | | |
|
jpayne@68
|
997 | NUL terminated 0th translation <---------------' |
|
jpayne@68
|
998 | | |
|
jpayne@68
|
999 | NUL terminated 1st translation <-----------------'
|
jpayne@68
|
1000 | |
|
jpayne@68
|
1001 ... ...
|
jpayne@68
|
1002 | |
|
jpayne@68
|
1003 +------------------------------------------+
|
jpayne@68
|
1004 </pre></td></tr></table>
|
jpayne@68
|
1005
|
jpayne@68
|
1006
|
jpayne@68
|
1007 <table cellpadding="1" cellspacing="1" border="0">
|
jpayne@68
|
1008 <tr><td valign="middle" align="left">[<a href="#SEC173" title="Beginning of this chapter or previous chapter"> << </a>]</td>
|
jpayne@68
|
1009 <td valign="middle" align="left">[<a href="gettext_11.html#SEC197" title="Next chapter"> >> </a>]</td>
|
jpayne@68
|
1010 <td valign="middle" align="left"> </td>
|
jpayne@68
|
1011 <td valign="middle" align="left"> </td>
|
jpayne@68
|
1012 <td valign="middle" align="left"> </td>
|
jpayne@68
|
1013 <td valign="middle" align="left"> </td>
|
jpayne@68
|
1014 <td valign="middle" align="left"> </td>
|
jpayne@68
|
1015 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
|
jpayne@68
|
1016 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
|
jpayne@68
|
1017 <td valign="middle" align="left">[<a href="gettext_21.html#SEC389" title="Index">Index</a>]</td>
|
jpayne@68
|
1018 <td valign="middle" align="left">[<a href="gettext_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
|
jpayne@68
|
1019 </tr></table>
|
jpayne@68
|
1020 <p>
|
jpayne@68
|
1021 <font size="-1">
|
jpayne@68
|
1022 This document was generated by <em>Bruno Haible</em> on <em>February, 21 2024</em> using <a href="https://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>.
|
jpayne@68
|
1023 </font>
|
jpayne@68
|
1024 <br>
|
jpayne@68
|
1025
|
jpayne@68
|
1026 </p>
|
jpayne@68
|
1027 </body>
|
jpayne@68
|
1028 </html>
|