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: 16. Other Data Formats</title>
|
jpayne@68
|
15
|
jpayne@68
|
16 <meta name="description" content="GNU gettext utilities: 16. Other Data Formats">
|
jpayne@68
|
17 <meta name="keywords" content="GNU gettext utilities: 16. Other Data Formats">
|
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_15.html#SEC263" title="Beginning of this chapter or previous chapter"> << </a>]</td>
|
jpayne@68
|
46 <td valign="middle" align="left">[<a href="gettext_17.html#SEC364" 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="Data-Formats"></a>
|
jpayne@68
|
60 <a name="SEC340"></a>
|
jpayne@68
|
61 <h1 class="chapter"> <a href="gettext_toc.html#TOC333">16. Other Data Formats</a> </h1>
|
jpayne@68
|
62
|
jpayne@68
|
63 <p>While the GNU gettext tools deal mainly with POT and PO files, they can
|
jpayne@68
|
64 also manipulate a couple of other data formats.
|
jpayne@68
|
65 </p>
|
jpayne@68
|
66
|
jpayne@68
|
67
|
jpayne@68
|
68 <a name="Internationalizable-Data"></a>
|
jpayne@68
|
69 <a name="SEC341"></a>
|
jpayne@68
|
70 <h2 class="section"> <a href="gettext_toc.html#TOC334">16.1 Internationalizable Data Formats</a> </h2>
|
jpayne@68
|
71
|
jpayne@68
|
72 <p>Here is a list of other data formats which can be internationalized
|
jpayne@68
|
73 using GNU gettext.
|
jpayne@68
|
74 </p>
|
jpayne@68
|
75
|
jpayne@68
|
76
|
jpayne@68
|
77 <a name="POT"></a>
|
jpayne@68
|
78 <a name="SEC342"></a>
|
jpayne@68
|
79 <h3 class="subsection"> <a href="gettext_toc.html#TOC335">16.1.1 POT - Portable Object Template</a> </h3>
|
jpayne@68
|
80
|
jpayne@68
|
81 <dl compact="compact">
|
jpayne@68
|
82 <dt> RPMs</dt>
|
jpayne@68
|
83 <dd><p>gettext
|
jpayne@68
|
84 </p>
|
jpayne@68
|
85 </dd>
|
jpayne@68
|
86 <dt> Ubuntu packages</dt>
|
jpayne@68
|
87 <dd><p>gettext
|
jpayne@68
|
88 </p>
|
jpayne@68
|
89 </dd>
|
jpayne@68
|
90 <dt> File extension</dt>
|
jpayne@68
|
91 <dd><p><code>pot</code>, <code>po</code>
|
jpayne@68
|
92 </p>
|
jpayne@68
|
93 </dd>
|
jpayne@68
|
94 <dt> Extractor</dt>
|
jpayne@68
|
95 <dd><p><code>xgettext</code>
|
jpayne@68
|
96 </p></dd>
|
jpayne@68
|
97 </dl>
|
jpayne@68
|
98
|
jpayne@68
|
99
|
jpayne@68
|
100 <a name="RST"></a>
|
jpayne@68
|
101 <a name="SEC343"></a>
|
jpayne@68
|
102 <h3 class="subsection"> <a href="gettext_toc.html#TOC336">16.1.2 Resource String Table</a> </h3>
|
jpayne@68
|
103
|
jpayne@68
|
104 <p>RST is the format of resource string table files of the Free Pascal compiler
|
jpayne@68
|
105 versions older than 3.0.0. RSJ is the new format of resource string table
|
jpayne@68
|
106 files, created by the Free Pascal compiler version 3.0.0 or newer.
|
jpayne@68
|
107 </p>
|
jpayne@68
|
108 <dl compact="compact">
|
jpayne@68
|
109 <dt> RPMs</dt>
|
jpayne@68
|
110 <dd><p>fpk
|
jpayne@68
|
111 </p>
|
jpayne@68
|
112 </dd>
|
jpayne@68
|
113 <dt> Ubuntu packages</dt>
|
jpayne@68
|
114 <dd><p>fp-compiler
|
jpayne@68
|
115 </p>
|
jpayne@68
|
116 </dd>
|
jpayne@68
|
117 <dt> File extension</dt>
|
jpayne@68
|
118 <dd><p><code>rst</code>, <code>rsj</code>
|
jpayne@68
|
119 </p>
|
jpayne@68
|
120 </dd>
|
jpayne@68
|
121 <dt> Extractor</dt>
|
jpayne@68
|
122 <dd><p><code>xgettext</code>, <code>rstconv</code>
|
jpayne@68
|
123 </p></dd>
|
jpayne@68
|
124 </dl>
|
jpayne@68
|
125
|
jpayne@68
|
126
|
jpayne@68
|
127 <a name="Glade"></a>
|
jpayne@68
|
128 <a name="SEC344"></a>
|
jpayne@68
|
129 <h3 class="subsection"> <a href="gettext_toc.html#TOC337">16.1.3 Glade - GNOME user interface description</a> </h3>
|
jpayne@68
|
130
|
jpayne@68
|
131 <dl compact="compact">
|
jpayne@68
|
132 <dt> RPMs</dt>
|
jpayne@68
|
133 <dd><p>glade, libglade, glade2, libglade2, intltool
|
jpayne@68
|
134 </p>
|
jpayne@68
|
135 </dd>
|
jpayne@68
|
136 <dt> Ubuntu packages</dt>
|
jpayne@68
|
137 <dd><p>glade, libglade2-dev, intltool
|
jpayne@68
|
138 </p>
|
jpayne@68
|
139 </dd>
|
jpayne@68
|
140 <dt> File extension</dt>
|
jpayne@68
|
141 <dd><p><code>glade</code>, <code>glade2</code>, <code>ui</code>
|
jpayne@68
|
142 </p>
|
jpayne@68
|
143 </dd>
|
jpayne@68
|
144 <dt> Extractor</dt>
|
jpayne@68
|
145 <dd><p><code>xgettext</code>, <code>libglade-xgettext</code>, <code>xml-i18n-extract</code>, <code>intltool-extract</code>
|
jpayne@68
|
146 </p></dd>
|
jpayne@68
|
147 </dl>
|
jpayne@68
|
148
|
jpayne@68
|
149
|
jpayne@68
|
150 <a name="GSettings"></a>
|
jpayne@68
|
151 <a name="SEC345"></a>
|
jpayne@68
|
152 <h3 class="subsection"> <a href="gettext_toc.html#TOC338">16.1.4 GSettings - GNOME user configuration schema</a> </h3>
|
jpayne@68
|
153
|
jpayne@68
|
154 <dl compact="compact">
|
jpayne@68
|
155 <dt> RPMs</dt>
|
jpayne@68
|
156 <dd><p>glib2
|
jpayne@68
|
157 </p>
|
jpayne@68
|
158 </dd>
|
jpayne@68
|
159 <dt> Ubuntu packages</dt>
|
jpayne@68
|
160 <dd><p>libglib2.0-dev
|
jpayne@68
|
161 </p>
|
jpayne@68
|
162 </dd>
|
jpayne@68
|
163 <dt> File extension</dt>
|
jpayne@68
|
164 <dd><p><code>gschema.xml</code>
|
jpayne@68
|
165 </p>
|
jpayne@68
|
166 </dd>
|
jpayne@68
|
167 <dt> Extractor</dt>
|
jpayne@68
|
168 <dd><p><code>xgettext</code>, <code>intltool-extract</code>
|
jpayne@68
|
169 </p></dd>
|
jpayne@68
|
170 </dl>
|
jpayne@68
|
171
|
jpayne@68
|
172
|
jpayne@68
|
173 <a name="AppData"></a>
|
jpayne@68
|
174 <a name="SEC346"></a>
|
jpayne@68
|
175 <h3 class="subsection"> <a href="gettext_toc.html#TOC339">16.1.5 AppData - freedesktop.org application description</a> </h3>
|
jpayne@68
|
176
|
jpayne@68
|
177 <p>This file format is specified in
|
jpayne@68
|
178 <a href="https://www.freedesktop.org/software/appstream/docs/">https://www.freedesktop.org/software/appstream/docs/</a>.
|
jpayne@68
|
179 </p>
|
jpayne@68
|
180 <dl compact="compact">
|
jpayne@68
|
181 <dt> RPMs</dt>
|
jpayne@68
|
182 <dd><p>appdata-tools, appstream, libappstream-glib, libappstream-glib-builder
|
jpayne@68
|
183 </p>
|
jpayne@68
|
184 </dd>
|
jpayne@68
|
185 <dt> Ubuntu packages</dt>
|
jpayne@68
|
186 <dd><p>appdata-tools, appstream, libappstream-glib-dev
|
jpayne@68
|
187 </p>
|
jpayne@68
|
188 </dd>
|
jpayne@68
|
189 <dt> File extension</dt>
|
jpayne@68
|
190 <dd><p><code>appdata.xml</code>, <code>metainfo.xml</code>
|
jpayne@68
|
191 </p>
|
jpayne@68
|
192 </dd>
|
jpayne@68
|
193 <dt> Extractor</dt>
|
jpayne@68
|
194 <dd><p><code>xgettext</code>, <code>intltool-extract</code>, <code>itstool</code>
|
jpayne@68
|
195 </p></dd>
|
jpayne@68
|
196 </dl>
|
jpayne@68
|
197
|
jpayne@68
|
198
|
jpayne@68
|
199 <a name="Preparing-ITS-Rules"></a>
|
jpayne@68
|
200 <a name="SEC347"></a>
|
jpayne@68
|
201 <h3 class="subsection"> <a href="gettext_toc.html#TOC340">16.1.6 Preparing Rules for XML Internationalization</a> </h3>
|
jpayne@68
|
202
|
jpayne@68
|
203 <p>Marking translatable strings in an XML file is done through a separate
|
jpayne@68
|
204 "rule" file, making use of the Internationalization Tag Set standard
|
jpayne@68
|
205 (ITS, <a href="https://www.w3.org/TR/its20/">https://www.w3.org/TR/its20/</a>). The currently supported ITS
|
jpayne@68
|
206 data categories are: ‘<samp>Translate</samp>’, ‘<samp>Localization Note</samp>’,
|
jpayne@68
|
207 ‘<samp>Elements Within Text</samp>’, and ‘<samp>Preserve Space</samp>’. In addition to
|
jpayne@68
|
208 them, <code>xgettext</code> also recognizes the following extended data
|
jpayne@68
|
209 categories:
|
jpayne@68
|
210 </p>
|
jpayne@68
|
211 <dl compact="compact">
|
jpayne@68
|
212 <dt> ‘<samp>Context</samp>’</dt>
|
jpayne@68
|
213 <dd>
|
jpayne@68
|
214 <p>This data category associates <code>msgctxt</code> to the extracted text. In
|
jpayne@68
|
215 the global rule, the <code>contextRule</code> element contains the following:
|
jpayne@68
|
216 </p>
|
jpayne@68
|
217 <ul class="toc">
|
jpayne@68
|
218 <li>
|
jpayne@68
|
219 A required <code>selector</code> attribute. It contains an absolute selector
|
jpayne@68
|
220 that selects the nodes to which this rule applies.
|
jpayne@68
|
221
|
jpayne@68
|
222 </li><li>
|
jpayne@68
|
223 A required <code>contextPointer</code> attribute that contains a relative
|
jpayne@68
|
224 selector pointing to a node that holds the <code>msgctxt</code> value.
|
jpayne@68
|
225
|
jpayne@68
|
226 </li><li>
|
jpayne@68
|
227 An optional <code>textPointer</code> attribute that contains a relative
|
jpayne@68
|
228 selector pointing to a node that holds the <code>msgid</code> value.
|
jpayne@68
|
229 </li></ul>
|
jpayne@68
|
230
|
jpayne@68
|
231 </dd>
|
jpayne@68
|
232 <dt> ‘<samp>Escape Special Characters</samp>’</dt>
|
jpayne@68
|
233 <dd>
|
jpayne@68
|
234 <p>This data category indicates whether the special XML characters
|
jpayne@68
|
235 (<code><</code>, <code>></code>, <code>&</code>, <code>"</code>) are escaped with entity
|
jpayne@68
|
236 reference. In the global rule, the <code>escapeRule</code> element contains
|
jpayne@68
|
237 the following:
|
jpayne@68
|
238 </p>
|
jpayne@68
|
239 <ul class="toc">
|
jpayne@68
|
240 <li>
|
jpayne@68
|
241 A required <code>selector</code> attribute. It contains an absolute selector
|
jpayne@68
|
242 that selects the nodes to which this rule applies.
|
jpayne@68
|
243
|
jpayne@68
|
244 </li><li>
|
jpayne@68
|
245 A required <code>escape</code> attribute with the value <code>yes</code> or <code>no</code>.
|
jpayne@68
|
246 </li></ul>
|
jpayne@68
|
247
|
jpayne@68
|
248 </dd>
|
jpayne@68
|
249 <dt> ‘<samp>Extended Preserve Space</samp>’</dt>
|
jpayne@68
|
250 <dd>
|
jpayne@68
|
251 <p>This data category extends the standard ‘<samp>Preserve Space</samp>’ data
|
jpayne@68
|
252 category with the additional values ‘<samp>trim</samp>’ and ‘<samp>paragraph</samp>’.
|
jpayne@68
|
253 ‘<samp>trim</samp>’ means to remove the leading and trailing whitespaces of the
|
jpayne@68
|
254 content, but not to normalize whitespaces in the middle.
|
jpayne@68
|
255 ‘<samp>paragraph</samp>’ means to normalize the content but keep the paragraph
|
jpayne@68
|
256 boundaries. In the global
|
jpayne@68
|
257 rule, the <code>preserveSpaceRule</code> element contains the following:
|
jpayne@68
|
258 </p>
|
jpayne@68
|
259 <ul class="toc">
|
jpayne@68
|
260 <li>
|
jpayne@68
|
261 A required <code>selector</code> attribute. It contains an absolute selector
|
jpayne@68
|
262 that selects the nodes to which this rule applies.
|
jpayne@68
|
263
|
jpayne@68
|
264 </li><li>
|
jpayne@68
|
265 A required <code>space</code> attribute with the value <code>default</code>,
|
jpayne@68
|
266 <code>preserve</code>, <code>trim</code>, or <code>paragraph</code>.
|
jpayne@68
|
267 </li></ul>
|
jpayne@68
|
268
|
jpayne@68
|
269 </dd>
|
jpayne@68
|
270 </dl>
|
jpayne@68
|
271
|
jpayne@68
|
272 <p>All those extended data categories can only be expressed with global
|
jpayne@68
|
273 rules, and the rule elements have to have the
|
jpayne@68
|
274 <code>https://www.gnu.org/s/gettext/ns/its/extensions/1.0</code> namespace.
|
jpayne@68
|
275 </p>
|
jpayne@68
|
276 <p>Given the following XML document in a file ‘<tt>messages.xml</tt>’:
|
jpayne@68
|
277 </p>
|
jpayne@68
|
278 <table><tr><td> </td><td><pre class="example"><?xml version="1.0"?>
|
jpayne@68
|
279 <messages>
|
jpayne@68
|
280 <message>
|
jpayne@68
|
281 <p>A translatable string</p>
|
jpayne@68
|
282 </message>
|
jpayne@68
|
283 <message>
|
jpayne@68
|
284 <p translatable="no">A non-translatable string</p>
|
jpayne@68
|
285 </message>
|
jpayne@68
|
286 </messages>
|
jpayne@68
|
287 </pre></td></tr></table>
|
jpayne@68
|
288
|
jpayne@68
|
289 <p>To extract the first text content ("A translatable string"), but not the
|
jpayne@68
|
290 second ("A non-translatable string"), the following ITS rules can be used:
|
jpayne@68
|
291 </p>
|
jpayne@68
|
292 <table><tr><td> </td><td><pre class="example"><?xml version="1.0"?>
|
jpayne@68
|
293 <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
|
jpayne@68
|
294 <its:translateRule selector="/messages" translate="no"/>
|
jpayne@68
|
295 <its:translateRule selector="//message/p" translate="yes"/>
|
jpayne@68
|
296
|
jpayne@68
|
297 <!-- If 'p' has an attribute 'translatable' with the value 'no', then
|
jpayne@68
|
298 the content is not translatable. -->
|
jpayne@68
|
299 <its:translateRule selector="//message/p[@translatable = 'no']"
|
jpayne@68
|
300 translate="no"/>
|
jpayne@68
|
301 </its:rules>
|
jpayne@68
|
302 </pre></td></tr></table>
|
jpayne@68
|
303
|
jpayne@68
|
304 <p>‘<samp>xgettext</samp>’ needs another file called "locating rule" to associate
|
jpayne@68
|
305 an ITS rule with an XML file. If the above ITS file is saved as
|
jpayne@68
|
306 ‘<tt>messages.its</tt>’, the locating rule would look like:
|
jpayne@68
|
307 </p>
|
jpayne@68
|
308 <table><tr><td> </td><td><pre class="example"><?xml version="1.0"?>
|
jpayne@68
|
309 <locatingRules>
|
jpayne@68
|
310 <locatingRule name="Messages" pattern="*.xml">
|
jpayne@68
|
311 <documentRule localName="messages" target="messages.its"/>
|
jpayne@68
|
312 </locatingRule>
|
jpayne@68
|
313 <locatingRule name="Messages" pattern="*.msg" target="messages.its"/>
|
jpayne@68
|
314 </locatingRules>
|
jpayne@68
|
315 </pre></td></tr></table>
|
jpayne@68
|
316
|
jpayne@68
|
317 <p>The <code>locatingRule</code> element must have a <code>pattern</code> attribute,
|
jpayne@68
|
318 which denotes either a literal file name or a wildcard pattern of the
|
jpayne@68
|
319 XML file<a name="DOCF7" href="gettext_fot.html#FOOT7">(7)</a>. The <code>locatingRule</code> element can have child
|
jpayne@68
|
320 <code>documentRule</code> element, which adds checks on the content of the XML
|
jpayne@68
|
321 file.
|
jpayne@68
|
322 </p>
|
jpayne@68
|
323 <p>The first rule matches any file with the ‘<tt>.xml</tt>’ file extension, but
|
jpayne@68
|
324 it only applies to XML files whose root element is ‘<samp><messages></samp>’.
|
jpayne@68
|
325 </p>
|
jpayne@68
|
326 <p>The second rule indicates that the same ITS rule file are also
|
jpayne@68
|
327 applicable to any file with the ‘<tt>.msg</tt>’ file extension. The
|
jpayne@68
|
328 optional <code>name</code> attribute of <code>locatingRule</code> allows to choose
|
jpayne@68
|
329 rules by name, typically with <code>xgettext</code>'s <code>-L</code> option.
|
jpayne@68
|
330 </p>
|
jpayne@68
|
331 <p>The associated ITS rule file is indicated by the <code>target</code> attribute
|
jpayne@68
|
332 of <code>locatingRule</code> or <code>documentRule</code>. If it is specified in a
|
jpayne@68
|
333 <code>documentRule</code> element, the parent <code>locatingRule</code> shouldn't
|
jpayne@68
|
334 have the <code>target</code> attribute.
|
jpayne@68
|
335 </p>
|
jpayne@68
|
336 <p>Locating rule files must have the ‘<tt>.loc</tt>’ file extension. Both ITS
|
jpayne@68
|
337 rule files and locating rule files must be installed in the
|
jpayne@68
|
338 ‘<tt>$prefix/share/gettext/its</tt>’ directory. Once those files are
|
jpayne@68
|
339 properly installed, <code>xgettext</code> can extract translatable strings
|
jpayne@68
|
340 from the matching XML files.
|
jpayne@68
|
341 </p>
|
jpayne@68
|
342
|
jpayne@68
|
343 <a name="SEC348"></a>
|
jpayne@68
|
344 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC341">16.1.6.1 Two Use-cases of Translated Strings in XML</a> </h4>
|
jpayne@68
|
345
|
jpayne@68
|
346 <p>For XML, there are two use-cases of translated strings. One is the case
|
jpayne@68
|
347 where the translated strings are directly consumed by programs, and the
|
jpayne@68
|
348 other is the case where the translated strings are merged back to the
|
jpayne@68
|
349 original XML document. In the former case, special characters in the
|
jpayne@68
|
350 extracted strings shouldn't be escaped, while they should in the latter
|
jpayne@68
|
351 case. To control wheter to escape special characters, the ‘<samp>Escape
|
jpayne@68
|
352 Special Characters</samp>’ data category can be used.
|
jpayne@68
|
353 </p>
|
jpayne@68
|
354 <p>To merge the translations, the ‘<samp>msgfmt</samp>’ program can be used with
|
jpayne@68
|
355 the option <code>--xml</code>. See section <a href="gettext_10.html#SEC174">Invoking the <code>msgfmt</code> Program</a>, for more details
|
jpayne@68
|
356 about how one calls the ‘<samp>msgfmt</samp>’ program. ‘<samp>msgfmt</samp>’'s
|
jpayne@68
|
357 <code>--xml</code> option doesn't perform character escaping, so translated
|
jpayne@68
|
358 strings can have arbitrary XML constructs, such as elements for markup.
|
jpayne@68
|
359 </p>
|
jpayne@68
|
360
|
jpayne@68
|
361
|
jpayne@68
|
362 <a name="Localized-Data"></a>
|
jpayne@68
|
363 <a name="SEC349"></a>
|
jpayne@68
|
364 <h2 class="section"> <a href="gettext_toc.html#TOC342">16.2 Localized Data Formats</a> </h2>
|
jpayne@68
|
365
|
jpayne@68
|
366 <p>Here is a list of file formats that contain localized data and that the
|
jpayne@68
|
367 GNU gettext tools can manipulate.
|
jpayne@68
|
368 </p>
|
jpayne@68
|
369
|
jpayne@68
|
370
|
jpayne@68
|
371 <a name="Editable-Message-Catalogs"></a>
|
jpayne@68
|
372 <a name="SEC350"></a>
|
jpayne@68
|
373 <h3 class="subsection"> <a href="gettext_toc.html#TOC343">16.2.1 Editable Message Catalogs</a> </h3>
|
jpayne@68
|
374
|
jpayne@68
|
375 <p>These file formats can be used with all of the <code>msg*</code> tools and with
|
jpayne@68
|
376 the <code>xgettext</code> program.
|
jpayne@68
|
377 </p>
|
jpayne@68
|
378 <p>If you just want to convert among these formats, you can use the
|
jpayne@68
|
379 <code>msgcat</code> program (with the appropriate option) or the <code>xgettext</code>
|
jpayne@68
|
380 program.
|
jpayne@68
|
381 </p>
|
jpayne@68
|
382
|
jpayne@68
|
383
|
jpayne@68
|
384 <a name="PO"></a>
|
jpayne@68
|
385 <a name="SEC351"></a>
|
jpayne@68
|
386 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC344">16.2.1.1 PO - Portable Object</a> </h4>
|
jpayne@68
|
387
|
jpayne@68
|
388 <dl compact="compact">
|
jpayne@68
|
389 <dt> File extension</dt>
|
jpayne@68
|
390 <dd><p><code>po</code>
|
jpayne@68
|
391 </p></dd>
|
jpayne@68
|
392 </dl>
|
jpayne@68
|
393
|
jpayne@68
|
394
|
jpayne@68
|
395 <a name="Java-_002eproperties"></a>
|
jpayne@68
|
396 <a name="SEC352"></a>
|
jpayne@68
|
397 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC345">16.2.1.2 Java .properties</a> </h4>
|
jpayne@68
|
398
|
jpayne@68
|
399 <dl compact="compact">
|
jpayne@68
|
400 <dt> File extension</dt>
|
jpayne@68
|
401 <dd><p><code>properties</code>
|
jpayne@68
|
402 </p></dd>
|
jpayne@68
|
403 </dl>
|
jpayne@68
|
404
|
jpayne@68
|
405
|
jpayne@68
|
406 <a name="GNUstep-_002estrings"></a>
|
jpayne@68
|
407 <a name="SEC353"></a>
|
jpayne@68
|
408 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC346">16.2.1.3 NeXTstep/GNUstep .strings</a> </h4>
|
jpayne@68
|
409
|
jpayne@68
|
410 <dl compact="compact">
|
jpayne@68
|
411 <dt> File extension</dt>
|
jpayne@68
|
412 <dd><p><code>strings</code>
|
jpayne@68
|
413 </p></dd>
|
jpayne@68
|
414 </dl>
|
jpayne@68
|
415
|
jpayne@68
|
416
|
jpayne@68
|
417 <a name="Compiled-Message-Catalogs"></a>
|
jpayne@68
|
418 <a name="SEC354"></a>
|
jpayne@68
|
419 <h3 class="subsection"> <a href="gettext_toc.html#TOC347">16.2.2 Compiled Message Catalogs</a> </h3>
|
jpayne@68
|
420
|
jpayne@68
|
421 <p>These file formats can be created through <code>msgfmt</code> and converted back
|
jpayne@68
|
422 to PO format through <code>msgunfmt</code>.
|
jpayne@68
|
423 </p>
|
jpayne@68
|
424
|
jpayne@68
|
425
|
jpayne@68
|
426 <a name="MO"></a>
|
jpayne@68
|
427 <a name="SEC355"></a>
|
jpayne@68
|
428 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC348">16.2.2.1 MO - Machine Object</a> </h4>
|
jpayne@68
|
429
|
jpayne@68
|
430 <dl compact="compact">
|
jpayne@68
|
431 <dt> File extension</dt>
|
jpayne@68
|
432 <dd><p><code>mo</code>
|
jpayne@68
|
433 </p></dd>
|
jpayne@68
|
434 </dl>
|
jpayne@68
|
435
|
jpayne@68
|
436 <p>See section <a href="gettext_10.html#SEC196">The Format of GNU MO Files</a> for details.
|
jpayne@68
|
437 </p>
|
jpayne@68
|
438
|
jpayne@68
|
439 <a name="Java-ResourceBundle"></a>
|
jpayne@68
|
440 <a name="SEC356"></a>
|
jpayne@68
|
441 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC349">16.2.2.2 Java ResourceBundle</a> </h4>
|
jpayne@68
|
442
|
jpayne@68
|
443 <dl compact="compact">
|
jpayne@68
|
444 <dt> File extension</dt>
|
jpayne@68
|
445 <dd><p><code>class</code>
|
jpayne@68
|
446 </p></dd>
|
jpayne@68
|
447 </dl>
|
jpayne@68
|
448
|
jpayne@68
|
449 <p>For more information, see the section <a href="gettext_15.html#SEC299">Java</a> and the examples
|
jpayne@68
|
450 <code>hello-java</code>, <code>hello-java-awt</code>, <code>hello-java-swing</code>.
|
jpayne@68
|
451 </p>
|
jpayne@68
|
452
|
jpayne@68
|
453 <a name="C_0023-Satellite-Assembly"></a>
|
jpayne@68
|
454 <a name="SEC357"></a>
|
jpayne@68
|
455 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC350">16.2.2.3 C# Satellite Assembly</a> </h4>
|
jpayne@68
|
456
|
jpayne@68
|
457 <dl compact="compact">
|
jpayne@68
|
458 <dt> File extension</dt>
|
jpayne@68
|
459 <dd><p><code>dll</code>
|
jpayne@68
|
460 </p></dd>
|
jpayne@68
|
461 </dl>
|
jpayne@68
|
462
|
jpayne@68
|
463 <p>For more information, see the section <a href="gettext_15.html#SEC300">C#</a>.
|
jpayne@68
|
464 </p>
|
jpayne@68
|
465
|
jpayne@68
|
466 <a name="C_0023-Resource"></a>
|
jpayne@68
|
467 <a name="SEC358"></a>
|
jpayne@68
|
468 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC351">16.2.2.4 C# Resource</a> </h4>
|
jpayne@68
|
469
|
jpayne@68
|
470 <dl compact="compact">
|
jpayne@68
|
471 <dt> File extension</dt>
|
jpayne@68
|
472 <dd><p><code>resources</code>
|
jpayne@68
|
473 </p></dd>
|
jpayne@68
|
474 </dl>
|
jpayne@68
|
475
|
jpayne@68
|
476 <p>For more information, see the section <a href="gettext_15.html#SEC300">C#</a>.
|
jpayne@68
|
477 </p>
|
jpayne@68
|
478
|
jpayne@68
|
479 <a name="Tcl-message-catalog"></a>
|
jpayne@68
|
480 <a name="SEC359"></a>
|
jpayne@68
|
481 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC352">16.2.2.5 Tcl message catalog</a> </h4>
|
jpayne@68
|
482
|
jpayne@68
|
483 <dl compact="compact">
|
jpayne@68
|
484 <dt> File extension</dt>
|
jpayne@68
|
485 <dd><p><code>msg</code>
|
jpayne@68
|
486 </p></dd>
|
jpayne@68
|
487 </dl>
|
jpayne@68
|
488
|
jpayne@68
|
489 <p>For more information, see the section <a href="gettext_15.html#SEC325">Tcl - Tk's scripting language</a> and the examples
|
jpayne@68
|
490 <code>hello-tcl</code>, <code>hello-tcl-tk</code>.
|
jpayne@68
|
491 </p>
|
jpayne@68
|
492
|
jpayne@68
|
493 <a name="Qt-message-catalog"></a>
|
jpayne@68
|
494 <a name="SEC360"></a>
|
jpayne@68
|
495 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC353">16.2.2.6 Qt message catalog</a> </h4>
|
jpayne@68
|
496
|
jpayne@68
|
497 <dl compact="compact">
|
jpayne@68
|
498 <dt> File extension</dt>
|
jpayne@68
|
499 <dd><p><code>qm</code>
|
jpayne@68
|
500 </p></dd>
|
jpayne@68
|
501 </dl>
|
jpayne@68
|
502
|
jpayne@68
|
503 <p>For more information, see the examples <code>hello-c++-qt</code> and
|
jpayne@68
|
504 <code>hello-c++-kde</code>.
|
jpayne@68
|
505 </p>
|
jpayne@68
|
506
|
jpayne@68
|
507 <a name="Desktop-Entry"></a>
|
jpayne@68
|
508 <a name="SEC361"></a>
|
jpayne@68
|
509 <h3 class="subsection"> <a href="gettext_toc.html#TOC354">16.2.3 Desktop Entry files</a> </h3>
|
jpayne@68
|
510
|
jpayne@68
|
511 <p>The programmer produces a desktop entry file template with only the
|
jpayne@68
|
512 English strings. These strings get included in the POT file, by way of
|
jpayne@68
|
513 <code>xgettext</code> (usually by listing the template in <code>po/POTFILES.in</code>).
|
jpayne@68
|
514 The translators produce PO files, one for each language. Finally, an
|
jpayne@68
|
515 <code>msgfmt --desktop</code> invocation collects all the translations in the
|
jpayne@68
|
516 desktop entry file.
|
jpayne@68
|
517 </p>
|
jpayne@68
|
518 <p>For more information, see the example <code>hello-c-gnome3</code>.
|
jpayne@68
|
519 </p>
|
jpayne@68
|
520
|
jpayne@68
|
521
|
jpayne@68
|
522 <a name="Icons"></a>
|
jpayne@68
|
523 <a name="SEC362"></a>
|
jpayne@68
|
524 <h4 class="subsubsection"> <a href="gettext_toc.html#TOC355">16.2.3.1 How to handle icons in Desktop Entry files</a> </h4>
|
jpayne@68
|
525
|
jpayne@68
|
526 <p>Icons are generally locale dependent, for the following reasons:
|
jpayne@68
|
527 </p>
|
jpayne@68
|
528 <ul>
|
jpayne@68
|
529 <li>
|
jpayne@68
|
530 Icons may contain signs that are considered rude in some cultures. For
|
jpayne@68
|
531 example, the high-five sign, in some cultures, is perceived as an
|
jpayne@68
|
532 unfriendly “stop” sign.
|
jpayne@68
|
533 </li><li>
|
jpayne@68
|
534 Icons may contain metaphors that are culture specific. For example, a
|
jpayne@68
|
535 mailbox in the U.S. looks different than mailboxes all around the world.
|
jpayne@68
|
536 </li><li>
|
jpayne@68
|
537 Icons may need to be mirrored for right-to-left locales.
|
jpayne@68
|
538 </li><li>
|
jpayne@68
|
539 Icons may contain text strings (a bad practice, but anyway).
|
jpayne@68
|
540 </li></ul>
|
jpayne@68
|
541
|
jpayne@68
|
542 <p>However, icons are not covered by GNU gettext localization, because
|
jpayne@68
|
543 </p><ul>
|
jpayne@68
|
544 <li>
|
jpayne@68
|
545 Icons cannot be easily embedded in PO files,
|
jpayne@68
|
546 </li><li>
|
jpayne@68
|
547 The need to localize an icon is rare, and the ability to do so in a PO
|
jpayne@68
|
548 file would introduce translator mistakes.
|
jpayne@68
|
549 </li></ul>
|
jpayne@68
|
550
|
jpayne@68
|
551 <p>Desktop Entry files may contain an ‘<samp>Icon</samp>’ property, and this
|
jpayne@68
|
552 property is localizable. If a translator wishes to localize an icon,
|
jpayne@68
|
553 she should do so by bypassing the normal workflow with PO files:
|
jpayne@68
|
554 </p><ol>
|
jpayne@68
|
555 <li>
|
jpayne@68
|
556 The translator contacts the package developers directly, sending them
|
jpayne@68
|
557 the icon appropriate for her locale, with a request to change the
|
jpayne@68
|
558 template file.
|
jpayne@68
|
559 </li><li>
|
jpayne@68
|
560 The package developers add the icon file to their repository, and a
|
jpayne@68
|
561 line
|
jpayne@68
|
562 <table><tr><td> </td><td><pre class="smallexample">Icon[<var>locale</var>]=<var>icon_file_name</var>
|
jpayne@68
|
563 </pre></td></tr></table>
|
jpayne@68
|
564 <p>to the template file.
|
jpayne@68
|
565 </p></li></ol>
|
jpayne@68
|
566 <p>This line remains in place when this template file is merged with the
|
jpayne@68
|
567 translators' PO files, through <code>msgfmt</code>.
|
jpayne@68
|
568 </p>
|
jpayne@68
|
569
|
jpayne@68
|
570 <a name="XML"></a>
|
jpayne@68
|
571 <a name="SEC363"></a>
|
jpayne@68
|
572 <h3 class="subsection"> <a href="gettext_toc.html#TOC356">16.2.4 XML files</a> </h3>
|
jpayne@68
|
573
|
jpayne@68
|
574 <p>See the section <a href="#SEC347">Preparing Rules for XML Internationalization</a> and
|
jpayne@68
|
575 <a href="gettext_10.html#SEC174">Invoking the <code>msgfmt</code> Program</a>, subsection “XML mode operations”.
|
jpayne@68
|
576 </p>
|
jpayne@68
|
577
|
jpayne@68
|
578 <table cellpadding="1" cellspacing="1" border="0">
|
jpayne@68
|
579 <tr><td valign="middle" align="left">[<a href="#SEC340" title="Beginning of this chapter or previous chapter"> << </a>]</td>
|
jpayne@68
|
580 <td valign="middle" align="left">[<a href="gettext_17.html#SEC364" title="Next chapter"> >> </a>]</td>
|
jpayne@68
|
581 <td valign="middle" align="left"> </td>
|
jpayne@68
|
582 <td valign="middle" align="left"> </td>
|
jpayne@68
|
583 <td valign="middle" align="left"> </td>
|
jpayne@68
|
584 <td valign="middle" align="left"> </td>
|
jpayne@68
|
585 <td valign="middle" align="left"> </td>
|
jpayne@68
|
586 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
|
jpayne@68
|
587 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
|
jpayne@68
|
588 <td valign="middle" align="left">[<a href="gettext_21.html#SEC389" title="Index">Index</a>]</td>
|
jpayne@68
|
589 <td valign="middle" align="left">[<a href="gettext_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
|
jpayne@68
|
590 </tr></table>
|
jpayne@68
|
591 <p>
|
jpayne@68
|
592 <font size="-1">
|
jpayne@68
|
593 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
|
594 </font>
|
jpayne@68
|
595 <br>
|
jpayne@68
|
596
|
jpayne@68
|
597 </p>
|
jpayne@68
|
598 </body>
|
jpayne@68
|
599 </html>
|