Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/share/doc/gettext/gettext_3.html @ 68:5028fdace37b
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 16:23:26 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 68:5028fdace37b |
---|---|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> | |
2 <html> | |
3 <!-- Created on February, 21 2024 by texi2html 1.78a --> | |
4 <!-- | |
5 Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) | |
6 Karl Berry <karl@freefriends.org> | |
7 Olaf Bachmann <obachman@mathematik.uni-kl.de> | |
8 and many others. | |
9 Maintained by: Many creative people. | |
10 Send bugs and suggestions to <texi2html-bug@nongnu.org> | |
11 | |
12 --> | |
13 <head> | |
14 <title>GNU gettext utilities: 3. The Format of PO Files</title> | |
15 | |
16 <meta name="description" content="GNU gettext utilities: 3. The Format of PO Files"> | |
17 <meta name="keywords" content="GNU gettext utilities: 3. The Format of PO Files"> | |
18 <meta name="resource-type" content="document"> | |
19 <meta name="distribution" content="global"> | |
20 <meta name="Generator" content="texi2html 1.78a"> | |
21 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
22 <style type="text/css"> | |
23 <!-- | |
24 a.summary-letter {text-decoration: none} | |
25 pre.display {font-family: serif} | |
26 pre.format {font-family: serif} | |
27 pre.menu-comment {font-family: serif} | |
28 pre.menu-preformatted {font-family: serif} | |
29 pre.smalldisplay {font-family: serif; font-size: smaller} | |
30 pre.smallexample {font-size: smaller} | |
31 pre.smallformat {font-family: serif; font-size: smaller} | |
32 pre.smalllisp {font-size: smaller} | |
33 span.roman {font-family:serif; font-weight:normal;} | |
34 span.sansserif {font-family:sans-serif; font-weight:normal;} | |
35 ul.toc {list-style: none} | |
36 --> | |
37 </style> | |
38 | |
39 | |
40 </head> | |
41 | |
42 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> | |
43 | |
44 <table cellpadding="1" cellspacing="1" border="0"> | |
45 <tr><td valign="middle" align="left">[<a href="gettext_2.html#SEC7" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
46 <td valign="middle" align="left">[<a href="gettext_4.html#SEC17" title="Next chapter"> >> </a>]</td> | |
47 <td valign="middle" align="left"> </td> | |
48 <td valign="middle" align="left"> </td> | |
49 <td valign="middle" align="left"> </td> | |
50 <td valign="middle" align="left"> </td> | |
51 <td valign="middle" align="left"> </td> | |
52 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
53 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
54 <td valign="middle" align="left">[<a href="gettext_21.html#SEC389" title="Index">Index</a>]</td> | |
55 <td valign="middle" align="left">[<a href="gettext_abt.html#SEC_About" title="About (help)"> ? </a>]</td> | |
56 </tr></table> | |
57 | |
58 <hr size="2"> | |
59 <a name="PO-Files"></a> | |
60 <a name="SEC16"></a> | |
61 <h1 class="chapter"> <a href="gettext_toc.html#TOC16">3. The Format of PO Files</a> </h1> | |
62 | |
63 <p>The GNU <code>gettext</code> toolset helps programmers and translators | |
64 at producing, updating and using translation files, mainly those | |
65 PO files which are textual, editable files. This chapter explains | |
66 the format of PO files. | |
67 </p> | |
68 <p>A PO file is made up of many entries, each entry holding the relation | |
69 between an original untranslated string and its corresponding | |
70 translation. All entries in a given PO file usually pertain | |
71 to a single project, and all translations are expressed in a single | |
72 target language. One PO file <em>entry</em> has the following schematic | |
73 structure: | |
74 </p> | |
75 <table><tr><td> </td><td><pre class="example"><var>white-space</var> | |
76 # <var>translator-comments</var> | |
77 #. <var>extracted-comments</var> | |
78 #: <var>reference</var>… | |
79 #, <var>flag</var>… | |
80 #| msgid <var>previous-untranslated-string</var> | |
81 msgid <var>untranslated-string</var> | |
82 msgstr <var>translated-string</var> | |
83 </pre></td></tr></table> | |
84 | |
85 <p>The general structure of a PO file should be well understood by | |
86 the translator. When using PO mode, very little has to be known | |
87 about the format details, as PO mode takes care of them for her. | |
88 </p> | |
89 <p>A simple entry can look like this: | |
90 </p> | |
91 <table><tr><td> </td><td><pre class="example">#: lib/error.c:116 | |
92 msgid "Unknown system error" | |
93 msgstr "Error desconegut del sistema" | |
94 </pre></td></tr></table> | |
95 | |
96 <a name="IDX43"></a> | |
97 <a name="IDX44"></a> | |
98 <a name="IDX45"></a> | |
99 <p>Entries begin with some optional white space. Usually, when generated | |
100 through GNU <code>gettext</code> tools, there is exactly one blank line | |
101 between entries. Then comments follow, on lines all starting with the | |
102 character <code>#</code>. There are two kinds of comments: those which have | |
103 some white space immediately following the <code>#</code> - the <var>translator | |
104 comments</var> -, which comments are created and maintained exclusively by the | |
105 translator, and those which have some non-white character just after the | |
106 <code>#</code> - the <var>automatic comments</var> -, which comments are created and | |
107 maintained automatically by GNU <code>gettext</code> tools. Comment lines | |
108 starting with <code>#.</code> contain comments given by the programmer, directed | |
109 at the translator; these comments are called <var>extracted comments</var> | |
110 because the <code>xgettext</code> program extracts them from the program's | |
111 source code. Comment lines starting with <code>#:</code> contain references to | |
112 the program's source code. Comment lines starting with <code>#,</code> contain | |
113 flags; more about these below. Comment lines starting with <code>#|</code> | |
114 contain the previous untranslated string for which the translator gave | |
115 a translation. | |
116 </p> | |
117 <p>All comments, of either kind, are optional. | |
118 </p> | |
119 <p>References to the program's source code, in lines that start with <code>#:</code>, | |
120 are of the form <code><var>file_name</var>:<var>line_number</var></code> or just | |
121 <var>file_name</var>. If the <var>file_name</var> contains spaces. it is enclosed | |
122 within Unicode characters U+2068 and U+2069. | |
123 </p> | |
124 <a name="IDX46"></a> | |
125 <a name="IDX47"></a> | |
126 <p>After white space and comments, entries show two strings, namely | |
127 first the untranslated string as it appears in the original program | |
128 sources, and then, the translation of this string. The original | |
129 string is introduced by the keyword <code>msgid</code>, and the translation, | |
130 by <code>msgstr</code>. The two strings, untranslated and translated, | |
131 are quoted in various ways in the PO file, using <code>"</code> | |
132 delimiters and <code>\</code> escapes, but the translator does not really | |
133 have to pay attention to the precise quoting format, as PO mode fully | |
134 takes care of quoting for her. | |
135 </p> | |
136 <p>The <code>msgid</code> strings, as well as automatic comments, are produced | |
137 and managed by other GNU <code>gettext</code> tools, and PO mode does not | |
138 provide means for the translator to alter these. The most she can | |
139 do is merely deleting them, and only by deleting the whole entry. | |
140 On the other hand, the <code>msgstr</code> string, as well as translator | |
141 comments, are really meant for the translator, and PO mode gives her | |
142 the full control she needs. | |
143 </p> | |
144 <p>The comment lines beginning with <code>#,</code> are special because they are | |
145 not completely ignored by the programs as comments generally are. The | |
146 comma separated list of <var>flag</var>s is used by the <code>msgfmt</code> | |
147 program to give the user some better diagnostic messages. Currently | |
148 there are two forms of flags defined: | |
149 </p> | |
150 <dl compact="compact"> | |
151 <dt> <code>fuzzy</code></dt> | |
152 <dd><a name="IDX48"></a> | |
153 <p>This flag can be generated by the <code>msgmerge</code> program or it can be | |
154 inserted by the translator herself. It shows that the <code>msgstr</code> | |
155 string might not be a correct translation (anymore). Only the translator | |
156 can judge if the translation requires further modification, or is | |
157 acceptable as is. Once satisfied with the translation, she then removes | |
158 this <code>fuzzy</code> attribute. The <code>msgmerge</code> program inserts this | |
159 when it combined the <code>msgid</code> and <code>msgstr</code> entries after fuzzy | |
160 search only. See section <a href="gettext_8.html#SEC72">Fuzzy Entries</a>. | |
161 </p> | |
162 </dd> | |
163 <dt> <code>c-format</code></dt> | |
164 <dd><a name="IDX49"></a> | |
165 </dd> | |
166 <dt> <code>no-c-format</code></dt> | |
167 <dd><a name="IDX50"></a> | |
168 <p>These flags should not be added by a human. Instead only the | |
169 <code>xgettext</code> program adds them. In an automated PO file processing | |
170 system as proposed here, the user's changes would be thrown away again as | |
171 soon as the <code>xgettext</code> program generates a new template file. | |
172 </p> | |
173 <p>The <code>c-format</code> flag indicates that the untranslated string and the | |
174 translation are supposed to be C format strings. The <code>no-c-format</code> | |
175 flag indicates that they are not C format strings, even though the untranslated | |
176 string happens to look like a C format string (with ‘<samp>%</samp>’ directives). | |
177 </p> | |
178 <p>When the <code>c-format</code> flag is given for a string the <code>msgfmt</code> | |
179 program does some more tests to check the validity of the translation. | |
180 See section <a href="gettext_10.html#SEC174">Invoking the <code>msgfmt</code> Program</a>, <a href="gettext_4.html#SEC30">Special Comments preceding Keywords</a> and <a href="gettext_15.html#SEC267">C Format Strings</a>. | |
181 </p> | |
182 </dd> | |
183 <dt> <code>objc-format</code></dt> | |
184 <dd><a name="IDX51"></a> | |
185 </dd> | |
186 <dt> <code>no-objc-format</code></dt> | |
187 <dd><a name="IDX52"></a> | |
188 <p>Likewise for Objective C, see <a href="gettext_15.html#SEC268">Objective C Format Strings</a>. | |
189 </p> | |
190 </dd> | |
191 <dt> <code>c++-format</code></dt> | |
192 <dd><a name="IDX53"></a> | |
193 </dd> | |
194 <dt> <code>no-c++-format</code></dt> | |
195 <dd><a name="IDX54"></a> | |
196 <p>Likewise for C++, see <a href="gettext_15.html#SEC269">C++ Format Strings</a>. | |
197 </p> | |
198 </dd> | |
199 <dt> <code>python-format</code></dt> | |
200 <dd><a name="IDX55"></a> | |
201 </dd> | |
202 <dt> <code>no-python-format</code></dt> | |
203 <dd><a name="IDX56"></a> | |
204 <p>Likewise for Python, see <a href="gettext_15.html#SEC270">Python Format Strings</a>. | |
205 </p> | |
206 </dd> | |
207 <dt> <code>python-brace-format</code></dt> | |
208 <dd><a name="IDX57"></a> | |
209 </dd> | |
210 <dt> <code>no-python-brace-format</code></dt> | |
211 <dd><a name="IDX58"></a> | |
212 <p>Likewise for Python brace, see <a href="gettext_15.html#SEC270">Python Format Strings</a>. | |
213 </p> | |
214 </dd> | |
215 <dt> <code>java-format</code></dt> | |
216 <dd><a name="IDX59"></a> | |
217 </dd> | |
218 <dt> <code>no-java-format</code></dt> | |
219 <dd><a name="IDX60"></a> | |
220 <p>Likewise for Java <code>MessageFormat</code> format strings, see <a href="gettext_15.html#SEC271">Java Format Strings</a>. | |
221 </p> | |
222 </dd> | |
223 <dt> <code>java-printf-format</code></dt> | |
224 <dd><a name="IDX61"></a> | |
225 </dd> | |
226 <dt> <code>no-java-printf-format</code></dt> | |
227 <dd><a name="IDX62"></a> | |
228 <p>Likewise for Java <code>printf</code> format strings, see <a href="gettext_15.html#SEC271">Java Format Strings</a>. | |
229 </p> | |
230 </dd> | |
231 <dt> <code>csharp-format</code></dt> | |
232 <dd><a name="IDX63"></a> | |
233 </dd> | |
234 <dt> <code>no-csharp-format</code></dt> | |
235 <dd><a name="IDX64"></a> | |
236 <p>Likewise for C#, see <a href="gettext_15.html#SEC272">C# Format Strings</a>. | |
237 </p> | |
238 </dd> | |
239 <dt> <code>javascript-format</code></dt> | |
240 <dd><a name="IDX65"></a> | |
241 </dd> | |
242 <dt> <code>no-javascript-format</code></dt> | |
243 <dd><a name="IDX66"></a> | |
244 <p>Likewise for JavaScript, see <a href="gettext_15.html#SEC273">JavaScript Format Strings</a>. | |
245 </p> | |
246 </dd> | |
247 <dt> <code>scheme-format</code></dt> | |
248 <dd><a name="IDX67"></a> | |
249 </dd> | |
250 <dt> <code>no-scheme-format</code></dt> | |
251 <dd><a name="IDX68"></a> | |
252 <p>Likewise for Scheme, see <a href="gettext_15.html#SEC274">Scheme Format Strings</a>. | |
253 </p> | |
254 </dd> | |
255 <dt> <code>lisp-format</code></dt> | |
256 <dd><a name="IDX69"></a> | |
257 </dd> | |
258 <dt> <code>no-lisp-format</code></dt> | |
259 <dd><a name="IDX70"></a> | |
260 <p>Likewise for Lisp, see <a href="gettext_15.html#SEC275">Lisp Format Strings</a>. | |
261 </p> | |
262 </dd> | |
263 <dt> <code>elisp-format</code></dt> | |
264 <dd><a name="IDX71"></a> | |
265 </dd> | |
266 <dt> <code>no-elisp-format</code></dt> | |
267 <dd><a name="IDX72"></a> | |
268 <p>Likewise for Emacs Lisp, see <a href="gettext_15.html#SEC276">Emacs Lisp Format Strings</a>. | |
269 </p> | |
270 </dd> | |
271 <dt> <code>librep-format</code></dt> | |
272 <dd><a name="IDX73"></a> | |
273 </dd> | |
274 <dt> <code>no-librep-format</code></dt> | |
275 <dd><a name="IDX74"></a> | |
276 <p>Likewise for librep, see <a href="gettext_15.html#SEC277">librep Format Strings</a>. | |
277 </p> | |
278 </dd> | |
279 <dt> <code>ruby-format</code></dt> | |
280 <dd><a name="IDX75"></a> | |
281 </dd> | |
282 <dt> <code>no-ruby-format</code></dt> | |
283 <dd><a name="IDX76"></a> | |
284 <p>Likewise for Ruby, see <a href="gettext_15.html#SEC278">Ruby Format Strings</a>. | |
285 </p> | |
286 </dd> | |
287 <dt> <code>sh-format</code></dt> | |
288 <dd><a name="IDX77"></a> | |
289 </dd> | |
290 <dt> <code>no-sh-format</code></dt> | |
291 <dd><a name="IDX78"></a> | |
292 <p>Likewise for Shell, see <a href="gettext_15.html#SEC279">Shell Format Strings</a>. | |
293 </p> | |
294 </dd> | |
295 <dt> <code>awk-format</code></dt> | |
296 <dd><a name="IDX79"></a> | |
297 </dd> | |
298 <dt> <code>no-awk-format</code></dt> | |
299 <dd><a name="IDX80"></a> | |
300 <p>Likewise for awk, see <a href="gettext_15.html#SEC280">awk Format Strings</a>. | |
301 </p> | |
302 </dd> | |
303 <dt> <code>lua-format</code></dt> | |
304 <dd><a name="IDX81"></a> | |
305 </dd> | |
306 <dt> <code>no-lua-format</code></dt> | |
307 <dd><a name="IDX82"></a> | |
308 <p>Likewise for Lua, see <a href="gettext_15.html#SEC281">Lua Format Strings</a>. | |
309 </p> | |
310 </dd> | |
311 <dt> <code>object-pascal-format</code></dt> | |
312 <dd><a name="IDX83"></a> | |
313 </dd> | |
314 <dt> <code>no-object-pascal-format</code></dt> | |
315 <dd><a name="IDX84"></a> | |
316 <p>Likewise for Object Pascal, see <a href="gettext_15.html#SEC282">Object Pascal Format Strings</a>. | |
317 </p> | |
318 </dd> | |
319 <dt> <code>smalltalk-format</code></dt> | |
320 <dd><a name="IDX85"></a> | |
321 </dd> | |
322 <dt> <code>no-smalltalk-format</code></dt> | |
323 <dd><a name="IDX86"></a> | |
324 <p>Likewise for Smalltalk, see <a href="gettext_15.html#SEC283">Smalltalk Format Strings</a>. | |
325 </p> | |
326 </dd> | |
327 <dt> <code>qt-format</code></dt> | |
328 <dd><a name="IDX87"></a> | |
329 </dd> | |
330 <dt> <code>no-qt-format</code></dt> | |
331 <dd><a name="IDX88"></a> | |
332 <p>Likewise for Qt, see <a href="gettext_15.html#SEC284">Qt Format Strings</a>. | |
333 </p> | |
334 </dd> | |
335 <dt> <code>qt-plural-format</code></dt> | |
336 <dd><a name="IDX89"></a> | |
337 </dd> | |
338 <dt> <code>no-qt-plural-format</code></dt> | |
339 <dd><a name="IDX90"></a> | |
340 <p>Likewise for Qt plural forms, see <a href="gettext_15.html#SEC285">Qt Format Strings</a>. | |
341 </p> | |
342 </dd> | |
343 <dt> <code>kde-format</code></dt> | |
344 <dd><a name="IDX91"></a> | |
345 </dd> | |
346 <dt> <code>no-kde-format</code></dt> | |
347 <dd><a name="IDX92"></a> | |
348 <p>Likewise for KDE, see <a href="gettext_15.html#SEC286">KDE Format Strings</a>. | |
349 </p> | |
350 </dd> | |
351 <dt> <code>boost-format</code></dt> | |
352 <dd><a name="IDX93"></a> | |
353 </dd> | |
354 <dt> <code>no-boost-format</code></dt> | |
355 <dd><a name="IDX94"></a> | |
356 <p>Likewise for Boost, see <a href="gettext_15.html#SEC288">Boost Format Strings</a>. | |
357 </p> | |
358 </dd> | |
359 <dt> <code>tcl-format</code></dt> | |
360 <dd><a name="IDX95"></a> | |
361 </dd> | |
362 <dt> <code>no-tcl-format</code></dt> | |
363 <dd><a name="IDX96"></a> | |
364 <p>Likewise for Tcl, see <a href="gettext_15.html#SEC289">Tcl Format Strings</a>. | |
365 </p> | |
366 </dd> | |
367 <dt> <code>perl-format</code></dt> | |
368 <dd><a name="IDX97"></a> | |
369 </dd> | |
370 <dt> <code>no-perl-format</code></dt> | |
371 <dd><a name="IDX98"></a> | |
372 <p>Likewise for Perl, see <a href="gettext_15.html#SEC290">Perl Format Strings</a>. | |
373 </p> | |
374 </dd> | |
375 <dt> <code>perl-brace-format</code></dt> | |
376 <dd><a name="IDX99"></a> | |
377 </dd> | |
378 <dt> <code>no-perl-brace-format</code></dt> | |
379 <dd><a name="IDX100"></a> | |
380 <p>Likewise for Perl brace, see <a href="gettext_15.html#SEC290">Perl Format Strings</a>. | |
381 </p> | |
382 </dd> | |
383 <dt> <code>php-format</code></dt> | |
384 <dd><a name="IDX101"></a> | |
385 </dd> | |
386 <dt> <code>no-php-format</code></dt> | |
387 <dd><a name="IDX102"></a> | |
388 <p>Likewise for PHP, see <a href="gettext_15.html#SEC291">PHP Format Strings</a>. | |
389 </p> | |
390 </dd> | |
391 <dt> <code>gcc-internal-format</code></dt> | |
392 <dd><a name="IDX103"></a> | |
393 </dd> | |
394 <dt> <code>no-gcc-internal-format</code></dt> | |
395 <dd><a name="IDX104"></a> | |
396 <p>Likewise for the GCC sources, see <a href="gettext_15.html#SEC292">GCC internal Format Strings</a>. | |
397 </p> | |
398 </dd> | |
399 <dt> <code>gfc-internal-format</code></dt> | |
400 <dd><a name="IDX105"></a> | |
401 </dd> | |
402 <dt> <code>no-gfc-internal-format</code></dt> | |
403 <dd><a name="IDX106"></a> | |
404 <p>Likewise for the GNU Fortran Compiler sources, see <a href="gettext_15.html#SEC293">GFC internal Format Strings</a>. | |
405 </p> | |
406 </dd> | |
407 <dt> <code>ycp-format</code></dt> | |
408 <dd><a name="IDX107"></a> | |
409 </dd> | |
410 <dt> <code>no-ycp-format</code></dt> | |
411 <dd><a name="IDX108"></a> | |
412 <p>Likewise for YCP, see <a href="gettext_15.html#SEC294">YCP Format Strings</a>. | |
413 </p> | |
414 </dd> | |
415 </dl> | |
416 | |
417 <a name="IDX109"></a> | |
418 <a name="IDX110"></a> | |
419 <p>It is also possible to have entries with a context specifier. They look like | |
420 this: | |
421 </p> | |
422 <table><tr><td> </td><td><pre class="example"><var>white-space</var> | |
423 # <var>translator-comments</var> | |
424 #. <var>extracted-comments</var> | |
425 #: <var>reference</var>… | |
426 #, <var>flag</var>… | |
427 #| msgctxt <var>previous-context</var> | |
428 #| msgid <var>previous-untranslated-string</var> | |
429 msgctxt <var>context</var> | |
430 msgid <var>untranslated-string</var> | |
431 msgstr <var>translated-string</var> | |
432 </pre></td></tr></table> | |
433 | |
434 <p>The context serves to disambiguate messages with the same | |
435 <var>untranslated-string</var>. It is possible to have several entries with | |
436 the same <var>untranslated-string</var> in a PO file, provided that they each | |
437 have a different <var>context</var>. Note that an empty <var>context</var> string | |
438 and an absent <code>msgctxt</code> line do not mean the same thing. | |
439 </p> | |
440 <a name="IDX111"></a> | |
441 <a name="IDX112"></a> | |
442 <p>A different kind of entries is used for translations which involve | |
443 plural forms. | |
444 </p> | |
445 <table><tr><td> </td><td><pre class="example"><var>white-space</var> | |
446 # <var>translator-comments</var> | |
447 #. <var>extracted-comments</var> | |
448 #: <var>reference</var>… | |
449 #, <var>flag</var>… | |
450 #| msgid <var>previous-untranslated-string-singular</var> | |
451 #| msgid_plural <var>previous-untranslated-string-plural</var> | |
452 msgid <var>untranslated-string-singular</var> | |
453 msgid_plural <var>untranslated-string-plural</var> | |
454 msgstr[0] <var>translated-string-case-0</var> | |
455 ... | |
456 msgstr[N] <var>translated-string-case-n</var> | |
457 </pre></td></tr></table> | |
458 | |
459 <p>Such an entry can look like this: | |
460 </p> | |
461 <table><tr><td> </td><td><pre class="example">#: src/msgcmp.c:338 src/po-lex.c:699 | |
462 #, c-format | |
463 msgid "found %d fatal error" | |
464 msgid_plural "found %d fatal errors" | |
465 msgstr[0] "s'ha trobat %d error fatal" | |
466 msgstr[1] "s'han trobat %d errors fatals" | |
467 </pre></td></tr></table> | |
468 | |
469 <p>Here also, a <code>msgctxt</code> context can be specified before <code>msgid</code>, | |
470 like above. | |
471 </p> | |
472 <p>Here, additional kinds of flags can be used: | |
473 </p> | |
474 <dl compact="compact"> | |
475 <dt> <code>range:</code></dt> | |
476 <dd><a name="IDX113"></a> | |
477 <p>This flag is followed by a range of non-negative numbers, using the syntax | |
478 <code>range: <var>minimum-value</var>..<var>maximum-value</var></code>. It designates the | |
479 possible values that the numeric parameter of the message can take. In some | |
480 languages, translators may produce slightly better translations if they know | |
481 that the value can only take on values between 0 and 10, for example. | |
482 </p></dd> | |
483 </dl> | |
484 | |
485 <p>The <var>previous-untranslated-string</var> is optionally inserted by the | |
486 <code>msgmerge</code> program, at the same time when it marks a message fuzzy. | |
487 It helps the translator to see which changes were done by the developers | |
488 on the <var>untranslated-string</var>. | |
489 </p> | |
490 <p>It happens that some lines, usually whitespace or comments, follow the | |
491 very last entry of a PO file. Such lines are not part of any entry, | |
492 and will be dropped when the PO file is processed by the tools, or may | |
493 disturb some PO file editors. | |
494 </p> | |
495 <p>The remainder of this section may be safely skipped by those using | |
496 a PO file editor, yet it may be interesting for everybody to have a better | |
497 idea of the precise format of a PO file. On the other hand, those | |
498 wishing to modify PO files by hand should carefully continue reading on. | |
499 </p> | |
500 <p>An empty <var>untranslated-string</var> is reserved to contain the header | |
501 entry with the meta information (see section <a href="gettext_6.html#SEC52">Filling in the Header Entry</a>). This header | |
502 entry should be the first entry of the file. The empty | |
503 <var>untranslated-string</var> is reserved for this purpose and must | |
504 not be used anywhere else. | |
505 </p> | |
506 <p>Each of <var>untranslated-string</var> and <var>translated-string</var> respects | |
507 the C syntax for a character string, including the surrounding quotes | |
508 and embedded backslashed escape sequences, except that universal character | |
509 escape sequences (<code>\u</code> and <code>\U</code>) are not allowed. When the time | |
510 comes to write multi-line strings, one should not use escaped newlines. | |
511 Instead, a closing quote should follow the last character on the | |
512 line to be continued, and an opening quote should resume the string | |
513 at the beginning of the following PO file line. For example: | |
514 </p> | |
515 <table><tr><td> </td><td><pre class="example">msgid "" | |
516 "Here is an example of how one might continue a very long string\n" | |
517 "for the common case the string represents multi-line output.\n" | |
518 </pre></td></tr></table> | |
519 | |
520 <p>In this example, the empty string is used on the first line, to | |
521 allow better alignment of the <code>H</code> from the word ‘<samp>Here</samp>’ | |
522 over the <code>f</code> from the word ‘<samp>for</samp>’. In this example, the | |
523 <code>msgid</code> keyword is followed by three strings, which are meant | |
524 to be concatenated. Concatenating the empty string does not change | |
525 the resulting overall string, but it is a way for us to comply with | |
526 the necessity of <code>msgid</code> to be followed by a string on the same | |
527 line, while keeping the multi-line presentation left-justified, as | |
528 we find this to be a cleaner disposition. The empty string could have | |
529 been omitted, but only if the string starting with ‘<samp>Here</samp>’ was | |
530 promoted on the first line, right after <code>msgid</code>.<a name="DOCF2" href="gettext_fot.html#FOOT2">(2)</a> It was not really necessary | |
531 either to switch between the two last quoted strings immediately after | |
532 the newline ‘<samp>\n</samp>’, the switch could have occurred after <em>any</em> | |
533 other character, we just did it this way because it is neater. | |
534 </p> | |
535 <a name="IDX114"></a> | |
536 <p>One should carefully distinguish between end of lines marked as | |
537 ‘<samp>\n</samp>’ <em>inside</em> quotes, which are part of the represented | |
538 string, and end of lines in the PO file itself, outside string quotes, | |
539 which have no incidence on the represented string. | |
540 </p> | |
541 <a name="IDX115"></a> | |
542 <p>Outside strings, white lines and comments may be used freely. | |
543 Comments start at the beginning of a line with ‘<samp>#</samp>’ and extend | |
544 until the end of the PO file line. Comments written by translators | |
545 should have the initial ‘<samp>#</samp>’ immediately followed by some white | |
546 space. If the ‘<samp>#</samp>’ is not immediately followed by white space, | |
547 this comment is most likely generated and managed by specialized GNU | |
548 tools, and might disappear or be replaced unexpectedly when the PO | |
549 file is given to <code>msgmerge</code>. | |
550 </p> | |
551 <p>For a PO file to be valid, no two entries without <code>msgctxt</code> may have | |
552 the same <var>untranslated-string</var> or <var>untranslated-string-singular</var>. | |
553 Similarly, no two entries may have the same <code>msgctxt</code> and the same | |
554 <var>untranslated-string</var> or <var>untranslated-string-singular</var>. | |
555 </p> | |
556 | |
557 <table cellpadding="1" cellspacing="1" border="0"> | |
558 <tr><td valign="middle" align="left">[<a href="gettext_2.html#SEC7" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
559 <td valign="middle" align="left">[<a href="gettext_4.html#SEC17" title="Next chapter"> >> </a>]</td> | |
560 <td valign="middle" align="left"> </td> | |
561 <td valign="middle" align="left"> </td> | |
562 <td valign="middle" align="left"> </td> | |
563 <td valign="middle" align="left"> </td> | |
564 <td valign="middle" align="left"> </td> | |
565 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
566 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
567 <td valign="middle" align="left">[<a href="gettext_21.html#SEC389" title="Index">Index</a>]</td> | |
568 <td valign="middle" align="left">[<a href="gettext_abt.html#SEC_About" title="About (help)"> ? </a>]</td> | |
569 </tr></table> | |
570 <p> | |
571 <font size="-1"> | |
572 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>. | |
573 </font> | |
574 <br> | |
575 | |
576 </p> | |
577 </body> | |
578 </html> |