This file is indexed.

/usr/share/doc/appstream/html/sect-Quickstart-Translation.html is in appstream-doc 0.9.4-1.

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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title xmlns:d="http://docbook.org/ns/docbook">4.3. Translating Metadata</title><link rel="stylesheet" type="text/css" href="Common_Content/css/default.css" /><link rel="stylesheet" media="print" href="Common_Content/css/print.css" type="text/css" /><meta xmlns:d="http://docbook.org/ns/docbook" name="generator" content="publican v4.3.2" /><meta xmlns:d="http://docbook.org/ns/docbook" name="package" content="AppStream-AppStream-0.9-en-US-0.0-0" /><link rel="home" href="index.html" title="AppStream" /><link rel="up" href="chap-Quickstart.html" title="Chapter 4. Metadata Quickstart" /><link rel="prev" href="sect-Quickstart-Addons.html" title="4.2. For upstream projects providing addons" /><link rel="next" href="chap-AppStream-Services.html" title="Chapter 5. Services" /></head><body><p id="title"><a class="left" href="http://www.freedesktop.org/wiki/Distributions/AppStream/"><img alt="Product Site" src="Common_Content/images//image_left.png" /></a><a class="right" href="http://www.freedesktop.org/software/appstream/docs/"><img alt="Documentation Site" src="Common_Content/images//image_right.png" /></a></p><ul class="docnav top"><li class="previous"><a accesskey="p" href="sect-Quickstart-Addons.html"><strong>Prev</strong></a></li><li class="home">AppStream</li><li class="next"><a accesskey="n" href="chap-AppStream-Services.html"><strong>Next</strong></a></li></ul><div xml:lang="en-US" class="section" lang="en-US"><div class="titlepage"><div><div><h2 class="title"><a id="sect-Quickstart-Translation"></a>4.3. Translating Metadata</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="qsr-l10n-introduction"></a>4.3.1. Introduction</h3></div></div></div><div class="para">
			Most AppStream metadata can be translated, This page contains some practical instructions how to translate the metadata.
		</div><div xmlns:d="http://docbook.org/ns/docbook" class="note"><div class="admonition_header"><p><strong>For KDE developers</strong></p></div><div class="admonition"><div class="para">
				If you are a KDE developer and using the KDE infrastructure with it's localization support, you need to do nothing to get translated metadata. Just place your <code class="filename">*.appdata.xml*</code> or <code class="filename">*.metainfo.xml*</code> file at a sane place, and the l10n-script will translate the file in-place automatically.
			</div></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="qsr-l10n-intltool"></a>4.3.2. Translating using Intltool</h3></div></div></div><div class="para">
			If you ship an <code class="filename">.xml.in</code> file rather than an <code class="filename">.xml</code> file, you can use Intltool to translate the data.
		</div><div class="para">
			Each translatable element in the <code class="filename">.xml.in</code> file needs to be prefixed with an underscore (<code class="code">_</code>) to be marked as translatable. Apart from that, the same specifications apply to this file as for any other AppStream metadata.
		</div><div class="para">
			TODO: Fill in some generic examples how Intltool can be used.
		</div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="qsr-l10n-intltool-autotools"></a>4.3.2.1. Integrating with Autotools (the AppStream way)</h4></div></div></div><div class="para">
				The generic way to add translation to your AppStream metadata in case you use Autotools is by using the following code snippet:
			</div><pre class="programlisting"><span xmlns="" class="line"></span><span xmlns="" class="perl_DataType">appstreamdir </span><span xmlns="" class="perl_String">= </span><span xmlns="" class="perl_Char">$(</span><span xmlns="" class="perl_DataType">datadir</span><span xmlns="" class="perl_Char">)</span><span xmlns="" class="perl_String">/appdata/</span>
<span xmlns="" class="line"></span><span xmlns="" class="perl_DataType">appstream_in_files </span><span xmlns="" class="perl_String">= gedit.appdata.xml.in</span>
<span xmlns="" class="line"></span><span xmlns="" class="perl_DataType">appstream_DATA </span><span xmlns="" class="perl_String">= </span><span xmlns="" class="perl_Char">$(</span><span xmlns="" class="perl_DataType">appstream_in_files:.xml.in=.xml</span><span xmlns="" class="perl_Char">)</span>
<span xmlns="" class="line"></span><span xmlns="" class="perl_Char">@</span><span xmlns="" class="perl_BaseN">INTLTOOL_XML_RULE</span>@
<span xmlns="" class="line"></span><span xmlns="" class="perl_DataType">EXTRA_DIST </span><span xmlns="" class="perl_String">= </span><span xmlns="" class="perl_Char">$(</span><span xmlns="" class="perl_DataType">appdata_in_files</span><span xmlns="" class="perl_Char">)</span>
<span xmlns="" class="line"></span><span xmlns="" class="perl_DataType">CLEANFILES </span><span xmlns="" class="perl_String">= </span><span xmlns="" class="perl_Char">$(</span><span xmlns="" class="perl_DataType">appstream_DATA</span><span xmlns="" class="perl_Char">)</span></pre><div class="para">
				The code assumes you are using the Intltool Automake code.
			</div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="qsr-l10n-intltool-autotools-asglib"></a>4.3.2.2. Integrating with Autotools (the AppStream-GLib way)</h4></div></div></div><div class="para">
				In case you want to use the macro provided by the AppStream-GLib library, you can use this code snippet:
			</div><pre class="programlisting"><span xmlns="" class="line"></span><span xmlns="" class="perl_Char">@</span><span xmlns="" class="perl_BaseN">APPSTREAM_XML_RULES</span>@
<span xmlns="" class="line"></span><span xmlns="" class="perl_DataType">appstream_in_files </span><span xmlns="" class="perl_String">= gedit.appdata.xml.in</span>
<span xmlns="" class="line"></span><span xmlns="" class="perl_DataType">appstream_XML </span><span xmlns="" class="perl_String">= </span><span xmlns="" class="perl_Char">$(</span><span xmlns="" class="perl_DataType">appstream_in_files:.xml.in=.xml</span><span xmlns="" class="perl_Char">)</span>
<span xmlns="" class="line"></span><span xmlns="" class="perl_Char">@</span><span xmlns="" class="perl_BaseN">INTLTOOL_XML_RULE</span>@
<span xmlns="" class="line"></span><span xmlns="" class="perl_DataType">EXTRA_DIST </span><span xmlns="" class="perl_String">= </span><span xmlns="" class="perl_Char">$(</span><span xmlns="" class="perl_DataType">appdata_in_files</span><span xmlns="" class="perl_Char">)</span>
<span xmlns="" class="line"></span><span xmlns="" class="perl_DataType">CLEANFILES </span><span xmlns="" class="perl_String">= </span><span xmlns="" class="perl_Char">$(</span><span xmlns="" class="perl_DataType">appstream_XML</span><span xmlns="" class="perl_Char">)</span></pre><div class="para">
				Make sure you have the additional AppStream macro installed.
			</div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="qsr-l10n-itstool"></a>4.3.3. Translating using Itstool</h3></div></div></div><div class="para">
			You can also use Itstool for translation. In order to translate an XML file with it, you need an <code class="filename">.its</code> file with translation definitions. An appropriate file for AppStream upstream metadata of any kind can be found here:
		</div><pre class="programlisting"><span xmlns="" class="line"></span>
<span xmlns="" class="line"></span><span xmlns="" class="perl_Keyword">&lt;its:rules</span>
<span xmlns="" class="line"></span><span xmlns="" class="perl_Others">  xmlns:its=</span><span xmlns="" class="perl_String">"http://www.w3.org/2005/11/its"</span>
<span xmlns="" class="line"></span><span xmlns="" class="perl_Others">  version=</span><span xmlns="" class="perl_String">"1.0"</span><span xmlns="" class="perl_Keyword">&gt;</span>
<span xmlns="" class="line"></span>  <span xmlns="" class="perl_Keyword">&lt;its:translateRule</span><span xmlns="" class="perl_Others"> translate=</span><span xmlns="" class="perl_String">"no"</span><span xmlns="" class="perl_Others"> selector=</span><span xmlns="" class="perl_String">"/component"</span><span xmlns="" class="perl_Keyword">/&gt;</span>
<span xmlns="" class="line"></span>  <span xmlns="" class="perl_Keyword">&lt;its:translateRule</span><span xmlns="" class="perl_Others"> translate=</span><span xmlns="" class="perl_String">"yes"</span>
<span xmlns="" class="line"></span><span xmlns="" class="perl_Others">    selector=</span><span xmlns="" class="perl_String">"/component/name | /component/summary |</span>
<span xmlns="" class="line"></span><span xmlns="" class="perl_String">    /component/description | /component/screenshots/screenshot/caption | /component/developer_name"</span><span xmlns="" class="perl_Keyword">/&gt;</span>
<span xmlns="" class="line"></span><span xmlns="" class="perl_Keyword">&lt;/its:rules&gt;</span></pre><div class="para">
			Save this file as <code class="filename">as-metainfo.its</code> for example.
		</div><div class="para">
			To extract a GNU Gettext <code class="filename">.pot</code> file from your XML file, run itstool with the follwing arguments (replacing "foo" with your project name):
		</div><pre class="programlisting"><span xmlns="" class="line"></span>itstool -i <span xmlns="" class="perl_BString">as</span>-metainfo.its -o <span xmlns="" class="perl_Others">$podir</span>/foo_metadata.pot data/foo.appdata.xml</pre><div class="para">
			You can then translate the <code class="filename">.pot</code> file using the standard methods for translating files like these. You obtain <code class="filename">.po</code> files, which you can convert into <code class="filename">.mo</code> files (using msgfmt) like you would do with any other localization. Then, you need to call <code class="command">itstool</code> again, to create a translated version of the original XML file:
		</div><pre class="programlisting"><span xmlns="" class="line"></span>itstool -i <span xmlns="" class="perl_BString">as</span>-metainfo.its -j data/foo.appdata.xml -o output/foo.appdata.xml <span xmlns="" class="perl_Others">$modir</span>/*.mo</pre><div class="para">
			Please ensure that the <code class="filename">.mo</code> files in <code class="filename">$modir</code> are named with their language codes.
		</div><div xmlns:d="http://docbook.org/ns/docbook" class="note"><div class="admonition_header"><p><strong>Note</strong></p></div><div class="admonition"><div class="para">
				You can find more information about Itstool <a href="http://itstool.org/">on their homepage</a>.
			</div></div></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Quickstart-Addons.html"><strong>Prev</strong>4.2. For upstream projects providing addons</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-AppStream-Services.html"><strong>Next</strong>Chapter 5. Services</a></li></ul></body></html>