<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.52b
- from gettext.texi on 7 January 2014 -->
+ from gettext.texi on 28 December 2015 -->
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
<TITLE>GNU gettext utilities - 15 Other Programming Languages</TITLE>
<P><HR><P>
-<H1><A NAME="SEC245" HREF="gettext_toc.html#TOC245">15 Other Programming Languages</A></H1>
+<H1><A NAME="SEC248" HREF="gettext_toc.html#TOC248">15 Other Programming Languages</A></H1>
<P>
While the presentation of <CODE>gettext</CODE> focuses mostly on C and
-<H2><A NAME="SEC246" HREF="gettext_toc.html#TOC246">15.1 The Language Implementor's View</A></H2>
+<H2><A NAME="SEC249" HREF="gettext_toc.html#TOC249">15.1 The Language Implementor's View</A></H2>
<P>
-<A NAME="IDX1178"></A>
-<A NAME="IDX1179"></A>
+<A NAME="IDX1217"></A>
+<A NAME="IDX1218"></A>
</P>
<P>
<LI>
You may integrate the GNU <CODE>gettext</CODE>'s <TT>‘intl/’</TT> directory in
-your package, as described in section <A HREF="gettext_13.html#SEC211">13 The Maintainer's View</A>. This allows you to
+your package, as described in section <A HREF="gettext_13.html#SEC213">13 The Maintainer's View</A>. This allows you to
have internationalization on all kinds of platforms. Note that when you
then distribute your package, it legally falls under the GNU General
Public License, and the GNU project will be glad about your contribution
-<H2><A NAME="SEC247" HREF="gettext_toc.html#TOC247">15.2 The Programmer's View</A></H2>
+<H2><A NAME="SEC250" HREF="gettext_toc.html#TOC250">15.2 The Programmer's View</A></H2>
<P>
For the programmer, the general procedure is the same as for the C
</P>
-<H2><A NAME="SEC248" HREF="gettext_toc.html#TOC248">15.3 The Translator's View</A></H2>
+<H2><A NAME="SEC251" HREF="gettext_toc.html#TOC251">15.3 The Translator's View</A></H2>
<P>
The translator works exactly as in the C language case. The only
-<H3><A NAME="SEC249" HREF="gettext_toc.html#TOC249">15.3.1 C Format Strings</A></H3>
+<H3><A NAME="SEC252" HREF="gettext_toc.html#TOC252">15.3.1 C Format Strings</A></H3>
<P>
C format strings are described in POSIX (IEEE P1003.1 2001), section
</P>
<P>
-<A NAME="IDX1180"></A>
-<A NAME="IDX1181"></A>
+<A NAME="IDX1219"></A>
+<A NAME="IDX1220"></A>
As a special feature for Farsi (Persian) and maybe Arabic, translators can
insert an <SAMP>‘I’</SAMP> flag into numeric format directives. For example, the
translation of <CODE>"%d"</CODE> can be <CODE>"%Id"</CODE>. The effect of this flag,
</P>
-<H3><A NAME="SEC250" HREF="gettext_toc.html#TOC250">15.3.2 Objective C Format Strings</A></H3>
+<H3><A NAME="SEC253" HREF="gettext_toc.html#TOC253">15.3.2 Objective C Format Strings</A></H3>
<P>
Objective C format strings are like C format strings. They support an
</P>
-<H3><A NAME="SEC251" HREF="gettext_toc.html#TOC251">15.3.3 Shell Format Strings</A></H3>
+<H3><A NAME="SEC254" HREF="gettext_toc.html#TOC254">15.3.3 Shell Format Strings</A></H3>
<P>
Shell format strings, as supported by GNU gettext and the <SAMP>‘envsubst’</SAMP>
</P>
-<H3><A NAME="SEC252" HREF="gettext_toc.html#TOC252">15.3.4 Python Format Strings</A></H3>
+<H3><A NAME="SEC255" HREF="gettext_toc.html#TOC255">15.3.4 Python Format Strings</A></H3>
<P>
There are two kinds of format strings in Python: those acceptable to
<P>
Python <CODE>%</CODE> format strings are described in
Python Library reference /
-2. Built-in Types, Exceptions and Functions /
-2.2. Built-in Types /
-2.2.6. Sequence Types /
-2.2.6.2. String Formatting Operations.
-<A HREF="http://www.python.org/doc/2.2.1/lib/typesseq-strings.html">http://www.python.org/doc/2.2.1/lib/typesseq-strings.html</A>.
+5. Built-in Types /
+5.6. Sequence Types /
+5.6.2. String Formatting Operations.
+<A HREF="http://docs.python.org/2/library/stdtypes.html#string-formatting-operations">http://docs.python.org/2/library/stdtypes.html#string-formatting-operations</A>.
</P>
<P>
</P>
-<H3><A NAME="SEC253" HREF="gettext_toc.html#TOC253">15.3.5 Lisp Format Strings</A></H3>
+<H3><A NAME="SEC256" HREF="gettext_toc.html#TOC256">15.3.5 Lisp Format Strings</A></H3>
<P>
Lisp format strings are described in the Common Lisp HyperSpec,
</P>
-<H3><A NAME="SEC254" HREF="gettext_toc.html#TOC254">15.3.6 Emacs Lisp Format Strings</A></H3>
+<H3><A NAME="SEC257" HREF="gettext_toc.html#TOC257">15.3.6 Emacs Lisp Format Strings</A></H3>
<P>
Emacs Lisp format strings are documented in the Emacs Lisp reference,
</P>
-<H3><A NAME="SEC255" HREF="gettext_toc.html#TOC255">15.3.7 librep Format Strings</A></H3>
+<H3><A NAME="SEC258" HREF="gettext_toc.html#TOC258">15.3.7 librep Format Strings</A></H3>
<P>
librep format strings are documented in the librep manual, section
</P>
-<H3><A NAME="SEC256" HREF="gettext_toc.html#TOC256">15.3.8 Scheme Format Strings</A></H3>
+<H3><A NAME="SEC259" HREF="gettext_toc.html#TOC259">15.3.8 Scheme Format Strings</A></H3>
<P>
Scheme format strings are documented in the SLIB manual, section
</P>
-<H3><A NAME="SEC257" HREF="gettext_toc.html#TOC257">15.3.9 Smalltalk Format Strings</A></H3>
+<H3><A NAME="SEC260" HREF="gettext_toc.html#TOC260">15.3.9 Smalltalk Format Strings</A></H3>
<P>
Smalltalk format strings are described in the GNU Smalltalk documentation,
</P>
-<H3><A NAME="SEC258" HREF="gettext_toc.html#TOC258">15.3.10 Java Format Strings</A></H3>
+<H3><A NAME="SEC261" HREF="gettext_toc.html#TOC261">15.3.10 Java Format Strings</A></H3>
<P>
Java format strings are described in the JDK documentation for class
</P>
-<H3><A NAME="SEC259" HREF="gettext_toc.html#TOC259">15.3.11 C# Format Strings</A></H3>
+<H3><A NAME="SEC262" HREF="gettext_toc.html#TOC262">15.3.11 C# Format Strings</A></H3>
<P>
C# format strings are described in the .NET documentation for class
</P>
-<H3><A NAME="SEC260" HREF="gettext_toc.html#TOC260">15.3.12 awk Format Strings</A></H3>
+<H3><A NAME="SEC263" HREF="gettext_toc.html#TOC263">15.3.12 awk Format Strings</A></H3>
<P>
awk format strings are described in the gawk documentation, section
</P>
-<H3><A NAME="SEC261" HREF="gettext_toc.html#TOC261">15.3.13 Object Pascal Format Strings</A></H3>
+<H3><A NAME="SEC264" HREF="gettext_toc.html#TOC264">15.3.13 Object Pascal Format Strings</A></H3>
<P>
Object Pascal format strings are described in the documentation of the
</P>
-<H3><A NAME="SEC262" HREF="gettext_toc.html#TOC262">15.3.14 YCP Format Strings</A></H3>
+<H3><A NAME="SEC265" HREF="gettext_toc.html#TOC265">15.3.14 YCP Format Strings</A></H3>
<P>
YCP sformat strings are described in the libycp documentation
</P>
-<H3><A NAME="SEC263" HREF="gettext_toc.html#TOC263">15.3.15 Tcl Format Strings</A></H3>
+<H3><A NAME="SEC266" HREF="gettext_toc.html#TOC266">15.3.15 Tcl Format Strings</A></H3>
<P>
Tcl format strings are described in the <TT>‘format.n’</TT> manual page,
</P>
-<H3><A NAME="SEC264" HREF="gettext_toc.html#TOC264">15.3.16 Perl Format Strings</A></H3>
+<H3><A NAME="SEC267" HREF="gettext_toc.html#TOC267">15.3.16 Perl Format Strings</A></H3>
<P>
There are two kinds format strings in Perl: those acceptable to the
</P>
-<H3><A NAME="SEC265" HREF="gettext_toc.html#TOC265">15.3.17 PHP Format Strings</A></H3>
+<H3><A NAME="SEC268" HREF="gettext_toc.html#TOC268">15.3.17 PHP Format Strings</A></H3>
<P>
PHP format strings are described in the documentation of the PHP function
</P>
-<H3><A NAME="SEC266" HREF="gettext_toc.html#TOC266">15.3.18 GCC internal Format Strings</A></H3>
+<H3><A NAME="SEC269" HREF="gettext_toc.html#TOC269">15.3.18 GCC internal Format Strings</A></H3>
<P>
These format strings are used inside the GCC sources. In such a format
</P>
-<H3><A NAME="SEC267" HREF="gettext_toc.html#TOC267">15.3.19 GFC internal Format Strings</A></H3>
+<H3><A NAME="SEC270" HREF="gettext_toc.html#TOC270">15.3.19 GFC internal Format Strings</A></H3>
<P>
These format strings are used inside the GNU Fortran Compiler sources,
</P>
-<H3><A NAME="SEC268" HREF="gettext_toc.html#TOC268">15.3.20 Qt Format Strings</A></H3>
+<H3><A NAME="SEC271" HREF="gettext_toc.html#TOC271">15.3.20 Qt Format Strings</A></H3>
<P>
Qt format strings are described in the documentation of the QString class
</P>
-<H3><A NAME="SEC269" HREF="gettext_toc.html#TOC269">15.3.21 Qt Format Strings</A></H3>
+<H3><A NAME="SEC272" HREF="gettext_toc.html#TOC272">15.3.21 Qt Format Strings</A></H3>
<P>
Qt format strings are described in the documentation of the QObject::tr method
</P>
-<H3><A NAME="SEC270" HREF="gettext_toc.html#TOC270">15.3.22 KDE Format Strings</A></H3>
+<H3><A NAME="SEC273" HREF="gettext_toc.html#TOC273">15.3.22 KDE Format Strings</A></H3>
<P>
KDE 4 format strings are defined as follows:
</P>
-<H3><A NAME="SEC271" HREF="gettext_toc.html#TOC271">15.3.23 Boost Format Strings</A></H3>
+<H3><A NAME="SEC274" HREF="gettext_toc.html#TOC274">15.3.23 KUIT Format Strings</A></H3>
+
+<P>
+KUIT (KDE User Interface Text) is compatible with KDE 4 format strings,
+while it also allows programmers to add semantic information to a format
+string, through XML markup tags. For example, if the first format
+directive in a string is a filename, programmers could indicate that
+with a <SAMP>‘filename’</SAMP> tag, like <SAMP>‘<filename>%1</filename>’</SAMP>.
+
+</P>
+<P>
+KUIT format strings are described in
+<A HREF="http://api.kde.org/frameworks-api/frameworks5-apidocs/ki18n/html/prg_guide.html#kuit_markup">http://api.kde.org/frameworks-api/frameworks5-apidocs/ki18n/html/prg_guide.html#kuit_markup</A>.
+
+</P>
+
+
+<H3><A NAME="SEC275" HREF="gettext_toc.html#TOC275">15.3.24 Boost Format Strings</A></H3>
<P>
Boost format strings are described in the documentation of the
</P>
-<H3><A NAME="SEC272" HREF="gettext_toc.html#TOC272">15.3.24 Lua Format Strings</A></H3>
+<H3><A NAME="SEC276" HREF="gettext_toc.html#TOC276">15.3.25 Lua Format Strings</A></H3>
<P>
Lua format strings are described in the Lua reference manual, section String Manipulation,
</P>
-<H3><A NAME="SEC273" HREF="gettext_toc.html#TOC273">15.3.25 JavaScript Format Strings</A></H3>
+<H3><A NAME="SEC277" HREF="gettext_toc.html#TOC277">15.3.26 JavaScript Format Strings</A></H3>
<P>
Although JavaScript specification itself does not define any format
-<H2><A NAME="SEC274" HREF="gettext_toc.html#TOC274">15.4 The Maintainer's View</A></H2>
+<H2><A NAME="SEC278" HREF="gettext_toc.html#TOC278">15.4 The Maintainer's View</A></H2>
<P>
For the maintainer, the general procedure differs from the C language
<LI>
If only a single programming language is used, the <CODE>XGETTEXT_OPTIONS</CODE>
-variable in <TT>‘po/Makevars’</TT> (see section <A HREF="gettext_13.html#SEC218">13.4.3 <TT>‘Makevars’</TT> in <TT>‘po/’</TT></A>) should be adjusted to
+variable in <TT>‘po/Makevars’</TT> (see section <A HREF="gettext_13.html#SEC220">13.4.3 <TT>‘Makevars’</TT> in <TT>‘po/’</TT></A>) should be adjusted to
match the <CODE>xgettext</CODE> options for that particular programming language.
If the package uses more than one programming language with <CODE>gettext</CODE>
support, it becomes necessary to change the POT file construction rule
-<H2><A NAME="SEC275" HREF="gettext_toc.html#TOC275">15.5 Individual Programming Languages</A></H2>
+<H2><A NAME="SEC279" HREF="gettext_toc.html#TOC279">15.5 Individual Programming Languages</A></H2>
-<H3><A NAME="SEC276" HREF="gettext_toc.html#TOC276">15.5.1 C, C++, Objective C</A></H3>
+<H3><A NAME="SEC280" HREF="gettext_toc.html#TOC280">15.5.1 C, C++, Objective C</A></H3>
<P>
-<A NAME="IDX1182"></A>
+<A NAME="IDX1221"></A>
</P>
<DL COMPACT>
</P>
-<H3><A NAME="SEC277" HREF="gettext_toc.html#TOC277">15.5.2 sh - Shell Script</A></H3>
+<H3><A NAME="SEC281" HREF="gettext_toc.html#TOC281">15.5.2 sh - Shell Script</A></H3>
<P>
-<A NAME="IDX1183"></A>
+<A NAME="IDX1222"></A>
</P>
<DL COMPACT>
<DT>gettext/ngettext functions
<DD>
-<A NAME="IDX1184"></A>
-<A NAME="IDX1185"></A>
+<A NAME="IDX1223"></A>
+<A NAME="IDX1224"></A>
<CODE>gettext</CODE>, <CODE>ngettext</CODE> programs
<BR><CODE>eval_gettext</CODE>, <CODE>eval_ngettext</CODE> shell functions
<DT>textdomain
<DD>
-<A NAME="IDX1186"></A>
+<A NAME="IDX1225"></A>
environment variable <CODE>TEXTDOMAIN</CODE>
<DT>bindtextdomain
<DD>
-<A NAME="IDX1187"></A>
+<A NAME="IDX1226"></A>
environment variable <CODE>TEXTDOMAINDIR</CODE>
<DT>setlocale
-<H4><A NAME="SEC278" HREF="gettext_toc.html#TOC278">15.5.2.1 Preparing Shell Scripts for Internationalization</A></H4>
+<H4><A NAME="SEC282" HREF="gettext_toc.html#TOC282">15.5.2.1 Preparing Shell Scripts for Internationalization</A></H4>
<P>
-<A NAME="IDX1188"></A>
+<A NAME="IDX1227"></A>
</P>
<P>
near the top of the script. <CODE>gettext.sh</CODE> is a shell function library
that provides the functions
-<CODE>eval_gettext</CODE> (see section <A HREF="gettext_15.html#SEC283">15.5.2.6 Invoking the <CODE>eval_gettext</CODE> function</A>) and
-<CODE>eval_ngettext</CODE> (see section <A HREF="gettext_15.html#SEC284">15.5.2.7 Invoking the <CODE>eval_ngettext</CODE> function</A>).
+<CODE>eval_gettext</CODE> (see section <A HREF="gettext_15.html#SEC287">15.5.2.6 Invoking the <CODE>eval_gettext</CODE> function</A>) and
+<CODE>eval_ngettext</CODE> (see section <A HREF="gettext_15.html#SEC288">15.5.2.7 Invoking the <CODE>eval_ngettext</CODE> function</A>).
You have to ensure that <CODE>gettext.sh</CODE> can be found in the <CODE>PATH</CODE>.
<LI>
-<H4><A NAME="SEC279" HREF="gettext_toc.html#TOC279">15.5.2.2 Contents of <CODE>gettext.sh</CODE></A></H4>
+<H4><A NAME="SEC283" HREF="gettext_toc.html#TOC283">15.5.2.2 Contents of <CODE>gettext.sh</CODE></A></H4>
<P>
<CODE>gettext.sh</CODE>, contained in the run-time package of GNU gettext, provides
<LI>eval_gettext
-See section <A HREF="gettext_15.html#SEC283">15.5.2.6 Invoking the <CODE>eval_gettext</CODE> function</A>.
+See section <A HREF="gettext_15.html#SEC287">15.5.2.6 Invoking the <CODE>eval_gettext</CODE> function</A>.
<LI>eval_ngettext
-See section <A HREF="gettext_15.html#SEC284">15.5.2.7 Invoking the <CODE>eval_ngettext</CODE> function</A>.
+See section <A HREF="gettext_15.html#SEC288">15.5.2.7 Invoking the <CODE>eval_ngettext</CODE> function</A>.
</UL>
-<H4><A NAME="SEC280" HREF="gettext_toc.html#TOC280">15.5.2.3 Invoking the <CODE>gettext</CODE> program</A></H4>
+<H4><A NAME="SEC284" HREF="gettext_toc.html#TOC284">15.5.2.3 Invoking the <CODE>gettext</CODE> program</A></H4>
<P>
-<A NAME="IDX1189"></A>
-<A NAME="IDX1190"></A>
+<A NAME="IDX1228"></A>
+<A NAME="IDX1229"></A>
<PRE>
gettext [<VAR>option</VAR>] [[<VAR>textdomain</VAR>] <VAR>msgid</VAR>]
</PRE>
<P>
-<A NAME="IDX1191"></A>
+<A NAME="IDX1230"></A>
The <CODE>gettext</CODE> program displays the native language translation of a
textual message.
<DD>
<DT><SAMP>‘--domain=<VAR>textdomain</VAR>’</SAMP>
<DD>
-<A NAME="IDX1192"></A>
-<A NAME="IDX1193"></A>
+<A NAME="IDX1231"></A>
+<A NAME="IDX1232"></A>
Retrieve translated messages from <VAR>textdomain</VAR>. Usually a <VAR>textdomain</VAR>
corresponds to a package, a program, or a module of a program.
<DT><SAMP>‘-e’</SAMP>
<DD>
-<A NAME="IDX1194"></A>
+<A NAME="IDX1233"></A>
Enable expansion of some escape sequences. This option is for compatibility
with the <SAMP>‘echo’</SAMP> program or shell built-in. The escape sequences
<SAMP>‘\a’</SAMP>, <SAMP>‘\b’</SAMP>, <SAMP>‘\c’</SAMP>, <SAMP>‘\f’</SAMP>, <SAMP>‘\n’</SAMP>, <SAMP>‘\r’</SAMP>, <SAMP>‘\t’</SAMP>,
<DT><SAMP>‘-E’</SAMP>
<DD>
-<A NAME="IDX1195"></A>
+<A NAME="IDX1234"></A>
This option is only for compatibility with the <SAMP>‘echo’</SAMP> program or shell
built-in. It has no effect.
<DD>
<DT><SAMP>‘--help’</SAMP>
<DD>
-<A NAME="IDX1196"></A>
-<A NAME="IDX1197"></A>
+<A NAME="IDX1235"></A>
+<A NAME="IDX1236"></A>
Display this help and exit.
<DT><SAMP>‘-n’</SAMP>
<DD>
-<A NAME="IDX1198"></A>
+<A NAME="IDX1237"></A>
Suppress trailing newline. By default, <CODE>gettext</CODE> adds a newline to
the output.
<DD>
<DT><SAMP>‘--version’</SAMP>
<DD>
-<A NAME="IDX1199"></A>
-<A NAME="IDX1200"></A>
+<A NAME="IDX1238"></A>
+<A NAME="IDX1239"></A>
Output version information and exit.
<DT><SAMP>‘[<VAR>textdomain</VAR>] <VAR>msgid</VAR>’</SAMP>
</P>
-<H4><A NAME="SEC281" HREF="gettext_toc.html#TOC281">15.5.2.4 Invoking the <CODE>ngettext</CODE> program</A></H4>
+<H4><A NAME="SEC285" HREF="gettext_toc.html#TOC285">15.5.2.4 Invoking the <CODE>ngettext</CODE> program</A></H4>
<P>
-<A NAME="IDX1201"></A>
-<A NAME="IDX1202"></A>
+<A NAME="IDX1240"></A>
+<A NAME="IDX1241"></A>
<PRE>
ngettext [<VAR>option</VAR>] [<VAR>textdomain</VAR>] <VAR>msgid</VAR> <VAR>msgid-plural</VAR> <VAR>count</VAR>
</PRE>
<P>
-<A NAME="IDX1203"></A>
+<A NAME="IDX1242"></A>
The <CODE>ngettext</CODE> program displays the native language translation of a
textual message whose grammatical form depends on a number.
<DD>
<DT><SAMP>‘--domain=<VAR>textdomain</VAR>’</SAMP>
<DD>
-<A NAME="IDX1204"></A>
-<A NAME="IDX1205"></A>
+<A NAME="IDX1243"></A>
+<A NAME="IDX1244"></A>
Retrieve translated messages from <VAR>textdomain</VAR>. Usually a <VAR>textdomain</VAR>
corresponds to a package, a program, or a module of a program.
<DT><SAMP>‘-e’</SAMP>
<DD>
-<A NAME="IDX1206"></A>
+<A NAME="IDX1245"></A>
Enable expansion of some escape sequences. This option is for compatibility
with the <SAMP>‘gettext’</SAMP> program. The escape sequences
<SAMP>‘\a’</SAMP>, <SAMP>‘\b’</SAMP>, <SAMP>‘\c’</SAMP>, <SAMP>‘\f’</SAMP>, <SAMP>‘\n’</SAMP>, <SAMP>‘\r’</SAMP>, <SAMP>‘\t’</SAMP>,
<DT><SAMP>‘-E’</SAMP>
<DD>
-<A NAME="IDX1207"></A>
+<A NAME="IDX1246"></A>
This option is only for compatibility with the <SAMP>‘gettext’</SAMP> program. It has
no effect.
<DD>
<DT><SAMP>‘--help’</SAMP>
<DD>
-<A NAME="IDX1208"></A>
-<A NAME="IDX1209"></A>
+<A NAME="IDX1247"></A>
+<A NAME="IDX1248"></A>
Display this help and exit.
<DT><SAMP>‘-V’</SAMP>
<DD>
<DT><SAMP>‘--version’</SAMP>
<DD>
-<A NAME="IDX1210"></A>
-<A NAME="IDX1211"></A>
+<A NAME="IDX1249"></A>
+<A NAME="IDX1250"></A>
Output version information and exit.
<DT><SAMP>‘<VAR>textdomain</VAR>’</SAMP>
</P>
-<H4><A NAME="SEC282" HREF="gettext_toc.html#TOC282">15.5.2.5 Invoking the <CODE>envsubst</CODE> program</A></H4>
+<H4><A NAME="SEC286" HREF="gettext_toc.html#TOC286">15.5.2.5 Invoking the <CODE>envsubst</CODE> program</A></H4>
<P>
-<A NAME="IDX1212"></A>
-<A NAME="IDX1213"></A>
+<A NAME="IDX1251"></A>
+<A NAME="IDX1252"></A>
<PRE>
envsubst [<VAR>option</VAR>] [<VAR>shell-format</VAR>]
</PRE>
<P>
-<A NAME="IDX1214"></A>
-<A NAME="IDX1215"></A>
-<A NAME="IDX1216"></A>
+<A NAME="IDX1253"></A>
+<A NAME="IDX1254"></A>
+<A NAME="IDX1255"></A>
The <CODE>envsubst</CODE> program substitutes the values of environment variables.
</P>
<DD>
<DT><SAMP>‘--variables’</SAMP>
<DD>
-<A NAME="IDX1217"></A>
-<A NAME="IDX1218"></A>
+<A NAME="IDX1256"></A>
+<A NAME="IDX1257"></A>
Output the variables occurring in <VAR>shell-format</VAR>.
</DL>
<DD>
<DT><SAMP>‘--help’</SAMP>
<DD>
-<A NAME="IDX1219"></A>
-<A NAME="IDX1220"></A>
+<A NAME="IDX1258"></A>
+<A NAME="IDX1259"></A>
Display this help and exit.
<DT><SAMP>‘-V’</SAMP>
<DD>
<DT><SAMP>‘--version’</SAMP>
<DD>
-<A NAME="IDX1221"></A>
-<A NAME="IDX1222"></A>
+<A NAME="IDX1260"></A>
+<A NAME="IDX1261"></A>
Output version information and exit.
</DL>
</P>
-<H4><A NAME="SEC283" HREF="gettext_toc.html#TOC283">15.5.2.6 Invoking the <CODE>eval_gettext</CODE> function</A></H4>
+<H4><A NAME="SEC287" HREF="gettext_toc.html#TOC287">15.5.2.6 Invoking the <CODE>eval_gettext</CODE> function</A></H4>
<P>
-<A NAME="IDX1223"></A>
+<A NAME="IDX1262"></A>
<PRE>
eval_gettext <VAR>msgid</VAR>
</PRE>
<P>
-<A NAME="IDX1224"></A>
+<A NAME="IDX1263"></A>
This function outputs the native language translation of a textual message,
performing dollar-substitution on the result. Note that only shell variables
mentioned in <VAR>msgid</VAR> will be dollar-substituted in the result.
</P>
-<H4><A NAME="SEC284" HREF="gettext_toc.html#TOC284">15.5.2.7 Invoking the <CODE>eval_ngettext</CODE> function</A></H4>
+<H4><A NAME="SEC288" HREF="gettext_toc.html#TOC288">15.5.2.7 Invoking the <CODE>eval_ngettext</CODE> function</A></H4>
<P>
-<A NAME="IDX1225"></A>
+<A NAME="IDX1264"></A>
<PRE>
eval_ngettext <VAR>msgid</VAR> <VAR>msgid-plural</VAR> <VAR>count</VAR>
</PRE>
<P>
-<A NAME="IDX1226"></A>
+<A NAME="IDX1265"></A>
This function outputs the native language translation of a textual message
whose grammatical form depends on a number, performing dollar-substitution
on the result. Note that only shell variables mentioned in <VAR>msgid</VAR> or
</P>
-<H3><A NAME="SEC285" HREF="gettext_toc.html#TOC285">15.5.3 bash - Bourne-Again Shell Script</A></H3>
+<H3><A NAME="SEC289" HREF="gettext_toc.html#TOC289">15.5.3 bash - Bourne-Again Shell Script</A></H3>
<P>
-<A NAME="IDX1227"></A>
+<A NAME="IDX1266"></A>
</P>
<P>
</P>
-<H3><A NAME="SEC286" HREF="gettext_toc.html#TOC286">15.5.4 Python</A></H3>
+<H3><A NAME="SEC290" HREF="gettext_toc.html#TOC290">15.5.4 Python</A></H3>
<P>
-<A NAME="IDX1228"></A>
+<A NAME="IDX1267"></A>
</P>
<DL COMPACT>
-<H3><A NAME="SEC287" HREF="gettext_toc.html#TOC287">15.5.5 GNU clisp - Common Lisp</A></H3>
+<H3><A NAME="SEC291" HREF="gettext_toc.html#TOC291">15.5.5 GNU clisp - Common Lisp</A></H3>
<P>
-<A NAME="IDX1229"></A>
-<A NAME="IDX1230"></A>
-<A NAME="IDX1231"></A>
+<A NAME="IDX1268"></A>
+<A NAME="IDX1269"></A>
+<A NAME="IDX1270"></A>
</P>
<DL COMPACT>
</P>
-<H3><A NAME="SEC288" HREF="gettext_toc.html#TOC288">15.5.6 GNU clisp C sources</A></H3>
+<H3><A NAME="SEC292" HREF="gettext_toc.html#TOC292">15.5.6 GNU clisp C sources</A></H3>
<P>
-<A NAME="IDX1232"></A>
+<A NAME="IDX1271"></A>
</P>
<DL COMPACT>
-<H3><A NAME="SEC289" HREF="gettext_toc.html#TOC289">15.5.7 Emacs Lisp</A></H3>
+<H3><A NAME="SEC293" HREF="gettext_toc.html#TOC293">15.5.7 Emacs Lisp</A></H3>
<P>
-<A NAME="IDX1233"></A>
+<A NAME="IDX1272"></A>
</P>
<DL COMPACT>
-<H3><A NAME="SEC290" HREF="gettext_toc.html#TOC290">15.5.8 librep</A></H3>
+<H3><A NAME="SEC294" HREF="gettext_toc.html#TOC294">15.5.8 librep</A></H3>
<P>
-<A NAME="IDX1234"></A>
+<A NAME="IDX1273"></A>
</P>
<DL COMPACT>
</P>
-<H3><A NAME="SEC291" HREF="gettext_toc.html#TOC291">15.5.9 GNU guile - Scheme</A></H3>
+<H3><A NAME="SEC295" HREF="gettext_toc.html#TOC295">15.5.9 GNU guile - Scheme</A></H3>
<P>
-<A NAME="IDX1235"></A>
-<A NAME="IDX1236"></A>
+<A NAME="IDX1274"></A>
+<A NAME="IDX1275"></A>
</P>
<DL COMPACT>
<DT>gettext shorthand
<DD>
-<CODE>(_ "abc")</CODE>
+<CODE>(_ "abc")</CODE>, <CODE>_"abc"</CODE> (GIMP script-fu extension)
<DT>gettext/ngettext functions
<DD>
</P>
-<H3><A NAME="SEC292" HREF="gettext_toc.html#TOC292">15.5.10 GNU Smalltalk</A></H3>
+<H3><A NAME="SEC296" HREF="gettext_toc.html#TOC296">15.5.10 GNU Smalltalk</A></H3>
<P>
-<A NAME="IDX1237"></A>
+<A NAME="IDX1276"></A>
</P>
<DL COMPACT>
</P>
-<H3><A NAME="SEC293" HREF="gettext_toc.html#TOC293">15.5.11 Java</A></H3>
+<H3><A NAME="SEC297" HREF="gettext_toc.html#TOC297">15.5.11 Java</A></H3>
<P>
-<A NAME="IDX1238"></A>
+<A NAME="IDX1277"></A>
</P>
<DL COMPACT>
handling and the <CODE>pgettext</CODE> and <CODE>npgettext</CODE> for strings constraint
to a particular context.
-<A NAME="IDX1239"></A>
+<A NAME="IDX1278"></A>
To use this API, one needs the <CODE>libintl.jar</CODE> file which is part of
the GNU gettext package and distributed under the LGPL.
</OL>
</P>
-<H3><A NAME="SEC294" HREF="gettext_toc.html#TOC294">15.5.12 C#</A></H3>
+<H3><A NAME="SEC298" HREF="gettext_toc.html#TOC298">15.5.12 C#</A></H3>
<P>
-<A NAME="IDX1240"></A>
+<A NAME="IDX1279"></A>
</P>
<DL COMPACT>
specific to a particular context, with plural handling, like the
<CODE>npgettext</CODE> function in C.
-<A NAME="IDX1241"></A>
+<A NAME="IDX1280"></A>
To use this API, one needs the <CODE>GNU.Gettext.dll</CODE> file which is part of
the GNU gettext package and distributed under the LGPL.
</OL>
</P>
-<H3><A NAME="SEC295" HREF="gettext_toc.html#TOC295">15.5.13 GNU awk</A></H3>
+<H3><A NAME="SEC299" HREF="gettext_toc.html#TOC299">15.5.13 GNU awk</A></H3>
<P>
-<A NAME="IDX1242"></A>
-<A NAME="IDX1243"></A>
+<A NAME="IDX1281"></A>
+<A NAME="IDX1282"></A>
</P>
<DL COMPACT>
<DT>File extension
<DD>
-<CODE>awk</CODE>
+<CODE>awk</CODE>, <CODE>gawk</CODE>, <CODE>twjr</CODE>.
+The file extension <CODE>twjr</CODE> is used by TexiWeb Jr
+(<A HREF="https://github.com/arnoldrobbins/texiwebjr">https://github.com/arnoldrobbins/texiwebjr</A>).
<DT>String syntax
<DD>
</P>
-<H3><A NAME="SEC296" HREF="gettext_toc.html#TOC296">15.5.14 Pascal - Free Pascal Compiler</A></H3>
+<H3><A NAME="SEC300" HREF="gettext_toc.html#TOC300">15.5.14 Pascal - Free Pascal Compiler</A></H3>
<P>
-<A NAME="IDX1244"></A>
-<A NAME="IDX1245"></A>
-<A NAME="IDX1246"></A>
+<A NAME="IDX1283"></A>
+<A NAME="IDX1284"></A>
+<A NAME="IDX1285"></A>
</P>
<DL COMPACT>
</P>
-<H3><A NAME="SEC297" HREF="gettext_toc.html#TOC297">15.5.15 wxWidgets library</A></H3>
+<H3><A NAME="SEC301" HREF="gettext_toc.html#TOC301">15.5.15 wxWidgets library</A></H3>
<P>
-<A NAME="IDX1247"></A>
+<A NAME="IDX1286"></A>
</P>
<DL COMPACT>
-<H3><A NAME="SEC298" HREF="gettext_toc.html#TOC298">15.5.16 YCP - YaST2 scripting language</A></H3>
+<H3><A NAME="SEC302" HREF="gettext_toc.html#TOC302">15.5.16 YCP - YaST2 scripting language</A></H3>
<P>
-<A NAME="IDX1248"></A>
-<A NAME="IDX1249"></A>
+<A NAME="IDX1287"></A>
+<A NAME="IDX1288"></A>
</P>
<DL COMPACT>
</P>
-<H3><A NAME="SEC299" HREF="gettext_toc.html#TOC299">15.5.17 Tcl - Tk's scripting language</A></H3>
+<H3><A NAME="SEC303" HREF="gettext_toc.html#TOC303">15.5.17 Tcl - Tk's scripting language</A></H3>
<P>
-<A NAME="IDX1250"></A>
-<A NAME="IDX1251"></A>
+<A NAME="IDX1289"></A>
+<A NAME="IDX1290"></A>
</P>
<DL COMPACT>
</P>
-<H3><A NAME="SEC300" HREF="gettext_toc.html#TOC300">15.5.18 Perl</A></H3>
+<H3><A NAME="SEC304" HREF="gettext_toc.html#TOC304">15.5.18 Perl</A></H3>
<P>
-<A NAME="IDX1252"></A>
+<A NAME="IDX1291"></A>
</P>
<DL COMPACT>
</P>
<P>
-<A NAME="IDX1253"></A>
+<A NAME="IDX1292"></A>
</P>
<P>
-<H4><A NAME="SEC301" HREF="gettext_toc.html#TOC301">15.5.18.1 General Problems Parsing Perl Code</A></H4>
+<H4><A NAME="SEC305" HREF="gettext_toc.html#TOC305">15.5.18.1 General Problems Parsing Perl Code</A></H4>
<P>
It is often heard that only Perl can parse Perl. This is not true.
</P>
-<H4><A NAME="SEC302" HREF="gettext_toc.html#TOC302">15.5.18.2 Which keywords will xgettext look for?</A></H4>
+<H4><A NAME="SEC306" HREF="gettext_toc.html#TOC306">15.5.18.2 Which keywords will xgettext look for?</A></H4>
<P>
-<A NAME="IDX1254"></A>
+<A NAME="IDX1293"></A>
</P>
<P>
-<H4><A NAME="SEC303" HREF="gettext_toc.html#TOC303">15.5.18.3 How to Extract Hash Keys</A></H4>
+<H4><A NAME="SEC307" HREF="gettext_toc.html#TOC307">15.5.18.3 How to Extract Hash Keys</A></H4>
<P>
-<A NAME="IDX1255"></A>
+<A NAME="IDX1294"></A>
</P>
<P>
</P>
-<H4><A NAME="SEC304" HREF="gettext_toc.html#TOC304">15.5.18.4 What are Strings And Quote-like Expressions?</A></H4>
+<H4><A NAME="SEC308" HREF="gettext_toc.html#TOC308">15.5.18.4 What are Strings And Quote-like Expressions?</A></H4>
<P>
-<A NAME="IDX1256"></A>
+<A NAME="IDX1295"></A>
</P>
<P>
-<H4><A NAME="SEC305" HREF="gettext_toc.html#TOC305">15.5.18.5 Invalid Uses Of String Interpolation</A></H4>
+<H4><A NAME="SEC309" HREF="gettext_toc.html#TOC309">15.5.18.5 Invalid Uses Of String Interpolation</A></H4>
<P>
-<A NAME="IDX1257"></A>
+<A NAME="IDX1296"></A>
</P>
<P>
</P>
-<H4><A NAME="SEC306" HREF="gettext_toc.html#TOC306">15.5.18.6 Valid Uses Of String Interpolation</A></H4>
+<H4><A NAME="SEC310" HREF="gettext_toc.html#TOC310">15.5.18.6 Valid Uses Of String Interpolation</A></H4>
<P>
-<A NAME="IDX1258"></A>
+<A NAME="IDX1297"></A>
</P>
<P>
-<H4><A NAME="SEC307" HREF="gettext_toc.html#TOC307">15.5.18.7 When To Use Parentheses</A></H4>
+<H4><A NAME="SEC311" HREF="gettext_toc.html#TOC311">15.5.18.7 When To Use Parentheses</A></H4>
<P>
-<A NAME="IDX1259"></A>
+<A NAME="IDX1298"></A>
</P>
<P>
-<H4><A NAME="SEC308" HREF="gettext_toc.html#TOC308">15.5.18.8 How To Grok with Long Lines</A></H4>
+<H4><A NAME="SEC312" HREF="gettext_toc.html#TOC312">15.5.18.8 How To Grok with Long Lines</A></H4>
<P>
-<A NAME="IDX1260"></A>
+<A NAME="IDX1299"></A>
</P>
<P>
</P>
-<H4><A NAME="SEC309" HREF="gettext_toc.html#TOC309">15.5.18.9 Bugs, Pitfalls, And Things That Do Not Work</A></H4>
+<H4><A NAME="SEC313" HREF="gettext_toc.html#TOC313">15.5.18.9 Bugs, Pitfalls, And Things That Do Not Work</A></H4>
<P>
-<A NAME="IDX1261"></A>
+<A NAME="IDX1300"></A>
</P>
<P>
</P>
-<H3><A NAME="SEC310" HREF="gettext_toc.html#TOC310">15.5.19 PHP Hypertext Preprocessor</A></H3>
+<H3><A NAME="SEC314" HREF="gettext_toc.html#TOC314">15.5.19 PHP Hypertext Preprocessor</A></H3>
<P>
-<A NAME="IDX1262"></A>
+<A NAME="IDX1301"></A>
</P>
<DL COMPACT>
</P>
-<H3><A NAME="SEC311" HREF="gettext_toc.html#TOC311">15.5.20 Pike</A></H3>
+<H3><A NAME="SEC315" HREF="gettext_toc.html#TOC315">15.5.20 Pike</A></H3>
<P>
-<A NAME="IDX1263"></A>
+<A NAME="IDX1302"></A>
</P>
<DL COMPACT>
-<H3><A NAME="SEC312" HREF="gettext_toc.html#TOC312">15.5.21 GNU Compiler Collection sources</A></H3>
+<H3><A NAME="SEC316" HREF="gettext_toc.html#TOC316">15.5.21 GNU Compiler Collection sources</A></H3>
<P>
-<A NAME="IDX1264"></A>
+<A NAME="IDX1303"></A>
</P>
<DL COMPACT>
-<H3><A NAME="SEC313" HREF="gettext_toc.html#TOC313">15.5.22 Lua</A></H3>
+<H3><A NAME="SEC317" HREF="gettext_toc.html#TOC317">15.5.22 Lua</A></H3>
<DL COMPACT>
-<H3><A NAME="SEC314" HREF="gettext_toc.html#TOC314">15.5.23 JavaScript</A></H3>
+<H3><A NAME="SEC318" HREF="gettext_toc.html#TOC318">15.5.23 JavaScript</A></H3>
<DL COMPACT>
-<H2><A NAME="SEC315" HREF="gettext_toc.html#TOC315">15.6 Internationalizable Data</A></H2>
+<H3><A NAME="SEC319" HREF="gettext_toc.html#TOC319">15.5.24 Vala</A></H3>
+
+<DL COMPACT>
+
+<DT>RPMs
+<DD>
+vala
+
+<DT>File extension
+<DD>
+<CODE>vala</CODE>
+
+<DT>String syntax
+<DD>
+
+<UL>
+
+<LI><CODE>"abc"</CODE>
+
+<LI><CODE>"""abc"""</CODE>
+
+</UL>
+
+<DT>gettext shorthand
+<DD>
+<CODE>_("abc")</CODE>
+
+<DT>gettext/ngettext functions
+<DD>
+<CODE>gettext</CODE>, <CODE>dgettext</CODE>, <CODE>dcgettext</CODE>, <CODE>ngettext</CODE>,
+<CODE>dngettext</CODE>, <CODE>dpgettext</CODE>, <CODE>dpgettext2</CODE>
+
+<DT>textdomain
+<DD>
+<CODE>textdomain</CODE> function, defined under the <CODE>Intl</CODE> namespace
+
+<DT>bindtextdomain
+<DD>
+<CODE>bindtextdomain</CODE> function, defined under the <CODE>Intl</CODE> namespace
+
+<DT>setlocale
+<DD>
+Programmer must call <CODE>Intl.setlocale (LocaleCategory.ALL, "")</CODE>
+
+<DT>Prerequisite
+<DD>
+---
+
+<DT>Use or emulate GNU gettext
+<DD>
+Use
+
+<DT>Extractor
+<DD>
+<CODE>xgettext</CODE>
+
+<DT>Formatting with positions
+<DD>
+Same as for the C language.
+
+<DT>Portability
+<DD>
+autoconf (gettext.m4) and #if ENABLE_NLS
+
+<DT>po-mode marking
+<DD>
+yes
+</DL>
+
+
+
+<H2><A NAME="SEC320" HREF="gettext_toc.html#TOC320">15.6 Internationalizable Data</A></H2>
<P>
Here is a list of other data formats which can be internationalized
-<H3><A NAME="SEC316" HREF="gettext_toc.html#TOC316">15.6.1 POT - Portable Object Template</A></H3>
+<H3><A NAME="SEC321" HREF="gettext_toc.html#TOC321">15.6.1 POT - Portable Object Template</A></H3>
<DL COMPACT>
-<H3><A NAME="SEC317" HREF="gettext_toc.html#TOC317">15.6.2 Resource String Table</A></H3>
+<H3><A NAME="SEC322" HREF="gettext_toc.html#TOC322">15.6.2 Resource String Table</A></H3>
<P>
-<A NAME="IDX1265"></A>
+<A NAME="IDX1304"></A>
</P>
<DL COMPACT>
-<H3><A NAME="SEC318" HREF="gettext_toc.html#TOC318">15.6.3 Glade - GNOME user interface description</A></H3>
+<H3><A NAME="SEC323" HREF="gettext_toc.html#TOC323">15.6.3 Glade - GNOME user interface description</A></H3>
<DL COMPACT>
<CODE>xgettext</CODE>, <CODE>libglade-xgettext</CODE>, <CODE>xml-i18n-extract</CODE>, <CODE>intltool-extract</CODE>
</DL>
+
+
+<H3><A NAME="SEC324" HREF="gettext_toc.html#TOC324">15.6.4 GSettings - GNOME user configuration schema</A></H3>
+
+<DL COMPACT>
+
+<DT>RPMs
+<DD>
+glib2
+
+<DT>File extension
+<DD>
+<CODE>gschema.xml</CODE>
+
+<DT>Extractor
+<DD>
+<CODE>xgettext</CODE>, <CODE>intltool-extract</CODE>
+</DL>
+
+
+
+<H3><A NAME="SEC325" HREF="gettext_toc.html#TOC325">15.6.5 AppData - freedesktop.org application description</A></H3>
+
+<DL COMPACT>
+
+<DT>RPMs
+<DD>
+appdata-tools, appstream, libappstream-glib, libappstream-glib-builder
+
+<DT>File extension
+<DD>
+<CODE>appdata.xml</CODE>
+
+<DT>Extractor
+<DD>
+<CODE>xgettext</CODE>, <CODE>intltool-extract</CODE>, <CODE>itstool</CODE>
+</DL>
+
+
+
+<H3><A NAME="SEC326" HREF="gettext_toc.html#TOC326">15.6.6 Preparing Rules for XML Internationalization</A></H3>
+<P>
+<A NAME="IDX1305"></A>
+
+</P>
+<P>
+Marking translatable strings in an XML file is done through a separate
+"rule" file, making use of the Internationalization Tag Set standard
+(ITS, <A HREF="http://www.w3.org/TR/its20/">http://www.w3.org/TR/its20/</A>). The currently supported ITS
+data categories are: <SAMP>‘Translate’</SAMP>, <SAMP>‘Localization Note’</SAMP>,
+<SAMP>‘Elements Within Text’</SAMP>, and <SAMP>‘Preserve Space’</SAMP>. In addition to
+them, <CODE>xgettext</CODE> also recognizes the following extended data
+categories:
+
+</P>
+<DL COMPACT>
+
+<DT><SAMP>‘Context’</SAMP>
+<DD>
+This data category associates <CODE>msgctxt</CODE> to the extracted text. In
+the global rule, the <CODE>contextRule</CODE> element contains the following:
+
+
+<UL>
+<LI>
+
+A required <CODE>selector</CODE> attribute. It contains an absolute selector
+that selects the nodes to which this rule applies.
+
+<LI>
+
+A required <CODE>contextPointer</CODE> attribute that contains a relative
+selector pointing to a node that holds the <CODE>msgctxt</CODE> value.
+
+<LI>
+
+An optional <CODE>textPointer</CODE> attribute that contains a relative
+selector pointing to a node that holds the <CODE>msgid</CODE> value.
+</UL>
+
+<DT><SAMP>‘Escape Special Characters’</SAMP>
+<DD>
+This data category indicates whether the special XML characters
+(<CODE><</CODE>, <CODE>></CODE>, <CODE>&</CODE>, <CODE>"</CODE>) are escaped with entity
+reference. In the global rule, the <CODE>escapeRule</CODE> element contains
+the following:
+
+
+<UL>
+<LI>
+
+A required <CODE>selector</CODE> attribute. It contains an absolute selector
+that selects the nodes to which this rule applies.
+
+<LI>
+
+A required <CODE>escape</CODE> attribute with the value <CODE>yes</CODE> or <CODE>no</CODE>.
+</UL>
+
+<DT><SAMP>‘Extended Preserve Space’</SAMP>
+<DD>
+This data category extends the standard <SAMP>‘Preserve Space’</SAMP> data
+category with the additional value <SAMP>‘trim’</SAMP>. The value means to
+remove the leading and trailing whitespaces of the content, but not to
+normalize whitespaces in the middle. In the global rule, the
+<CODE>preserveSpaceRule</CODE> element contains the following:
+
+
+<UL>
+<LI>
+
+A required <CODE>selector</CODE> attribute. It contains an absolute selector
+that selects the nodes to which this rule applies.
+
+<LI>
+
+A required <CODE>space</CODE> attribute with the value <CODE>default</CODE>,
+<CODE>preserve</CODE>, or <CODE>trim</CODE>.
+</UL>
+
+</DL>
+
+<P>
+All those extended data categories can only be expressed with global
+rules, and the rule elements have to have the
+<CODE>https://www.gnu.org/s/gettext/ns/its/extensions/1.0</CODE> namespace.
+
+</P>
+<P>
+Given the following XML document in a file <TT>‘messages.xml’</TT>:
+
+</P>
+
+<PRE>
+<?xml version="1.0"?>
+<messages>
+ <message>
+ <p>A translatable string</p>
+ </message>
+ <message>
+ <p translatable="no">A non-translatable string</p>
+ </message>
+</messages>
+</PRE>
+
+<P>
+To extract the first text content ("A translatable string"), but not the
+second ("A non-translatable string"), the following ITS rules can be used:
+
+</P>
+
+<PRE>
+<?xml version="1.0"?>
+<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+ <its:translateRule selector="/messages" translate="no"/>
+ <its:translateRule selector="//message/p" translate="yes"/>
+
+ <!-- If 'p' has an attribute 'translatable' with the value 'no', then
+ the content is not translatable. -->
+ <its:translateRule selector="//message/p[@translatable = 'no']"
+ translate="no"/>
+</its:rules>
+</PRE>
+
+<P>
+<SAMP>‘xgettext’</SAMP> needs another file called "locating rule" to associate
+an ITS rule with an XML file. If the above ITS file is saved as
+<TT>‘messages.its’</TT>, the locating rule would look like:
+
+</P>
+
+<PRE>
+<?xml version="1.0"?>
+<locatingRules>
+ <locatingRule name="Messages" pattern="*.xml">
+ <documentRule localName="messages" target="messages.its"/>
+ </locatingRule>
+ <locatingRule name="Messages" pattern="*.msg" target="messages.its"/>
+</locatingRules>
+</PRE>
+
+<P>
+The <CODE>locatingRule</CODE> element must have a <CODE>pattern</CODE> attribute,
+which denotes either a literal file name or a wildcard pattern of the
+XML file. The <CODE>locatingRule</CODE> element can have child
+<CODE>documentRule</CODE> element, which adds checks on the content of the XML
+file.
+
+</P>
+<P>
+The first rule matches any file with the <TT>‘.xml’</TT> file extension, but
+it only applies to XML files whose root element is <SAMP>‘<messages>’</SAMP>.
+
+</P>
+<P>
+The second rule indicates that the same ITS rule file are also
+applicable to any file with the <TT>‘.msg’</TT> file extension. The
+optional <CODE>name</CODE> attribute of <CODE>locatingRule</CODE> allows to choose
+rules by name, typically with <CODE>xgettext</CODE>'s <CODE>-L</CODE> option.
+
+</P>
+<P>
+The associated ITS rule file is indicated by the <CODE>target</CODE> attribute
+of <CODE>locatingRule</CODE> or <CODE>documentRule</CODE>. If it is specified in a
+<CODE>documentRule</CODE> element, the parent <CODE>locatingRule</CODE> shouldn't
+have the <CODE>target</CODE> attribute.
+
+</P>
+<P>
+Locating rule files must have the <TT>‘.loc’</TT> file extension. Both ITS
+rule files and locating rule files must be installed in the
+<TT>‘$prefix/share/gettext/its’</TT> directory. Once those files are
+properly installed, <CODE>xgettext</CODE> can extract translatable strings
+from the matching XML files.
+
+</P>
+
+
+<H4><A NAME="SEC327" HREF="gettext_toc.html#TOC327">15.6.6.1 Two Use-cases of Translated Strings in XML</A></H4>
+
+<P>
+For XML, there are two use-cases of translated strings. One is the case
+where the translated strings are directly consumed by programs, and the
+other is the case where the translated strings are merged back to the
+original XML document. In the former case, special characters in the
+extracted strings shouldn't be escaped, while they should in the latter
+case. To control wheter to escape special characters, the <SAMP>‘Escape
+Special Characters’</SAMP> data category can be used.
+
+</P>
+<P>
+To merge the translations, the <SAMP>‘msgfmt’</SAMP> program can be used with
+the option <CODE>--xml</CODE>. See section <A HREF="gettext_10.html#SEC157">10.1 Invoking the <CODE>msgfmt</CODE> Program</A>, for more details
+about how one calls the <SAMP>‘msgfmt’</SAMP> program. <SAMP>‘msgfmt’</SAMP>'s
+<CODE>--xml</CODE> option doesn't perform character escaping, so translated
+strings can have arbitrary XML constructs, such as elements for markup.
+
+</P>
+
<P><HR><P>
Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_14.html">previous</A>, <A HREF="gettext_16.html">next</A>, <A HREF="gettext_25.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>.
</BODY>