This file is indexed.

/usr/share/gtk-doc/html/libaccounts-glib/gettext-xml-files.html is in libaccounts-glib-doc 1.23+17.04.20161104-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Internationalizing XML data files using gettext: libaccounts-glib Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="libaccounts-glib Reference Manual">
<link rel="up" href="xml-file-formats.html" title="XML files">
<link rel="prev" href="service-type-file-format.html" title="Service type description file format">
<link rel="next" href="validating-xml-files.html" title="Validating XML files against the DTDs">
<meta name="generator" content="GTK-Doc V1.25 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="xml-file-formats.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="service-type-file-format.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="validating-xml-files.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="gettext-xml-files"></a>Internationalizing XML data files using gettext</h2></div></div></div>
<p>
Strings to be shown to the user which are found in the <acronym title="
      The eXtensible Markup Language defines a set of rules for marking up
      documents that are both machine- and human-readable.
      "><span class="acronym">XML</span></acronym>
data files supported by libaccounts-glib can be localized to the user's
language. For this purpose, a
<code class="sgmltag-element">translations</code> element is present
to identify the gettext translation domain, which can then be used by
applications which consume those strings in order to request gettext to
localize the text. Thus, the burden of localization is split between the author
of the data file and the application developer. The following sections will
give brief explanations of how to simplify both tasks.
</p>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="intltool-xml-files"></a>
  Using <span class="application">intltool</span> to extract translatable strings
  </h3></div></div></div>
<p>
  <span class="command"><strong>intltool</strong></span> is a helper tool to make internationalization
  easier for application developers. Using intltool, a developer can extract
  the translatable strings from XML data files with ease. There are several
  steps that must be taken to integrate intltool to extract translatable
  strings, as described below.
  </p>
<div class="procedure"><ol class="procedure" type="1">
<li class="step">
<p>
    Ensure that each XML data file has a
    <code class="sgmltag-element">translations</code> element, containing the
    gettext tranlslation domain for the application. This will generally be the
    name of the package, and is often set in <code class="filename">configure.ac</code>
    with:
    </p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="function">AC_SUBST</span><span class="gtkdoc opt">([</span>GETTEXT_PACKAGE<span class="gtkdoc opt">], [</span>$PACKAGE_TARNAME<span class="gtkdoc opt">])</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</li>
<li class="step"><p>
    Add a <code class="filename">.in</code> to the end of the name of
    the XML data file. For example, rename
    <code class="filename"><em class="replaceable"><code>my-application</code></em>.application</code>
    to
    <code class="filename"><em class="replaceable"><code>my-application</code></em>.application.in</code>.
    </p></li>
<li class="step"><p>
    Translatable elements in an XML file must be marked for translation by
    adding an underscore at the beginning of the element name. For example,
    <code class="literal">&lt;description&gt;</code> would change to
    <code class="literal">&lt;_description&gt;</code>. An underscore prefix must also be
    added to the corresponding closing element.
    </p></li>
<li class="step">
<p>
    The strings that are marked for translation must be extracted by intltool.
    This simply creates a corresponding XML data file, without the
    <code class="filename">.in</code> extension, and places the
    marked strings in the intltool cache. The following
    <span class="application">automake</span> snippet will extract the marked strings
    and distribute and install the resulting provider file:
    </p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc"># Extract transatable strings from .provider file</span>
my<span class="gtkdoc opt">-</span>provider<span class="gtkdoc opt">.</span>provider<span class="gtkdoc opt">:</span> my<span class="gtkdoc opt">-</span>provider<span class="gtkdoc opt">.</span>provider<span class="gtkdoc opt">.</span>in $<span class="gtkdoc opt">(</span>INTLTOOL_MERGE<span class="gtkdoc opt">)</span>
	$<span class="gtkdoc opt">(</span>INTLTOOL_V_MERGE<span class="gtkdoc opt">)</span> LC_ALL<span class="gtkdoc opt">=</span>C $<span class="gtkdoc opt">(</span>INTLTOOL_MERGE<span class="gtkdoc opt">)</span> $<span class="gtkdoc opt">(</span>INTLTOOL_MERGE_V_OPTIONS<span class="gtkdoc opt">) --</span>no<span class="gtkdoc opt">-</span>translations <span class="gtkdoc opt">-</span>x <span class="gtkdoc opt">-</span>u $<span class="gtkdoc opt">&lt;</span> $&#64;

provider_in_file <span class="gtkdoc opt">=</span> \
	my<span class="gtkdoc opt">-</span>provider<span class="gtkdoc opt">.</span>provider<span class="gtkdoc opt">.</span>in

providerdir <span class="gtkdoc opt">=</span> $<span class="gtkdoc opt">(</span>datadir<span class="gtkdoc opt">)/</span>accounts<span class="gtkdoc opt">/</span>providers
provider_DATA <span class="gtkdoc opt">=</span> \
	$<span class="gtkdoc opt">(</span>providers_in_file<span class="gtkdoc opt">:.</span>provider<span class="gtkdoc opt">.</span>in<span class="gtkdoc opt">=.</span>provider<span class="gtkdoc opt">)</span>

dist_noinst_DATA <span class="gtkdoc opt">=</span> \
	$<span class="gtkdoc opt">(</span>provider_in_file<span class="gtkdoc opt">)</span>

CLEANFILES <span class="gtkdoc opt">=</span> \
	$<span class="gtkdoc opt">(</span>provider_DATA<span class="gtkdoc opt">)</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</li>
<li class="step">
<p>
    Add the <code class="filename">.in</code> to
    <code class="filename">po/POTFILES.in</code>, being sure to list the file type
    alongside it. For example, with a service file
    <code class="filename"><em class="replaceable"><code>my-service</code></em>.service.in</code> in
    the <code class="filename">data</code> directory in the source
    tree, the <code class="filename">POTFILES.in</code> addition would be:
    </p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc opt">[</span>type<span class="gtkdoc opt">:</span> gettext<span class="gtkdoc opt">/</span>xml<span class="gtkdoc opt">]</span>data<span class="gtkdoc opt">/</span>my<span class="gtkdoc opt">-</span>service<span class="gtkdoc opt">.</span>service<span class="gtkdoc opt">.</span>in</pre></td>
      </tr>
    </tbody>
  </table>
</div>

</li>
</ol></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="gettext-xml-files-applications"></a>
  Using <span class="application">gettext</span> to localize translatable strings
  </h3></div></div></div>
<p>
  <span class="application">gettext</span> is used to show the localized versions of
  translatable strings that have been extracted and translated. As most use of
  gettext in a client application involves translatable strings only from that
  application, it is common practice to bind the translataion domain of the
  application as the default, which is normally done as follows:
  </p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="function">bindtextdomain</span> <span class="gtkdoc opt">(</span>GETTEXT_PACKAGE<span class="gtkdoc opt">,</span> PACKAGE_LOCALEDIR<span class="gtkdoc opt">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
  If the translation domain is bound in this way, then when requesting
  translation of text from another project, such as the XML data files used by
  libaccounts-glib, the domain must be specified explicitly. The
  <code class="function">dgettext</code> function can be used for this purpose. As an
  example, for a hypothetical service <code class="varname">foo_service</code> calling
  dgettext could be done as follows:
  </p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="function">dgettext</span> <span class="gtkdoc opt">(</span><span class="function"><a href="AgService.html#ag-service-get-i18n-domain">ag_service_get_i18n_domain</a></span> <span class="gtkdoc opt">(</span>foo_service<span class="gtkdoc opt">),</span>
          <span class="function"><a href="AgService.html#ag-service-get-description">ag_service_get_description</a></span> <span class="gtkdoc opt">(</span>foo_service<span class="gtkdoc opt">));</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
  This returns the translated string, which can then be shown to the user.
  </p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>