gettext_6.html revision 1.1.1.1
1<HTML>
2<HEAD>
3<!-- This HTML file has been created by texi2html 1.52b
4     from gettext.texi on 27 November 2006 -->
5
6<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
7<TITLE>GNU gettext utilities - 6  Creating a New PO File</TITLE>
8</HEAD>
9<BODY>
10Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_5.html">previous</A>, <A HREF="gettext_7.html">next</A>, <A HREF="gettext_25.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>.
11<P><HR><P>
12
13
14<H1><A NAME="SEC31" HREF="gettext_toc.html#TOC31">6  Creating a New PO File</A></H1>
15<P>
16<A NAME="IDX216"></A>
17
18</P>
19<P>
20When starting a new translation, the translator creates a file called
21<TT>&lsquo;<VAR>LANG</VAR>.po&rsquo;</TT>, as a copy of the <TT>&lsquo;<VAR>package</VAR>.pot&rsquo;</TT> template
22file with modifications in the initial comments (at the beginning of the file)
23and in the header entry (the first entry, near the beginning of the file).
24
25</P>
26<P>
27The easiest way to do so is by use of the <SAMP>&lsquo;msginit&rsquo;</SAMP> program.
28For example:
29
30</P>
31
32<PRE>
33$ cd <VAR>PACKAGE</VAR>-<VAR>VERSION</VAR>
34$ cd po
35$ msginit
36</PRE>
37
38<P>
39The alternative way is to do the copy and modifications by hand.
40To do so, the translator copies <TT>&lsquo;<VAR>package</VAR>.pot&rsquo;</TT> to
41<TT>&lsquo;<VAR>LANG</VAR>.po&rsquo;</TT>.  Then she modifies the initial comments and
42the header entry of this file.
43
44</P>
45
46
47
48<H2><A NAME="SEC32" HREF="gettext_toc.html#TOC32">6.1  Invoking the <CODE>msginit</CODE> Program</A></H2>
49
50<P>
51<A NAME="IDX217"></A>
52<A NAME="IDX218"></A>
53
54<PRE>
55msginit [<VAR>option</VAR>]
56</PRE>
57
58<P>
59<A NAME="IDX219"></A>
60<A NAME="IDX220"></A>
61The <CODE>msginit</CODE> program creates a new PO file, initializing the meta
62information with values from the user's environment.
63
64</P>
65
66
67<H3><A NAME="SEC33" HREF="gettext_toc.html#TOC33">6.1.1  Input file location</A></H3>
68
69<DL COMPACT>
70
71<DT><SAMP>&lsquo;-i <VAR>inputfile</VAR>&rsquo;</SAMP>
72<DD>
73<DT><SAMP>&lsquo;--input=<VAR>inputfile</VAR>&rsquo;</SAMP>
74<DD>
75<A NAME="IDX221"></A>
76<A NAME="IDX222"></A>
77Input POT file.
78
79</DL>
80
81<P>
82If no <VAR>inputfile</VAR> is given, the current directory is searched for the
83POT file.  If it is <SAMP>&lsquo;-&rsquo;</SAMP>, standard input is read.
84
85</P>
86
87
88<H3><A NAME="SEC34" HREF="gettext_toc.html#TOC34">6.1.2  Output file location</A></H3>
89
90<DL COMPACT>
91
92<DT><SAMP>&lsquo;-o <VAR>file</VAR>&rsquo;</SAMP>
93<DD>
94<DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
95<DD>
96<A NAME="IDX223"></A>
97<A NAME="IDX224"></A>
98Write output to specified PO file.
99
100</DL>
101
102<P>
103If no output file is given, it depends on the <SAMP>&lsquo;--locale&rsquo;</SAMP> option or the
104user's locale setting.  If it is <SAMP>&lsquo;-&rsquo;</SAMP>, the results are written to
105standard output.
106
107</P>
108
109
110<H3><A NAME="SEC35" HREF="gettext_toc.html#TOC35">6.1.3  Input file syntax</A></H3>
111
112<DL COMPACT>
113
114<DT><SAMP>&lsquo;-P&rsquo;</SAMP>
115<DD>
116<DT><SAMP>&lsquo;--properties-input&rsquo;</SAMP>
117<DD>
118<A NAME="IDX225"></A>
119<A NAME="IDX226"></A>
120Assume the input file is a Java ResourceBundle in Java <CODE>.properties</CODE>
121syntax, not in PO file syntax.
122
123<DT><SAMP>&lsquo;--stringtable-input&rsquo;</SAMP>
124<DD>
125<A NAME="IDX227"></A>
126Assume the input file is a NeXTstep/GNUstep localized resource file in
127<CODE>.strings</CODE> syntax, not in PO file syntax.
128
129</DL>
130
131
132
133<H3><A NAME="SEC36" HREF="gettext_toc.html#TOC36">6.1.4  Output details</A></H3>
134
135<DL COMPACT>
136
137<DT><SAMP>&lsquo;-l <VAR>ll_CC</VAR>&rsquo;</SAMP>
138<DD>
139<DT><SAMP>&lsquo;--locale=<VAR>ll_CC</VAR>&rsquo;</SAMP>
140<DD>
141<A NAME="IDX228"></A>
142<A NAME="IDX229"></A>
143Set target locale.  <VAR>ll</VAR> should be a language code, and <VAR>CC</VAR> should
144be a country code.  The command <SAMP>&lsquo;locale -a&rsquo;</SAMP> can be used to output a list
145of all installed locales.  The default is the user's locale setting.
146
147<DT><SAMP>&lsquo;--no-translator&rsquo;</SAMP>
148<DD>
149<A NAME="IDX230"></A>
150Declares that the PO file will not have a human translator and is instead
151automatically generated.
152
153<DT><SAMP>&lsquo;-p&rsquo;</SAMP>
154<DD>
155<DT><SAMP>&lsquo;--properties-output&rsquo;</SAMP>
156<DD>
157<A NAME="IDX231"></A>
158<A NAME="IDX232"></A>
159Write out a Java ResourceBundle in Java <CODE>.properties</CODE> syntax.  Note
160that this file format doesn't support plural forms and silently drops
161obsolete messages.
162
163<DT><SAMP>&lsquo;--stringtable-output&rsquo;</SAMP>
164<DD>
165<A NAME="IDX233"></A>
166Write out a NeXTstep/GNUstep localized resource file in <CODE>.strings</CODE> syntax.
167Note that this file format doesn't support plural forms.
168
169<DT><SAMP>&lsquo;-w <VAR>number</VAR>&rsquo;</SAMP>
170<DD>
171<DT><SAMP>&lsquo;--width=<VAR>number</VAR>&rsquo;</SAMP>
172<DD>
173<A NAME="IDX234"></A>
174<A NAME="IDX235"></A>
175Set the output page width.  Long strings in the output files will be
176split across multiple lines in order to ensure that each line's width
177(= number of screen columns) is less or equal to the given <VAR>number</VAR>.
178
179<DT><SAMP>&lsquo;--no-wrap&rsquo;</SAMP>
180<DD>
181<A NAME="IDX236"></A>
182Do not break long message lines.  Message lines whose width exceeds the
183output page width will not be split into several lines.  Only file reference
184lines which are wider than the output page width will be split.
185
186</DL>
187
188
189
190<H3><A NAME="SEC37" HREF="gettext_toc.html#TOC37">6.1.5  Informative output</A></H3>
191
192<DL COMPACT>
193
194<DT><SAMP>&lsquo;-h&rsquo;</SAMP>
195<DD>
196<DT><SAMP>&lsquo;--help&rsquo;</SAMP>
197<DD>
198<A NAME="IDX237"></A>
199<A NAME="IDX238"></A>
200Display this help and exit.
201
202<DT><SAMP>&lsquo;-V&rsquo;</SAMP>
203<DD>
204<DT><SAMP>&lsquo;--version&rsquo;</SAMP>
205<DD>
206<A NAME="IDX239"></A>
207<A NAME="IDX240"></A>
208Output version information and exit.
209
210</DL>
211
212
213
214<H2><A NAME="SEC38" HREF="gettext_toc.html#TOC38">6.2  Filling in the Header Entry</A></H2>
215<P>
216<A NAME="IDX241"></A>
217
218</P>
219<P>
220The initial comments "SOME DESCRIPTIVE TITLE", "YEAR" and
221"FIRST AUTHOR &#60;EMAIL@ADDRESS&#62;, YEAR" ought to be replaced by sensible
222information.  This can be done in any text editor; if Emacs is used
223and it switched to PO mode automatically (because it has recognized
224the file's suffix), you can disable it by typing <KBD>M-x fundamental-mode</KBD>.
225
226</P>
227<P>
228Modifying the header entry can already be done using PO mode: in Emacs,
229type <KBD>M-x po-mode RET</KBD> and then <KBD>RET</KBD> again to start editing the
230entry.  You should fill in the following fields.
231
232</P>
233<DL COMPACT>
234
235<DT>Project-Id-Version
236<DD>
237This is the name and version of the package.
238
239<DT>Report-Msgid-Bugs-To
240<DD>
241This has already been filled in by <CODE>xgettext</CODE>.  It contains an email
242address or URL where you can report bugs in the untranslated strings:
243
244
245<UL>
246<LI>Strings which are not entire sentences, see the maintainer guidelines
247
248in section <A HREF="gettext_4.html#SEC14">4.3  Preparing Translatable Strings</A>.
249<LI>Strings which use unclear terms or require additional context to be
250
251understood.
252<LI>Strings which make invalid assumptions about notation of date, time or
253
254money.
255<LI>Pluralisation problems.
256
257<LI>Incorrect English spelling.
258
259<LI>Incorrect formatting.
260
261</UL>
262
263<DT>POT-Creation-Date
264<DD>
265This has already been filled in by <CODE>xgettext</CODE>.
266
267<DT>PO-Revision-Date
268<DD>
269You don't need to fill this in.  It will be filled by the PO file editor
270when you save the file.
271
272<DT>Last-Translator
273<DD>
274Fill in your name and email address (without double quotes).
275
276<DT>Language-Team
277<DD>
278Fill in the English name of the language, and the email address or
279homepage URL of the language team you are part of.
280
281Before starting a translation, it is a good idea to get in touch with
282your translation team, not only to make sure you don't do duplicated work,
283but also to coordinate difficult linguistic issues.
284
285<A NAME="IDX242"></A>
286In the Free Translation Project, each translation team has its own mailing
287list.  The up-to-date list of teams can be found at the Free Translation
288Project's homepage, <A HREF="http://www.iro.umontreal.ca/contrib/po/HTML/">http://www.iro.umontreal.ca/contrib/po/HTML/</A>,
289in the "National teams" area.
290
291<DT>Content-Type
292<DD>
293<A NAME="IDX243"></A>
294<A NAME="IDX244"></A>
295Replace <SAMP>&lsquo;CHARSET&rsquo;</SAMP> with the character encoding used for your language,
296in your locale, or UTF-8.  This field is needed for correct operation of the
297<CODE>msgmerge</CODE> and <CODE>msgfmt</CODE> programs, as well as for users whose
298locale's character encoding differs from yours (see section <A HREF="gettext_11.html#SEC172">11.2.4  How to specify the output character set <CODE>gettext</CODE> uses</A>).
299
300<A NAME="IDX245"></A>
301You get the character encoding of your locale by running the shell command
302<SAMP>&lsquo;locale charmap&rsquo;</SAMP>.  If the result is <SAMP>&lsquo;C&rsquo;</SAMP> or <SAMP>&lsquo;ANSI_X3.4-1968&rsquo;</SAMP>,
303which is equivalent to <SAMP>&lsquo;ASCII&rsquo;</SAMP> (= <SAMP>&lsquo;US-ASCII&rsquo;</SAMP>), it means that your
304locale is not correctly configured.  In this case, ask your translation
305team which charset to use.  <SAMP>&lsquo;ASCII&rsquo;</SAMP> is not usable for any language
306except Latin.
307
308<A NAME="IDX246"></A>
309Because the PO files must be portable to operating systems with less advanced
310internationalization facilities, the character encodings that can be used
311are limited to those supported by both GNU <CODE>libc</CODE> and GNU
312<CODE>libiconv</CODE>.  These are:
313<CODE>ASCII</CODE>, <CODE>ISO-8859-1</CODE>, <CODE>ISO-8859-2</CODE>, <CODE>ISO-8859-3</CODE>,
314<CODE>ISO-8859-4</CODE>, <CODE>ISO-8859-5</CODE>, <CODE>ISO-8859-6</CODE>, <CODE>ISO-8859-7</CODE>,
315<CODE>ISO-8859-8</CODE>, <CODE>ISO-8859-9</CODE>, <CODE>ISO-8859-13</CODE>, <CODE>ISO-8859-14</CODE>,
316<CODE>ISO-8859-15</CODE>,
317<CODE>KOI8-R</CODE>, <CODE>KOI8-U</CODE>, <CODE>KOI8-T</CODE>,
318<CODE>CP850</CODE>, <CODE>CP866</CODE>, <CODE>CP874</CODE>,
319<CODE>CP932</CODE>, <CODE>CP949</CODE>, <CODE>CP950</CODE>, <CODE>CP1250</CODE>, <CODE>CP1251</CODE>,
320<CODE>CP1252</CODE>, <CODE>CP1253</CODE>, <CODE>CP1254</CODE>, <CODE>CP1255</CODE>, <CODE>CP1256</CODE>,
321<CODE>CP1257</CODE>, <CODE>GB2312</CODE>, <CODE>EUC-JP</CODE>, <CODE>EUC-KR</CODE>, <CODE>EUC-TW</CODE>,
322<CODE>BIG5</CODE>, <CODE>BIG5-HKSCS</CODE>, <CODE>GBK</CODE>, <CODE>GB18030</CODE>, <CODE>SHIFT_JIS</CODE>,
323<CODE>JOHAB</CODE>, <CODE>TIS-620</CODE>, <CODE>VISCII</CODE>, <CODE>GEORGIAN-PS</CODE>, <CODE>UTF-8</CODE>.
324
325<A NAME="IDX247"></A>
326In the GNU system, the following encodings are frequently used for the
327corresponding languages.
328
329<A NAME="IDX248"></A>
330
331<UL>
332<LI><CODE>ISO-8859-1</CODE> for
333
334Afrikaans, Albanian, Basque, Breton, Catalan, Cornish, Danish, Dutch,
335English, Estonian, Faroese, Finnish, French, Galician, German,
336Greenlandic, Icelandic, Indonesian, Irish, Italian, Malay, Manx,
337Norwegian, Occitan, Portuguese, Spanish, Swedish, Tagalog, Uzbek,
338Walloon,
339<LI><CODE>ISO-8859-2</CODE> for
340
341Bosnian, Croatian, Czech, Hungarian, Polish, Romanian, Serbian, Slovak,
342Slovenian,
343<LI><CODE>ISO-8859-3</CODE> for Maltese,
344
345<LI><CODE>ISO-8859-5</CODE> for Macedonian, Serbian,
346
347<LI><CODE>ISO-8859-6</CODE> for Arabic,
348
349<LI><CODE>ISO-8859-7</CODE> for Greek,
350
351<LI><CODE>ISO-8859-8</CODE> for Hebrew,
352
353<LI><CODE>ISO-8859-9</CODE> for Turkish,
354
355<LI><CODE>ISO-8859-13</CODE> for Latvian, Lithuanian, Maori,
356
357<LI><CODE>ISO-8859-14</CODE> for Welsh,
358
359<LI><CODE>ISO-8859-15</CODE> for
360
361Basque, Catalan, Dutch, English, Finnish, French, Galician, German, Irish,
362Italian, Portuguese, Spanish, Swedish, Walloon,
363<LI><CODE>KOI8-R</CODE> for Russian,
364
365<LI><CODE>KOI8-U</CODE> for Ukrainian,
366
367<LI><CODE>KOI8-T</CODE> for Tajik,
368
369<LI><CODE>CP1251</CODE> for Bulgarian, Byelorussian,
370
371<LI><CODE>GB2312</CODE>, <CODE>GBK</CODE>, <CODE>GB18030</CODE>
372
373for simplified writing of Chinese,
374<LI><CODE>BIG5</CODE>, <CODE>BIG5-HKSCS</CODE>
375
376for traditional writing of Chinese,
377<LI><CODE>EUC-JP</CODE> for Japanese,
378
379<LI><CODE>EUC-KR</CODE> for Korean,
380
381<LI><CODE>TIS-620</CODE> for Thai,
382
383<LI><CODE>GEORGIAN-PS</CODE> for Georgian,
384
385<LI><CODE>UTF-8</CODE> for any language, including those listed above.
386
387</UL>
388
389<A NAME="IDX249"></A>
390<A NAME="IDX250"></A>
391When single quote characters or double quote characters are used in
392translations for your language, and your locale's encoding is one of the
393ISO-8859-* charsets, it is best if you create your PO files in UTF-8
394encoding, instead of your locale's encoding.  This is because in UTF-8
395the real quote characters can be represented (single quote characters:
396U+2018, U+2019, double quote characters: U+201C, U+201D), whereas none of
397ISO-8859-* charsets has them all.  Users in UTF-8 locales will see the
398real quote characters, whereas users in ISO-8859-* locales will see the
399vertical apostrophe and the vertical double quote instead (because that's
400what the character set conversion will transliterate them to).
401
402<A NAME="IDX251"></A>
403To enter such quote characters under X11, you can change your keyboard
404mapping using the <CODE>xmodmap</CODE> program.  The X11 names of the quote
405characters are "leftsinglequotemark", "rightsinglequotemark",
406"leftdoublequotemark", "rightdoublequotemark", "singlelowquotemark",
407"doublelowquotemark".
408
409Note that only recent versions of GNU Emacs support the UTF-8 encoding:
410Emacs 20 with Mule-UCS, and Emacs 21.  As of January 2001, XEmacs doesn't
411support the UTF-8 encoding.
412
413The character encoding name can be written in either upper or lower case.
414Usually upper case is preferred.
415
416<DT>Content-Transfer-Encoding
417<DD>
418Set this to <CODE>8bit</CODE>.
419
420<DT>Plural-Forms
421<DD>
422This field is optional.  It is only needed if the PO file has plural forms.
423You can find them by searching for the <SAMP>&lsquo;msgid_plural&rsquo;</SAMP> keyword.  The
424format of the plural forms field is described in section <A HREF="gettext_11.html#SEC174">11.2.6  Additional functions for plural forms</A>.
425</DL>
426
427<P><HR><P>
428Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_5.html">previous</A>, <A HREF="gettext_7.html">next</A>, <A HREF="gettext_25.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>.
429</BODY>
430</HTML>
431