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