1<HTML>
2<HEAD>
3<!-- This HTML file has been created by texi2html 1.52b
4     from gettext.texi on 29 December 2011 -->
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="SEC37" HREF="gettext_toc.html#TOC37">6  Creating a New PO File</A></H1>
15<P>
16<A NAME="IDX231"></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="SEC38" HREF="gettext_toc.html#TOC38">6.1  Invoking the <CODE>msginit</CODE> Program</A></H2>
49
50<P>
51<A NAME="IDX232"></A>
52<A NAME="IDX233"></A>
53
54<PRE>
55msginit [<VAR>option</VAR>]
56</PRE>
57
58<P>
59<A NAME="IDX234"></A>
60<A NAME="IDX235"></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="SEC39" HREF="gettext_toc.html#TOC39">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="IDX236"></A>
76<A NAME="IDX237"></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="SEC40" HREF="gettext_toc.html#TOC40">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="IDX238"></A>
97<A NAME="IDX239"></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="SEC41" HREF="gettext_toc.html#TOC41">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="IDX240"></A>
119<A NAME="IDX241"></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="IDX242"></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="SEC42" HREF="gettext_toc.html#TOC42">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="IDX243"></A>
142<A NAME="IDX244"></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="IDX245"></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="IDX246"></A>
158<A NAME="IDX247"></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="IDX248"></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="IDX249"></A>
174<A NAME="IDX250"></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="IDX251"></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="SEC43" HREF="gettext_toc.html#TOC43">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="IDX252"></A>
199<A NAME="IDX253"></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="IDX254"></A>
207<A NAME="IDX255"></A>
208Output version information and exit.
209
210</DL>
211
212
213
214<H2><A NAME="SEC44" HREF="gettext_toc.html#TOC44">6.2  Filling in the Header Entry</A></H2>
215<P>
216<A NAME="IDX256"></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.  Fill it in if it has not
238already been filled in by <CODE>xgettext</CODE>.
239
240<DT>Report-Msgid-Bugs-To
241<DD>
242This has already been filled in by <CODE>xgettext</CODE>.  It contains an email
243address or URL where you can report bugs in the untranslated strings:
244
245
246<UL>
247<LI>Strings which are not entire sentences, see the maintainer guidelines
248
249in section <A HREF="gettext_4.html#SEC19">4.3  Preparing Translatable Strings</A>.
250<LI>Strings which use unclear terms or require additional context to be
251
252understood.
253<LI>Strings which make invalid assumptions about notation of date, time or
254
255money.
256<LI>Pluralisation problems.
257
258<LI>Incorrect English spelling.
259
260<LI>Incorrect formatting.
261
262</UL>
263
264<DT>POT-Creation-Date
265<DD>
266This has already been filled in by <CODE>xgettext</CODE>.
267
268<DT>PO-Revision-Date
269<DD>
270You don't need to fill this in.  It will be filled by the PO file editor
271when you save the file.
272
273<DT>Last-Translator
274<DD>
275Fill in your name and email address (without double quotes).
276
277<DT>Language-Team
278<DD>
279Fill in the English name of the language, and the email address or
280homepage URL of the language team you are part of.
281
282Before starting a translation, it is a good idea to get in touch with
283your translation team, not only to make sure you don't do duplicated work,
284but also to coordinate difficult linguistic issues.
285
286<A NAME="IDX257"></A>
287In the Free Translation Project, each translation team has its own mailing
288list.  The up-to-date list of teams can be found at the Free Translation
289Project's homepage, <A HREF="http://translationproject.org/">http://translationproject.org/</A>, in the "Teams"
290area.
291
292<DT>Content-Type
293<DD>
294<A NAME="IDX258"></A>
295<A NAME="IDX259"></A>
296Replace <SAMP>&lsquo;CHARSET&rsquo;</SAMP> with the character encoding used for your language,
297in your locale, or UTF-8.  This field is needed for correct operation of the
298<CODE>msgmerge</CODE> and <CODE>msgfmt</CODE> programs, as well as for users whose
299locale's character encoding differs from yours (see section <A HREF="gettext_11.html#SEC186">11.2.4  How to specify the output character set <CODE>gettext</CODE> uses</A>).
300
301<A NAME="IDX260"></A>
302You get the character encoding of your locale by running the shell command
303<SAMP>&lsquo;locale charmap&rsquo;</SAMP>.  If the result is <SAMP>&lsquo;C&rsquo;</SAMP> or <SAMP>&lsquo;ANSI_X3.4-1968&rsquo;</SAMP>,
304which is equivalent to <SAMP>&lsquo;ASCII&rsquo;</SAMP> (= <SAMP>&lsquo;US-ASCII&rsquo;</SAMP>), it means that your
305locale is not correctly configured.  In this case, ask your translation
306team which charset to use.  <SAMP>&lsquo;ASCII&rsquo;</SAMP> is not usable for any language
307except Latin.
308
309<A NAME="IDX261"></A>
310Because the PO files must be portable to operating systems with less advanced
311internationalization facilities, the character encodings that can be used
312are limited to those supported by both GNU <CODE>libc</CODE> and GNU
313<CODE>libiconv</CODE>.  These are:
314<CODE>ASCII</CODE>, <CODE>ISO-8859-1</CODE>, <CODE>ISO-8859-2</CODE>, <CODE>ISO-8859-3</CODE>,
315<CODE>ISO-8859-4</CODE>, <CODE>ISO-8859-5</CODE>, <CODE>ISO-8859-6</CODE>, <CODE>ISO-8859-7</CODE>,
316<CODE>ISO-8859-8</CODE>, <CODE>ISO-8859-9</CODE>, <CODE>ISO-8859-13</CODE>, <CODE>ISO-8859-14</CODE>,
317<CODE>ISO-8859-15</CODE>,
318<CODE>KOI8-R</CODE>, <CODE>KOI8-U</CODE>, <CODE>KOI8-T</CODE>,
319<CODE>CP850</CODE>, <CODE>CP866</CODE>, <CODE>CP874</CODE>,
320<CODE>CP932</CODE>, <CODE>CP949</CODE>, <CODE>CP950</CODE>, <CODE>CP1250</CODE>, <CODE>CP1251</CODE>,
321<CODE>CP1252</CODE>, <CODE>CP1253</CODE>, <CODE>CP1254</CODE>, <CODE>CP1255</CODE>, <CODE>CP1256</CODE>,
322<CODE>CP1257</CODE>, <CODE>GB2312</CODE>, <CODE>EUC-JP</CODE>, <CODE>EUC-KR</CODE>, <CODE>EUC-TW</CODE>,
323<CODE>BIG5</CODE>, <CODE>BIG5-HKSCS</CODE>, <CODE>GBK</CODE>, <CODE>GB18030</CODE>, <CODE>SHIFT_JIS</CODE>,
324<CODE>JOHAB</CODE>, <CODE>TIS-620</CODE>, <CODE>VISCII</CODE>, <CODE>GEORGIAN-PS</CODE>, <CODE>UTF-8</CODE>.
325
326<A NAME="IDX262"></A>
327In the GNU system, the following encodings are frequently used for the
328corresponding languages.
329
330<A NAME="IDX263"></A>
331
332<UL>
333<LI><CODE>ISO-8859-1</CODE> for
334
335Afrikaans, Albanian, Basque, Breton, Catalan, Cornish, Danish, Dutch,
336English, Estonian, Faroese, Finnish, French, Galician, German,
337Greenlandic, Icelandic, Indonesian, Irish, Italian, Malay, Manx,
338Norwegian, Occitan, Portuguese, Spanish, Swedish, Tagalog, Uzbek,
339Walloon,
340<LI><CODE>ISO-8859-2</CODE> for
341
342Bosnian, Croatian, Czech, Hungarian, Polish, Romanian, Serbian, Slovak,
343Slovenian,
344<LI><CODE>ISO-8859-3</CODE> for Maltese,
345
346<LI><CODE>ISO-8859-5</CODE> for Macedonian, Serbian,
347
348<LI><CODE>ISO-8859-6</CODE> for Arabic,
349
350<LI><CODE>ISO-8859-7</CODE> for Greek,
351
352<LI><CODE>ISO-8859-8</CODE> for Hebrew,
353
354<LI><CODE>ISO-8859-9</CODE> for Turkish,
355
356<LI><CODE>ISO-8859-13</CODE> for Latvian, Lithuanian, Maori,
357
358<LI><CODE>ISO-8859-14</CODE> for Welsh,
359
360<LI><CODE>ISO-8859-15</CODE> for
361
362Basque, Catalan, Dutch, English, Finnish, French, Galician, German, Irish,
363Italian, Portuguese, Spanish, Swedish, Walloon,
364<LI><CODE>KOI8-R</CODE> for Russian,
365
366<LI><CODE>KOI8-U</CODE> for Ukrainian,
367
368<LI><CODE>KOI8-T</CODE> for Tajik,
369
370<LI><CODE>CP1251</CODE> for Bulgarian, Byelorussian,
371
372<LI><CODE>GB2312</CODE>, <CODE>GBK</CODE>, <CODE>GB18030</CODE>
373
374for simplified writing of Chinese,
375<LI><CODE>BIG5</CODE>, <CODE>BIG5-HKSCS</CODE>
376
377for traditional writing of Chinese,
378<LI><CODE>EUC-JP</CODE> for Japanese,
379
380<LI><CODE>EUC-KR</CODE> for Korean,
381
382<LI><CODE>TIS-620</CODE> for Thai,
383
384<LI><CODE>GEORGIAN-PS</CODE> for Georgian,
385
386<LI><CODE>UTF-8</CODE> for any language, including those listed above.
387
388</UL>
389
390<A NAME="IDX264"></A>
391<A NAME="IDX265"></A>
392When single quote characters or double quote characters are used in
393translations for your language, and your locale's encoding is one of the
394ISO-8859-* charsets, it is best if you create your PO files in UTF-8
395encoding, instead of your locale's encoding.  This is because in UTF-8
396the real quote characters can be represented (single quote characters:
397U+2018, U+2019, double quote characters: U+201C, U+201D), whereas none of
398ISO-8859-* charsets has them all.  Users in UTF-8 locales will see the
399real quote characters, whereas users in ISO-8859-* locales will see the
400vertical apostrophe and the vertical double quote instead (because that's
401what the character set conversion will transliterate them to).
402
403<A NAME="IDX266"></A>
404To enter such quote characters under X11, you can change your keyboard
405mapping using the <CODE>xmodmap</CODE> program.  The X11 names of the quote
406characters are "leftsinglequotemark", "rightsinglequotemark",
407"leftdoublequotemark", "rightdoublequotemark", "singlelowquotemark",
408"doublelowquotemark".
409
410Note that only recent versions of GNU Emacs support the UTF-8 encoding:
411Emacs 20 with Mule-UCS, and Emacs 21.  As of January 2001, XEmacs doesn't
412support the UTF-8 encoding.
413
414The character encoding name can be written in either upper or lower case.
415Usually upper case is preferred.
416
417<DT>Content-Transfer-Encoding
418<DD>
419Set this to <CODE>8bit</CODE>.
420
421<DT>Plural-Forms
422<DD>
423This field is optional.  It is only needed if the PO file has plural forms.
424You can find them by searching for the <SAMP>&lsquo;msgid_plural&rsquo;</SAMP> keyword.  The
425format of the plural forms field is described in section <A HREF="gettext_11.html#SEC188">11.2.6  Additional functions for plural forms</A>.
426</DL>
427
428<P><HR><P>
429Go 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>.
430</BODY>
431</HTML>
432