xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/doc/gettext_10.html (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1*946379e7Schristos<HTML>
2*946379e7Schristos<HEAD>
3*946379e7Schristos<!-- This HTML file has been created by texi2html 1.52b
4*946379e7Schristos     from gettext.texi on 27 November 2006 -->
5*946379e7Schristos
6*946379e7Schristos<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
7*946379e7Schristos<TITLE>GNU gettext utilities - 10  Producing Binary MO Files</TITLE>
8*946379e7Schristos</HEAD>
9*946379e7Schristos<BODY>
10*946379e7SchristosGo to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_9.html">previous</A>, <A HREF="gettext_11.html">next</A>, <A HREF="gettext_25.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>.
11*946379e7Schristos<P><HR><P>
12*946379e7Schristos
13*946379e7Schristos
14*946379e7Schristos<H1><A NAME="SEC142" HREF="gettext_toc.html#TOC142">10  Producing Binary MO Files</A></H1>
15*946379e7Schristos
16*946379e7Schristos
17*946379e7Schristos
18*946379e7Schristos<H2><A NAME="SEC143" HREF="gettext_toc.html#TOC143">10.1  Invoking the <CODE>msgfmt</CODE> Program</A></H2>
19*946379e7Schristos
20*946379e7Schristos<P>
21*946379e7Schristos<A NAME="IDX893"></A>
22*946379e7Schristos<A NAME="IDX894"></A>
23*946379e7Schristos
24*946379e7Schristos<PRE>
25*946379e7Schristosmsgfmt [<VAR>option</VAR>] <VAR>filename</VAR>.po ...
26*946379e7Schristos</PRE>
27*946379e7Schristos
28*946379e7Schristos<P>
29*946379e7Schristos<A NAME="IDX895"></A>
30*946379e7SchristosThe <CODE>msgfmt</CODE> programs generates a binary message catalog from a textual
31*946379e7Schristostranslation description.
32*946379e7Schristos
33*946379e7Schristos</P>
34*946379e7Schristos
35*946379e7Schristos
36*946379e7Schristos<H3><A NAME="SEC144" HREF="gettext_toc.html#TOC144">10.1.1  Input file location</A></H3>
37*946379e7Schristos
38*946379e7Schristos<DL COMPACT>
39*946379e7Schristos
40*946379e7Schristos<DT><SAMP>&lsquo;<VAR>filename</VAR>.po ...&rsquo;</SAMP>
41*946379e7Schristos<DD>
42*946379e7Schristos<DT><SAMP>&lsquo;-D <VAR>directory</VAR>&rsquo;</SAMP>
43*946379e7Schristos<DD>
44*946379e7Schristos<DT><SAMP>&lsquo;--directory=<VAR>directory</VAR>&rsquo;</SAMP>
45*946379e7Schristos<DD>
46*946379e7Schristos<A NAME="IDX896"></A>
47*946379e7Schristos<A NAME="IDX897"></A>
48*946379e7SchristosAdd <VAR>directory</VAR> to the list of directories.  Source files are
49*946379e7Schristossearched relative to this list of directories.  The resulting <TT>&lsquo;.po&rsquo;</TT>
50*946379e7Schristosfile will be written relative to the current directory, though.
51*946379e7Schristos
52*946379e7Schristos</DL>
53*946379e7Schristos
54*946379e7Schristos<P>
55*946379e7SchristosIf an input file is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
56*946379e7Schristos
57*946379e7Schristos</P>
58*946379e7Schristos
59*946379e7Schristos
60*946379e7Schristos<H3><A NAME="SEC145" HREF="gettext_toc.html#TOC145">10.1.2  Operation mode</A></H3>
61*946379e7Schristos
62*946379e7Schristos<DL COMPACT>
63*946379e7Schristos
64*946379e7Schristos<DT><SAMP>&lsquo;-j&rsquo;</SAMP>
65*946379e7Schristos<DD>
66*946379e7Schristos<DT><SAMP>&lsquo;--java&rsquo;</SAMP>
67*946379e7Schristos<DD>
68*946379e7Schristos<A NAME="IDX898"></A>
69*946379e7Schristos<A NAME="IDX899"></A>
70*946379e7Schristos<A NAME="IDX900"></A>
71*946379e7SchristosJava mode: generate a Java <CODE>ResourceBundle</CODE> class.
72*946379e7Schristos
73*946379e7Schristos<DT><SAMP>&lsquo;--java2&rsquo;</SAMP>
74*946379e7Schristos<DD>
75*946379e7Schristos<A NAME="IDX901"></A>
76*946379e7SchristosLike --java, and assume Java2 (JDK 1.2 or higher).
77*946379e7Schristos
78*946379e7Schristos<DT><SAMP>&lsquo;--csharp&rsquo;</SAMP>
79*946379e7Schristos<DD>
80*946379e7Schristos<A NAME="IDX902"></A>
81*946379e7Schristos<A NAME="IDX903"></A>
82*946379e7SchristosC# mode: generate a .NET .dll file containing a subclass of
83*946379e7Schristos<CODE>GettextResourceSet</CODE>.
84*946379e7Schristos
85*946379e7Schristos<DT><SAMP>&lsquo;--csharp-resources&rsquo;</SAMP>
86*946379e7Schristos<DD>
87*946379e7Schristos<A NAME="IDX904"></A>
88*946379e7Schristos<A NAME="IDX905"></A>
89*946379e7SchristosC# resources mode: generate a .NET <TT>&lsquo;.resources&rsquo;</TT> file.
90*946379e7Schristos
91*946379e7Schristos<DT><SAMP>&lsquo;--tcl&rsquo;</SAMP>
92*946379e7Schristos<DD>
93*946379e7Schristos<A NAME="IDX906"></A>
94*946379e7Schristos<A NAME="IDX907"></A>
95*946379e7SchristosTcl mode: generate a tcl/msgcat <TT>&lsquo;.msg&rsquo;</TT> file.
96*946379e7Schristos
97*946379e7Schristos<DT><SAMP>&lsquo;--qt&rsquo;</SAMP>
98*946379e7Schristos<DD>
99*946379e7Schristos<A NAME="IDX908"></A>
100*946379e7Schristos<A NAME="IDX909"></A>
101*946379e7SchristosQt mode: generate a Qt <TT>&lsquo;.qm&rsquo;</TT> file.
102*946379e7Schristos
103*946379e7Schristos</DL>
104*946379e7Schristos
105*946379e7Schristos
106*946379e7Schristos
107*946379e7Schristos<H3><A NAME="SEC146" HREF="gettext_toc.html#TOC146">10.1.3  Output file location</A></H3>
108*946379e7Schristos
109*946379e7Schristos<DL COMPACT>
110*946379e7Schristos
111*946379e7Schristos<DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
112*946379e7Schristos<DD>
113*946379e7Schristos<DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
114*946379e7Schristos<DD>
115*946379e7Schristos<A NAME="IDX910"></A>
116*946379e7Schristos<A NAME="IDX911"></A>
117*946379e7SchristosWrite output to specified file.
118*946379e7Schristos
119*946379e7Schristos<DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
120*946379e7Schristos<DD>
121*946379e7Schristos<A NAME="IDX912"></A>
122*946379e7SchristosDirect the program to work strictly following the Uniforum/Sun
123*946379e7Schristosimplementation.  Currently this only affects the naming of the output
124*946379e7Schristosfile.  If this option is not given the name of the output file is the
125*946379e7Schristossame as the domain name.  If the strict Uniforum mode is enabled the
126*946379e7Schristossuffix <TT>&lsquo;.mo&rsquo;</TT> is added to the file name if it is not already
127*946379e7Schristospresent.
128*946379e7Schristos
129*946379e7SchristosWe find this behaviour of Sun's implementation rather silly and so by
130*946379e7Schristosdefault this mode is <EM>not</EM> selected.
131*946379e7Schristos
132*946379e7Schristos</DL>
133*946379e7Schristos
134*946379e7Schristos<P>
135*946379e7SchristosIf the output <VAR>file</VAR> is <SAMP>&lsquo;-&rsquo;</SAMP>, output is written to standard output.
136*946379e7Schristos
137*946379e7Schristos</P>
138*946379e7Schristos
139*946379e7Schristos
140*946379e7Schristos<H3><A NAME="SEC147" HREF="gettext_toc.html#TOC147">10.1.4  Output file location in Java mode</A></H3>
141*946379e7Schristos
142*946379e7Schristos<DL COMPACT>
143*946379e7Schristos
144*946379e7Schristos<DT><SAMP>&lsquo;-r <VAR>resource</VAR>&rsquo;</SAMP>
145*946379e7Schristos<DD>
146*946379e7Schristos<DT><SAMP>&lsquo;--resource=<VAR>resource</VAR>&rsquo;</SAMP>
147*946379e7Schristos<DD>
148*946379e7Schristos<A NAME="IDX913"></A>
149*946379e7Schristos<A NAME="IDX914"></A>
150*946379e7SchristosSpecify the resource name.
151*946379e7Schristos
152*946379e7Schristos<DT><SAMP>&lsquo;-l <VAR>locale</VAR>&rsquo;</SAMP>
153*946379e7Schristos<DD>
154*946379e7Schristos<DT><SAMP>&lsquo;--locale=<VAR>locale</VAR>&rsquo;</SAMP>
155*946379e7Schristos<DD>
156*946379e7Schristos<A NAME="IDX915"></A>
157*946379e7Schristos<A NAME="IDX916"></A>
158*946379e7SchristosSpecify the locale name, either a language specification of the form <VAR>ll</VAR>
159*946379e7Schristosor a combined language and country specification of the form <VAR>ll_CC</VAR>.
160*946379e7Schristos
161*946379e7Schristos<DT><SAMP>&lsquo;-d <VAR>directory</VAR>&rsquo;</SAMP>
162*946379e7Schristos<DD>
163*946379e7Schristos<A NAME="IDX917"></A>
164*946379e7SchristosSpecify the base directory of classes directory hierarchy.
165*946379e7Schristos
166*946379e7Schristos</DL>
167*946379e7Schristos
168*946379e7Schristos<P>
169*946379e7SchristosThe class name is determined by appending the locale name to the resource name,
170*946379e7Schristosseparated with an underscore.  The <SAMP>&lsquo;-d&rsquo;</SAMP> option is mandatory.  The class
171*946379e7Schristosis written under the specified directory.
172*946379e7Schristos
173*946379e7Schristos</P>
174*946379e7Schristos
175*946379e7Schristos
176*946379e7Schristos<H3><A NAME="SEC148" HREF="gettext_toc.html#TOC148">10.1.5  Output file location in C# mode</A></H3>
177*946379e7Schristos
178*946379e7Schristos<DL COMPACT>
179*946379e7Schristos
180*946379e7Schristos<DT><SAMP>&lsquo;-r <VAR>resource</VAR>&rsquo;</SAMP>
181*946379e7Schristos<DD>
182*946379e7Schristos<DT><SAMP>&lsquo;--resource=<VAR>resource</VAR>&rsquo;</SAMP>
183*946379e7Schristos<DD>
184*946379e7Schristos<A NAME="IDX918"></A>
185*946379e7Schristos<A NAME="IDX919"></A>
186*946379e7SchristosSpecify the resource name.
187*946379e7Schristos
188*946379e7Schristos<DT><SAMP>&lsquo;-l <VAR>locale</VAR>&rsquo;</SAMP>
189*946379e7Schristos<DD>
190*946379e7Schristos<DT><SAMP>&lsquo;--locale=<VAR>locale</VAR>&rsquo;</SAMP>
191*946379e7Schristos<DD>
192*946379e7Schristos<A NAME="IDX920"></A>
193*946379e7Schristos<A NAME="IDX921"></A>
194*946379e7SchristosSpecify the locale name, either a language specification of the form <VAR>ll</VAR>
195*946379e7Schristosor a combined language and country specification of the form <VAR>ll_CC</VAR>.
196*946379e7Schristos
197*946379e7Schristos<DT><SAMP>&lsquo;-d <VAR>directory</VAR>&rsquo;</SAMP>
198*946379e7Schristos<DD>
199*946379e7Schristos<A NAME="IDX922"></A>
200*946379e7SchristosSpecify the base directory for locale dependent <TT>&lsquo;.dll&rsquo;</TT> files.
201*946379e7Schristos
202*946379e7Schristos</DL>
203*946379e7Schristos
204*946379e7Schristos<P>
205*946379e7SchristosThe <SAMP>&lsquo;-l&rsquo;</SAMP> and <SAMP>&lsquo;-d&rsquo;</SAMP> options are mandatory.  The <TT>&lsquo;.dll&rsquo;</TT> file is
206*946379e7Schristoswritten in a subdirectory of the specified directory whose name depends on the
207*946379e7Schristoslocale.
208*946379e7Schristos
209*946379e7Schristos</P>
210*946379e7Schristos
211*946379e7Schristos
212*946379e7Schristos<H3><A NAME="SEC149" HREF="gettext_toc.html#TOC149">10.1.6  Output file location in Tcl mode</A></H3>
213*946379e7Schristos
214*946379e7Schristos<DL COMPACT>
215*946379e7Schristos
216*946379e7Schristos<DT><SAMP>&lsquo;-l <VAR>locale</VAR>&rsquo;</SAMP>
217*946379e7Schristos<DD>
218*946379e7Schristos<DT><SAMP>&lsquo;--locale=<VAR>locale</VAR>&rsquo;</SAMP>
219*946379e7Schristos<DD>
220*946379e7Schristos<A NAME="IDX923"></A>
221*946379e7Schristos<A NAME="IDX924"></A>
222*946379e7SchristosSpecify the locale name, either a language specification of the form <VAR>ll</VAR>
223*946379e7Schristosor a combined language and country specification of the form <VAR>ll_CC</VAR>.
224*946379e7Schristos
225*946379e7Schristos<DT><SAMP>&lsquo;-d <VAR>directory</VAR>&rsquo;</SAMP>
226*946379e7Schristos<DD>
227*946379e7Schristos<A NAME="IDX925"></A>
228*946379e7SchristosSpecify the base directory of <TT>&lsquo;.msg&rsquo;</TT> message catalogs.
229*946379e7Schristos
230*946379e7Schristos</DL>
231*946379e7Schristos
232*946379e7Schristos<P>
233*946379e7SchristosThe <SAMP>&lsquo;-l&rsquo;</SAMP> and <SAMP>&lsquo;-d&rsquo;</SAMP> options are mandatory.  The <TT>&lsquo;.msg&rsquo;</TT> file is
234*946379e7Schristoswritten in the specified directory.
235*946379e7Schristos
236*946379e7Schristos</P>
237*946379e7Schristos
238*946379e7Schristos
239*946379e7Schristos<H3><A NAME="SEC150" HREF="gettext_toc.html#TOC150">10.1.7  Input file syntax</A></H3>
240*946379e7Schristos
241*946379e7Schristos<DL COMPACT>
242*946379e7Schristos
243*946379e7Schristos<DT><SAMP>&lsquo;-P&rsquo;</SAMP>
244*946379e7Schristos<DD>
245*946379e7Schristos<DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
246*946379e7Schristos<DD>
247*946379e7Schristos<A NAME="IDX926"></A>
248*946379e7Schristos<A NAME="IDX927"></A>
249*946379e7SchristosAssume the input files are Java ResourceBundles in Java <CODE>.properties</CODE>
250*946379e7Schristossyntax, not in PO file syntax.
251*946379e7Schristos
252*946379e7Schristos<DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
253*946379e7Schristos<DD>
254*946379e7Schristos<A NAME="IDX928"></A>
255*946379e7SchristosAssume the input files are NeXTstep/GNUstep localized resource files in
256*946379e7Schristos<CODE>.strings</CODE> syntax, not in PO file syntax.
257*946379e7Schristos
258*946379e7Schristos</DL>
259*946379e7Schristos
260*946379e7Schristos
261*946379e7Schristos
262*946379e7Schristos<H3><A NAME="SEC151" HREF="gettext_toc.html#TOC151">10.1.8  Input file interpretation</A></H3>
263*946379e7Schristos
264*946379e7Schristos<DL COMPACT>
265*946379e7Schristos
266*946379e7Schristos<DT><SAMP>&lsquo;-c&rsquo;</SAMP>
267*946379e7Schristos<DD>
268*946379e7Schristos<DT><SAMP>&lsquo;--check&rsquo;</SAMP>
269*946379e7Schristos<DD>
270*946379e7Schristos<A NAME="IDX929"></A>
271*946379e7Schristos<A NAME="IDX930"></A>
272*946379e7SchristosPerform all the checks implied by <CODE>--check-format</CODE>, <CODE>--check-header</CODE>,
273*946379e7Schristos<CODE>--check-domain</CODE>.
274*946379e7Schristos
275*946379e7Schristos<DT><SAMP>&lsquo;--check-format&rsquo;</SAMP>
276*946379e7Schristos<DD>
277*946379e7Schristos<A NAME="IDX931"></A>
278*946379e7Schristos<A NAME="IDX932"></A>
279*946379e7SchristosCheck language dependent format strings.
280*946379e7Schristos
281*946379e7SchristosIf the string represents a format string used in a
282*946379e7Schristos<CODE>printf</CODE>-like function both strings should have the same number of
283*946379e7Schristos<SAMP>&lsquo;%&rsquo;</SAMP> format specifiers, with matching types.  If the flag
284*946379e7Schristos<CODE>c-format</CODE> or <CODE>possible-c-format</CODE> appears in the special
285*946379e7Schristoscomment <KBD>#,</KBD> for this entry a check is performed.  For example, the
286*946379e7Schristoscheck will diagnose using <SAMP>&lsquo;%.*s&rsquo;</SAMP> against <SAMP>&lsquo;%s&rsquo;</SAMP>, or <SAMP>&lsquo;%d&rsquo;</SAMP>
287*946379e7Schristosagainst <SAMP>&lsquo;%s&rsquo;</SAMP>, or <SAMP>&lsquo;%d&rsquo;</SAMP> against <SAMP>&lsquo;%x&rsquo;</SAMP>.  It can even handle
288*946379e7Schristospositional parameters.
289*946379e7Schristos
290*946379e7SchristosNormally the <CODE>xgettext</CODE> program automatically decides whether a
291*946379e7Schristosstring is a format string or not.  This algorithm is not perfect,
292*946379e7Schristosthough.  It might regard a string as a format string though it is not
293*946379e7Schristosused in a <CODE>printf</CODE>-like function and so <CODE>msgfmt</CODE> might report
294*946379e7Schristoserrors where there are none.
295*946379e7Schristos
296*946379e7SchristosTo solve this problem the programmer can dictate the decision to the
297*946379e7Schristos<CODE>xgettext</CODE> program (see section <A HREF="gettext_15.html#SEC233">15.3.1  C Format Strings</A>).  The translator should not
298*946379e7Schristosconsider removing the flag from the <KBD>#,</KBD> line.  This "fix" would be
299*946379e7Schristosreversed again as soon as <CODE>msgmerge</CODE> is called the next time.
300*946379e7Schristos
301*946379e7Schristos<DT><SAMP>&lsquo;--check-header&rsquo;</SAMP>
302*946379e7Schristos<DD>
303*946379e7Schristos<A NAME="IDX933"></A>
304*946379e7SchristosVerify presence and contents of the header entry.  See section <A HREF="gettext_6.html#SEC38">6.2  Filling in the Header Entry</A>,
305*946379e7Schristosfor a description of the various fields in the header entry.
306*946379e7Schristos
307*946379e7Schristos<DT><SAMP>&lsquo;--check-domain&rsquo;</SAMP>
308*946379e7Schristos<DD>
309*946379e7Schristos<A NAME="IDX934"></A>
310*946379e7SchristosCheck for conflicts between domain directives and the <CODE>--output-file</CODE>
311*946379e7Schristosoption
312*946379e7Schristos
313*946379e7Schristos<DT><SAMP>&lsquo;-C&rsquo;</SAMP>
314*946379e7Schristos<DD>
315*946379e7Schristos<DT><SAMP>&lsquo;--check-compatibility&rsquo;</SAMP>
316*946379e7Schristos<DD>
317*946379e7Schristos<A NAME="IDX935"></A>
318*946379e7Schristos<A NAME="IDX936"></A>
319*946379e7Schristos<A NAME="IDX937"></A>
320*946379e7SchristosCheck that GNU msgfmt behaves like X/Open msgfmt.  This will give an error
321*946379e7Schristoswhen attempting to use the GNU extensions.
322*946379e7Schristos
323*946379e7Schristos<DT><SAMP>&lsquo;--check-accelerators[=<VAR>char</VAR>]&rsquo;</SAMP>
324*946379e7Schristos<DD>
325*946379e7Schristos<A NAME="IDX938"></A>
326*946379e7Schristos<A NAME="IDX939"></A>
327*946379e7Schristos<A NAME="IDX940"></A>
328*946379e7Schristos<A NAME="IDX941"></A>
329*946379e7SchristosCheck presence of keyboard accelerators for menu items.  This is based on
330*946379e7Schristosthe convention used in some GUIs that a keyboard accelerator in a menu
331*946379e7Schristositem string is designated by an immediately preceding <SAMP>&lsquo;&#38;&rsquo;</SAMP> character.
332*946379e7SchristosSometimes a keyboard accelerator is also called "keyboard mnemonic".
333*946379e7SchristosThis check verifies that if the untranslated string has exactly one
334*946379e7Schristos<SAMP>&lsquo;&#38;&rsquo;</SAMP> character, the translated string has exactly one <SAMP>&lsquo;&#38;&rsquo;</SAMP> as well.
335*946379e7SchristosIf this option is given with a <VAR>char</VAR> argument, this <VAR>char</VAR> should
336*946379e7Schristosbe a non-alphanumeric character and is used as keyboard accelerator mark
337*946379e7Schristosinstead of <SAMP>&lsquo;&#38;&rsquo;</SAMP>.
338*946379e7Schristos
339*946379e7Schristos<DT><SAMP>&lsquo;-f&rsquo;</SAMP>
340*946379e7Schristos<DD>
341*946379e7Schristos<DT><SAMP>&lsquo;--use-fuzzy&rsquo;</SAMP>
342*946379e7Schristos<DD>
343*946379e7Schristos<A NAME="IDX942"></A>
344*946379e7Schristos<A NAME="IDX943"></A>
345*946379e7Schristos<A NAME="IDX944"></A>
346*946379e7SchristosUse fuzzy entries in output.  Note that using this option is usually wrong,
347*946379e7Schristosbecause fuzzy messages are exactly those which have not been validated by
348*946379e7Schristosa human translator.
349*946379e7Schristos
350*946379e7Schristos</DL>
351*946379e7Schristos
352*946379e7Schristos
353*946379e7Schristos
354*946379e7Schristos<H3><A NAME="SEC152" HREF="gettext_toc.html#TOC152">10.1.9  Output details</A></H3>
355*946379e7Schristos
356*946379e7Schristos<DL COMPACT>
357*946379e7Schristos
358*946379e7Schristos<DT><SAMP>&lsquo;-a <VAR>number</VAR>&rsquo;</SAMP>
359*946379e7Schristos<DD>
360*946379e7Schristos<DT><SAMP>&lsquo;--alignment=<VAR>number</VAR>&rsquo;</SAMP>
361*946379e7Schristos<DD>
362*946379e7Schristos<A NAME="IDX945"></A>
363*946379e7Schristos<A NAME="IDX946"></A>
364*946379e7SchristosAlign strings to <VAR>number</VAR> bytes (default: 1).
365*946379e7Schristos
366*946379e7Schristos<DT><SAMP>&lsquo;--no-hash&rsquo;</SAMP>
367*946379e7Schristos<DD>
368*946379e7Schristos<A NAME="IDX947"></A>
369*946379e7SchristosDon't include a hash table in the binary file.  Lookup will be more expensive
370*946379e7Schristosat run time (binary search instead of hash table lookup).
371*946379e7Schristos
372*946379e7Schristos</DL>
373*946379e7Schristos
374*946379e7Schristos
375*946379e7Schristos
376*946379e7Schristos<H3><A NAME="SEC153" HREF="gettext_toc.html#TOC153">10.1.10  Informative output</A></H3>
377*946379e7Schristos
378*946379e7Schristos<DL COMPACT>
379*946379e7Schristos
380*946379e7Schristos<DT><SAMP>&lsquo;-h&rsquo;</SAMP>
381*946379e7Schristos<DD>
382*946379e7Schristos<DT><SAMP>&lsquo;--help&rsquo;</SAMP>
383*946379e7Schristos<DD>
384*946379e7Schristos<A NAME="IDX948"></A>
385*946379e7Schristos<A NAME="IDX949"></A>
386*946379e7SchristosDisplay this help and exit.
387*946379e7Schristos
388*946379e7Schristos<DT><SAMP>&lsquo;-V&rsquo;</SAMP>
389*946379e7Schristos<DD>
390*946379e7Schristos<DT><SAMP>&lsquo;--version&rsquo;</SAMP>
391*946379e7Schristos<DD>
392*946379e7Schristos<A NAME="IDX950"></A>
393*946379e7Schristos<A NAME="IDX951"></A>
394*946379e7SchristosOutput version information and exit.
395*946379e7Schristos
396*946379e7Schristos<DT><SAMP>&lsquo;--statistics&rsquo;</SAMP>
397*946379e7Schristos<DD>
398*946379e7Schristos<A NAME="IDX952"></A>
399*946379e7SchristosPrint statistics about translations.
400*946379e7Schristos
401*946379e7Schristos<DT><SAMP>&lsquo;-v&rsquo;</SAMP>
402*946379e7Schristos<DD>
403*946379e7Schristos<DT><SAMP>&lsquo;--verbose&rsquo;</SAMP>
404*946379e7Schristos<DD>
405*946379e7Schristos<A NAME="IDX953"></A>
406*946379e7Schristos<A NAME="IDX954"></A>
407*946379e7SchristosIncrease verbosity level.
408*946379e7Schristos
409*946379e7Schristos</DL>
410*946379e7Schristos
411*946379e7Schristos
412*946379e7Schristos
413*946379e7Schristos<H2><A NAME="SEC154" HREF="gettext_toc.html#TOC154">10.2  Invoking the <CODE>msgunfmt</CODE> Program</A></H2>
414*946379e7Schristos
415*946379e7Schristos<P>
416*946379e7Schristos<A NAME="IDX955"></A>
417*946379e7Schristos<A NAME="IDX956"></A>
418*946379e7Schristos
419*946379e7Schristos<PRE>
420*946379e7Schristosmsgunfmt [<VAR>option</VAR>] [<VAR>file</VAR>]...
421*946379e7Schristos</PRE>
422*946379e7Schristos
423*946379e7Schristos<P>
424*946379e7Schristos<A NAME="IDX957"></A>
425*946379e7SchristosThe <CODE>msgunfmt</CODE> program converts a binary message catalog to a
426*946379e7SchristosUniforum style .po file.
427*946379e7Schristos
428*946379e7Schristos</P>
429*946379e7Schristos
430*946379e7Schristos
431*946379e7Schristos<H3><A NAME="SEC155" HREF="gettext_toc.html#TOC155">10.2.1  Operation mode</A></H3>
432*946379e7Schristos
433*946379e7Schristos<DL COMPACT>
434*946379e7Schristos
435*946379e7Schristos<DT><SAMP>&lsquo;-j&rsquo;</SAMP>
436*946379e7Schristos<DD>
437*946379e7Schristos<DT><SAMP>&lsquo;--java&rsquo;</SAMP>
438*946379e7Schristos<DD>
439*946379e7Schristos<A NAME="IDX958"></A>
440*946379e7Schristos<A NAME="IDX959"></A>
441*946379e7Schristos<A NAME="IDX960"></A>
442*946379e7SchristosJava mode: input is a Java <CODE>ResourceBundle</CODE> class.
443*946379e7Schristos
444*946379e7Schristos<DT><SAMP>&lsquo;--csharp&rsquo;</SAMP>
445*946379e7Schristos<DD>
446*946379e7Schristos<A NAME="IDX961"></A>
447*946379e7Schristos<A NAME="IDX962"></A>
448*946379e7SchristosC# mode: input is a .NET .dll file containing a subclass of
449*946379e7Schristos<CODE>GettextResourceSet</CODE>.
450*946379e7Schristos
451*946379e7Schristos<DT><SAMP>&lsquo;--csharp-resources&rsquo;</SAMP>
452*946379e7Schristos<DD>
453*946379e7Schristos<A NAME="IDX963"></A>
454*946379e7Schristos<A NAME="IDX964"></A>
455*946379e7SchristosC# resources mode: input is a .NET <TT>&lsquo;.resources&rsquo;</TT> file.
456*946379e7Schristos
457*946379e7Schristos<DT><SAMP>&lsquo;--tcl&rsquo;</SAMP>
458*946379e7Schristos<DD>
459*946379e7Schristos<A NAME="IDX965"></A>
460*946379e7Schristos<A NAME="IDX966"></A>
461*946379e7SchristosTcl mode: input is a tcl/msgcat <TT>&lsquo;.msg&rsquo;</TT> file.
462*946379e7Schristos
463*946379e7Schristos</DL>
464*946379e7Schristos
465*946379e7Schristos
466*946379e7Schristos
467*946379e7Schristos<H3><A NAME="SEC156" HREF="gettext_toc.html#TOC156">10.2.2  Input file location</A></H3>
468*946379e7Schristos
469*946379e7Schristos<DL COMPACT>
470*946379e7Schristos
471*946379e7Schristos<DT><SAMP>&lsquo;<VAR>file</VAR> ...&rsquo;</SAMP>
472*946379e7Schristos<DD>
473*946379e7SchristosInput .mo files.
474*946379e7Schristos
475*946379e7Schristos</DL>
476*946379e7Schristos
477*946379e7Schristos<P>
478*946379e7SchristosIf no input <VAR>file</VAR> is given or if it is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
479*946379e7Schristos
480*946379e7Schristos</P>
481*946379e7Schristos
482*946379e7Schristos
483*946379e7Schristos<H3><A NAME="SEC157" HREF="gettext_toc.html#TOC157">10.2.3  Input file location in Java mode</A></H3>
484*946379e7Schristos
485*946379e7Schristos<DL COMPACT>
486*946379e7Schristos
487*946379e7Schristos<DT><SAMP>&lsquo;-r <VAR>resource</VAR>&rsquo;</SAMP>
488*946379e7Schristos<DD>
489*946379e7Schristos<DT><SAMP>&lsquo;--resource=<VAR>resource</VAR>&rsquo;</SAMP>
490*946379e7Schristos<DD>
491*946379e7Schristos<A NAME="IDX967"></A>
492*946379e7Schristos<A NAME="IDX968"></A>
493*946379e7SchristosSpecify the resource name.
494*946379e7Schristos
495*946379e7Schristos<DT><SAMP>&lsquo;-l <VAR>locale</VAR>&rsquo;</SAMP>
496*946379e7Schristos<DD>
497*946379e7Schristos<DT><SAMP>&lsquo;--locale=<VAR>locale</VAR>&rsquo;</SAMP>
498*946379e7Schristos<DD>
499*946379e7Schristos<A NAME="IDX969"></A>
500*946379e7Schristos<A NAME="IDX970"></A>
501*946379e7SchristosSpecify the locale name, either a language specification of the form <VAR>ll</VAR>
502*946379e7Schristosor a combined language and country specification of the form <VAR>ll_CC</VAR>.
503*946379e7Schristos
504*946379e7Schristos</DL>
505*946379e7Schristos
506*946379e7Schristos<P>
507*946379e7SchristosThe class name is determined by appending the locale name to the resource name,
508*946379e7Schristosseparated with an underscore.  The class is located using the <CODE>CLASSPATH</CODE>.
509*946379e7Schristos
510*946379e7Schristos</P>
511*946379e7Schristos
512*946379e7Schristos
513*946379e7Schristos<H3><A NAME="SEC158" HREF="gettext_toc.html#TOC158">10.2.4  Input file location in C# mode</A></H3>
514*946379e7Schristos
515*946379e7Schristos<DL COMPACT>
516*946379e7Schristos
517*946379e7Schristos<DT><SAMP>&lsquo;-r <VAR>resource</VAR>&rsquo;</SAMP>
518*946379e7Schristos<DD>
519*946379e7Schristos<DT><SAMP>&lsquo;--resource=<VAR>resource</VAR>&rsquo;</SAMP>
520*946379e7Schristos<DD>
521*946379e7Schristos<A NAME="IDX971"></A>
522*946379e7Schristos<A NAME="IDX972"></A>
523*946379e7SchristosSpecify the resource name.
524*946379e7Schristos
525*946379e7Schristos<DT><SAMP>&lsquo;-l <VAR>locale</VAR>&rsquo;</SAMP>
526*946379e7Schristos<DD>
527*946379e7Schristos<DT><SAMP>&lsquo;--locale=<VAR>locale</VAR>&rsquo;</SAMP>
528*946379e7Schristos<DD>
529*946379e7Schristos<A NAME="IDX973"></A>
530*946379e7Schristos<A NAME="IDX974"></A>
531*946379e7SchristosSpecify the locale name, either a language specification of the form <VAR>ll</VAR>
532*946379e7Schristosor a combined language and country specification of the form <VAR>ll_CC</VAR>.
533*946379e7Schristos
534*946379e7Schristos<DT><SAMP>&lsquo;-d <VAR>directory</VAR>&rsquo;</SAMP>
535*946379e7Schristos<DD>
536*946379e7Schristos<A NAME="IDX975"></A>
537*946379e7SchristosSpecify the base directory for locale dependent <TT>&lsquo;.dll&rsquo;</TT> files.
538*946379e7Schristos
539*946379e7Schristos</DL>
540*946379e7Schristos
541*946379e7Schristos<P>
542*946379e7SchristosThe <SAMP>&lsquo;-l&rsquo;</SAMP> and <SAMP>&lsquo;-d&rsquo;</SAMP> options are mandatory.  The <TT>&lsquo;.msg&rsquo;</TT> file is
543*946379e7Schristoslocated in a subdirectory of the specified directory whose name depends on the
544*946379e7Schristoslocale.
545*946379e7Schristos
546*946379e7Schristos</P>
547*946379e7Schristos
548*946379e7Schristos
549*946379e7Schristos<H3><A NAME="SEC159" HREF="gettext_toc.html#TOC159">10.2.5  Input file location in Tcl mode</A></H3>
550*946379e7Schristos
551*946379e7Schristos<DL COMPACT>
552*946379e7Schristos
553*946379e7Schristos<DT><SAMP>&lsquo;-l <VAR>locale</VAR>&rsquo;</SAMP>
554*946379e7Schristos<DD>
555*946379e7Schristos<DT><SAMP>&lsquo;--locale=<VAR>locale</VAR>&rsquo;</SAMP>
556*946379e7Schristos<DD>
557*946379e7Schristos<A NAME="IDX976"></A>
558*946379e7Schristos<A NAME="IDX977"></A>
559*946379e7SchristosSpecify the locale name, either a language specification of the form <VAR>ll</VAR>
560*946379e7Schristosor a combined language and country specification of the form <VAR>ll_CC</VAR>.
561*946379e7Schristos
562*946379e7Schristos<DT><SAMP>&lsquo;-d <VAR>directory</VAR>&rsquo;</SAMP>
563*946379e7Schristos<DD>
564*946379e7Schristos<A NAME="IDX978"></A>
565*946379e7SchristosSpecify the base directory of <TT>&lsquo;.msg&rsquo;</TT> message catalogs.
566*946379e7Schristos
567*946379e7Schristos</DL>
568*946379e7Schristos
569*946379e7Schristos<P>
570*946379e7SchristosThe <SAMP>&lsquo;-l&rsquo;</SAMP> and <SAMP>&lsquo;-d&rsquo;</SAMP> options are mandatory.  The <TT>&lsquo;.msg&rsquo;</TT> file is
571*946379e7Schristoslocated in the specified directory.
572*946379e7Schristos
573*946379e7Schristos</P>
574*946379e7Schristos
575*946379e7Schristos
576*946379e7Schristos<H3><A NAME="SEC160" HREF="gettext_toc.html#TOC160">10.2.6  Output file location</A></H3>
577*946379e7Schristos
578*946379e7Schristos<DL COMPACT>
579*946379e7Schristos
580*946379e7Schristos<DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
581*946379e7Schristos<DD>
582*946379e7Schristos<DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
583*946379e7Schristos<DD>
584*946379e7Schristos<A NAME="IDX979"></A>
585*946379e7Schristos<A NAME="IDX980"></A>
586*946379e7SchristosWrite output to specified file.
587*946379e7Schristos
588*946379e7Schristos</DL>
589*946379e7Schristos
590*946379e7Schristos<P>
591*946379e7SchristosThe results are written to standard output if no output file is specified
592*946379e7Schristosor if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
593*946379e7Schristos
594*946379e7Schristos</P>
595*946379e7Schristos
596*946379e7Schristos
597*946379e7Schristos<H3><A NAME="SEC161" HREF="gettext_toc.html#TOC161">10.2.7  Output details</A></H3>
598*946379e7Schristos
599*946379e7Schristos<DL COMPACT>
600*946379e7Schristos
601*946379e7Schristos<DT><SAMP>&lsquo;--force-po&rsquo;</SAMP>
602*946379e7Schristos<DD>
603*946379e7Schristos<A NAME="IDX981"></A>
604*946379e7SchristosAlways write an output file even if it contains no message.
605*946379e7Schristos
606*946379e7Schristos<DT><SAMP>&lsquo;-i&rsquo;</SAMP>
607*946379e7Schristos<DD>
608*946379e7Schristos<DT><SAMP>&lsquo;--indent&rsquo;</SAMP>
609*946379e7Schristos<DD>
610*946379e7Schristos<A NAME="IDX982"></A>
611*946379e7Schristos<A NAME="IDX983"></A>
612*946379e7SchristosWrite the .po file using indented style.
613*946379e7Schristos
614*946379e7Schristos<DT><SAMP>&lsquo;--strict&rsquo;</SAMP>
615*946379e7Schristos<DD>
616*946379e7Schristos<A NAME="IDX984"></A>
617*946379e7SchristosWrite out a strict Uniforum conforming PO file.  Note that this
618*946379e7SchristosUniforum format should be avoided because it doesn't support the
619*946379e7SchristosGNU extensions.
620*946379e7Schristos
621*946379e7Schristos<DT><SAMP>&lsquo;-p&rsquo;</SAMP>
622*946379e7Schristos<DD>
623*946379e7Schristos<DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
624*946379e7Schristos<DD>
625*946379e7Schristos<A NAME="IDX985"></A>
626*946379e7Schristos<A NAME="IDX986"></A>
627*946379e7SchristosWrite out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax.  Note
628*946379e7Schristosthat this file format doesn't support plural forms and silently drops
629*946379e7Schristosobsolete messages.
630*946379e7Schristos
631*946379e7Schristos<DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
632*946379e7Schristos<DD>
633*946379e7Schristos<A NAME="IDX987"></A>
634*946379e7SchristosWrite out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
635*946379e7SchristosNote that this file format doesn't support plural forms.
636*946379e7Schristos
637*946379e7Schristos<DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
638*946379e7Schristos<DD>
639*946379e7Schristos<DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
640*946379e7Schristos<DD>
641*946379e7Schristos<A NAME="IDX988"></A>
642*946379e7Schristos<A NAME="IDX989"></A>
643*946379e7SchristosSet the output page width.  Long strings in the output files will be
644*946379e7Schristossplit across multiple lines in order to ensure that each line's width
645*946379e7Schristos(= number of screen columns) is less or equal to the given <VAR>number</VAR>.
646*946379e7Schristos
647*946379e7Schristos<DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
648*946379e7Schristos<DD>
649*946379e7Schristos<A NAME="IDX990"></A>
650*946379e7SchristosDo not break long message lines.  Message lines whose width exceeds the
651*946379e7Schristosoutput page width will not be split into several lines.  Only file reference
652*946379e7Schristoslines which are wider than the output page width will be split.
653*946379e7Schristos
654*946379e7Schristos<DT><SAMP>&lsquo;-s&rsquo;</SAMP>
655*946379e7Schristos<DD>
656*946379e7Schristos<DT><SAMP>&lsquo;--sort-output&rsquo;</SAMP>
657*946379e7Schristos<DD>
658*946379e7Schristos<A NAME="IDX991"></A>
659*946379e7Schristos<A NAME="IDX992"></A>
660*946379e7Schristos<A NAME="IDX993"></A>
661*946379e7SchristosGenerate sorted output.  Note that using this option makes it much harder
662*946379e7Schristosfor the translator to understand each message's context.
663*946379e7Schristos
664*946379e7Schristos</DL>
665*946379e7Schristos
666*946379e7Schristos
667*946379e7Schristos
668*946379e7Schristos<H3><A NAME="SEC162" HREF="gettext_toc.html#TOC162">10.2.8  Informative output</A></H3>
669*946379e7Schristos
670*946379e7Schristos<DL COMPACT>
671*946379e7Schristos
672*946379e7Schristos<DT><SAMP>&lsquo;-h&rsquo;</SAMP>
673*946379e7Schristos<DD>
674*946379e7Schristos<DT><SAMP>&lsquo;--help&rsquo;</SAMP>
675*946379e7Schristos<DD>
676*946379e7Schristos<A NAME="IDX994"></A>
677*946379e7Schristos<A NAME="IDX995"></A>
678*946379e7SchristosDisplay this help and exit.
679*946379e7Schristos
680*946379e7Schristos<DT><SAMP>&lsquo;-V&rsquo;</SAMP>
681*946379e7Schristos<DD>
682*946379e7Schristos<DT><SAMP>&lsquo;--version&rsquo;</SAMP>
683*946379e7Schristos<DD>
684*946379e7Schristos<A NAME="IDX996"></A>
685*946379e7Schristos<A NAME="IDX997"></A>
686*946379e7SchristosOutput version information and exit.
687*946379e7Schristos
688*946379e7Schristos<DT><SAMP>&lsquo;-v&rsquo;</SAMP>
689*946379e7Schristos<DD>
690*946379e7Schristos<DT><SAMP>&lsquo;--verbose&rsquo;</SAMP>
691*946379e7Schristos<DD>
692*946379e7Schristos<A NAME="IDX998"></A>
693*946379e7Schristos<A NAME="IDX999"></A>
694*946379e7SchristosIncrease verbosity level.
695*946379e7Schristos
696*946379e7Schristos</DL>
697*946379e7Schristos
698*946379e7Schristos
699*946379e7Schristos
700*946379e7Schristos<H2><A NAME="SEC163" HREF="gettext_toc.html#TOC163">10.3  The Format of GNU MO Files</A></H2>
701*946379e7Schristos<P>
702*946379e7Schristos<A NAME="IDX1000"></A>
703*946379e7Schristos<A NAME="IDX1001"></A>
704*946379e7Schristos
705*946379e7Schristos</P>
706*946379e7Schristos<P>
707*946379e7SchristosThe format of the generated MO files is best described by a picture,
708*946379e7Schristoswhich appears below.
709*946379e7Schristos
710*946379e7Schristos</P>
711*946379e7Schristos<P>
712*946379e7Schristos<A NAME="IDX1002"></A>
713*946379e7SchristosThe first two words serve the identification of the file.  The magic
714*946379e7Schristosnumber will always signal GNU MO files.  The number is stored in the
715*946379e7Schristosbyte order of the generating machine, so the magic number really is
716*946379e7Schristostwo numbers: <CODE>0x950412de</CODE> and <CODE>0xde120495</CODE>.  The second
717*946379e7Schristosword describes the current revision of the file format.  For now the
718*946379e7Schristosrevision is 0.  This might change in future versions, and ensures
719*946379e7Schristosthat the readers of MO files can distinguish new formats from old
720*946379e7Schristosones, so that both can be handled correctly.  The version is kept
721*946379e7Schristosseparate from the magic number, instead of using different magic
722*946379e7Schristosnumbers for different formats, mainly because <TT>&lsquo;/etc/magic&rsquo;</TT> is
723*946379e7Schristosnot updated often.  It might be better to have magic separated from
724*946379e7Schristosinternal format version identification.
725*946379e7Schristos
726*946379e7Schristos</P>
727*946379e7Schristos<P>
728*946379e7SchristosFollow a number of pointers to later tables in the file, allowing
729*946379e7Schristosfor the extension of the prefix part of MO files without having to
730*946379e7Schristosrecompile programs reading them.  This might become useful for later
731*946379e7Schristosinserting a few flag bits, indication about the charset used, new
732*946379e7Schristostables, or other things.
733*946379e7Schristos
734*946379e7Schristos</P>
735*946379e7Schristos<P>
736*946379e7SchristosThen, at offset <VAR>O</VAR> and offset <VAR>T</VAR> in the picture, two tables
737*946379e7Schristosof string descriptors can be found.  In both tables, each string
738*946379e7Schristosdescriptor uses two 32 bits integers, one for the string length,
739*946379e7Schristosanother for the offset of the string in the MO file, counting in bytes
740*946379e7Schristosfrom the start of the file.  The first table contains descriptors
741*946379e7Schristosfor the original strings, and is sorted so the original strings
742*946379e7Schristosare in increasing lexicographical order.  The second table contains
743*946379e7Schristosdescriptors for the translated strings, and is parallel to the first
744*946379e7Schristostable: to find the corresponding translation one has to access the
745*946379e7Schristosarray slot in the second array with the same index.
746*946379e7Schristos
747*946379e7Schristos</P>
748*946379e7Schristos<P>
749*946379e7SchristosHaving the original strings sorted enables the use of simple binary
750*946379e7Schristossearch, for when the MO file does not contain an hashing table, or
751*946379e7Schristosfor when it is not practical to use the hashing table provided in
752*946379e7Schristosthe MO file.  This also has another advantage, as the empty string
753*946379e7Schristosin a PO file GNU <CODE>gettext</CODE> is usually <EM>translated</EM> into
754*946379e7Schristossome system information attached to that particular MO file, and the
755*946379e7Schristosempty string necessarily becomes the first in both the original and
756*946379e7Schristostranslated tables, making the system information very easy to find.
757*946379e7Schristos
758*946379e7Schristos</P>
759*946379e7Schristos<P>
760*946379e7Schristos<A NAME="IDX1003"></A>
761*946379e7SchristosThe size <VAR>S</VAR> of the hash table can be zero.  In this case, the
762*946379e7Schristoshash table itself is not contained in the MO file.  Some people might
763*946379e7Schristosprefer this because a precomputed hashing table takes disk space, and
764*946379e7Schristosdoes not win <EM>that</EM> much speed.  The hash table contains indices
765*946379e7Schristosto the sorted array of strings in the MO file.  Conflict resolution is
766*946379e7Schristosdone by double hashing.  The precise hashing algorithm used is fairly
767*946379e7Schristosdependent on GNU <CODE>gettext</CODE> code, and is not documented here.
768*946379e7Schristos
769*946379e7Schristos</P>
770*946379e7Schristos<P>
771*946379e7SchristosAs for the strings themselves, they follow the hash file, and each
772*946379e7Schristosis terminated with a <KBD>NUL</KBD>, and this <KBD>NUL</KBD> is not counted in
773*946379e7Schristosthe length which appears in the string descriptor.  The <CODE>msgfmt</CODE>
774*946379e7Schristosprogram has an option selecting the alignment for MO file strings.
775*946379e7SchristosWith this option, each string is separately aligned so it starts at
776*946379e7Schristosan offset which is a multiple of the alignment value.  On some RISC
777*946379e7Schristosmachines, a correct alignment will speed things up.
778*946379e7Schristos
779*946379e7Schristos</P>
780*946379e7Schristos<P>
781*946379e7Schristos<A NAME="IDX1004"></A>
782*946379e7SchristosContexts are stored by storing the concatenation of the context, a
783*946379e7Schristos<KBD>EOT</KBD> byte, and the original string, instead of the original string.
784*946379e7Schristos
785*946379e7Schristos</P>
786*946379e7Schristos<P>
787*946379e7Schristos<A NAME="IDX1005"></A>
788*946379e7SchristosPlural forms are stored by letting the plural of the original string
789*946379e7Schristosfollow the singular of the original string, separated through a
790*946379e7Schristos<KBD>NUL</KBD> byte.  The length which appears in the string descriptor
791*946379e7Schristosincludes both.  However, only the singular of the original string
792*946379e7Schristostakes part in the hash table lookup.  The plural variants of the
793*946379e7Schristostranslation are all stored consecutively, separated through a
794*946379e7Schristos<KBD>NUL</KBD> byte.  Here also, the length in the string descriptor
795*946379e7Schristosincludes all of them.
796*946379e7Schristos
797*946379e7Schristos</P>
798*946379e7Schristos<P>
799*946379e7SchristosNothing prevents a MO file from having embedded <KBD>NUL</KBD>s in strings.
800*946379e7SchristosHowever, the program interface currently used already presumes
801*946379e7Schristosthat strings are <KBD>NUL</KBD> terminated, so embedded <KBD>NUL</KBD>s are
802*946379e7Schristossomewhat useless.  But the MO file format is general enough so other
803*946379e7Schristosinterfaces would be later possible, if for example, we ever want to
804*946379e7Schristosimplement wide characters right in MO files, where <KBD>NUL</KBD> bytes may
805*946379e7Schristosaccidentally appear.  (No, we don't want to have wide characters in MO
806*946379e7Schristosfiles.  They would make the file unnecessarily large, and the
807*946379e7Schristos<SAMP>&lsquo;wchar_t&rsquo;</SAMP> type being platform dependent, MO files would be
808*946379e7Schristosplatform dependent as well.)
809*946379e7Schristos
810*946379e7Schristos</P>
811*946379e7Schristos<P>
812*946379e7SchristosThis particular issue has been strongly debated in the GNU
813*946379e7Schristos<CODE>gettext</CODE> development forum, and it is expectable that MO file
814*946379e7Schristosformat will evolve or change over time.  It is even possible that many
815*946379e7Schristosformats may later be supported concurrently.  But surely, we have to
816*946379e7Schristosstart somewhere, and the MO file format described here is a good start.
817*946379e7SchristosNothing is cast in concrete, and the format may later evolve fairly
818*946379e7Schristoseasily, so we should feel comfortable with the current approach.
819*946379e7Schristos
820*946379e7Schristos</P>
821*946379e7Schristos
822*946379e7Schristos<PRE>
823*946379e7Schristos        byte
824*946379e7Schristos             +------------------------------------------+
825*946379e7Schristos          0  | magic number = 0x950412de                |
826*946379e7Schristos             |                                          |
827*946379e7Schristos          4  | file format revision = 0                 |
828*946379e7Schristos             |                                          |
829*946379e7Schristos          8  | number of strings                        |  == N
830*946379e7Schristos             |                                          |
831*946379e7Schristos         12  | offset of table with original strings    |  == O
832*946379e7Schristos             |                                          |
833*946379e7Schristos         16  | offset of table with translation strings |  == T
834*946379e7Schristos             |                                          |
835*946379e7Schristos         20  | size of hashing table                    |  == S
836*946379e7Schristos             |                                          |
837*946379e7Schristos         24  | offset of hashing table                  |  == H
838*946379e7Schristos             |                                          |
839*946379e7Schristos             .                                          .
840*946379e7Schristos             .    (possibly more entries later)         .
841*946379e7Schristos             .                                          .
842*946379e7Schristos             |                                          |
843*946379e7Schristos          O  | length &#38; offset 0th string  ----------------.
844*946379e7Schristos      O + 8  | length &#38; offset 1st string  ------------------.
845*946379e7Schristos              ...                                    ...   | |
846*946379e7SchristosO + ((N-1)*8)| length &#38; offset (N-1)th string           |  | |
847*946379e7Schristos             |                                          |  | |
848*946379e7Schristos          T  | length &#38; offset 0th translation  ---------------.
849*946379e7Schristos      T + 8  | length &#38; offset 1st translation  -----------------.
850*946379e7Schristos              ...                                    ...   | | | |
851*946379e7SchristosT + ((N-1)*8)| length &#38; offset (N-1)th translation      |  | | | |
852*946379e7Schristos             |                                          |  | | | |
853*946379e7Schristos          H  | start hash table                         |  | | | |
854*946379e7Schristos              ...                                    ...   | | | |
855*946379e7Schristos  H + S * 4  | end hash table                           |  | | | |
856*946379e7Schristos             |                                          |  | | | |
857*946379e7Schristos             | NUL terminated 0th string  &#60;----------------' | | |
858*946379e7Schristos             |                                          |    | | |
859*946379e7Schristos             | NUL terminated 1st string  &#60;------------------' | |
860*946379e7Schristos             |                                          |      | |
861*946379e7Schristos              ...                                    ...       | |
862*946379e7Schristos             |                                          |      | |
863*946379e7Schristos             | NUL terminated 0th translation  &#60;---------------' |
864*946379e7Schristos             |                                          |        |
865*946379e7Schristos             | NUL terminated 1st translation  &#60;-----------------'
866*946379e7Schristos             |                                          |
867*946379e7Schristos              ...                                    ...
868*946379e7Schristos             |                                          |
869*946379e7Schristos             +------------------------------------------+
870*946379e7Schristos</PRE>
871*946379e7Schristos
872*946379e7Schristos<P><HR><P>
873*946379e7SchristosGo to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_9.html">previous</A>, <A HREF="gettext_11.html">next</A>, <A HREF="gettext_25.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>.
874*946379e7Schristos</BODY>
875*946379e7Schristos</HTML>
876