This file is indexed.

/usr/share/gtk-doc/html/libtranslate/tutorials.html is in libtranslate-dev 0.99-0ubuntu9.

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
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Tutorials</title><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"><link rel="start" href="index.html" title="libtranslate Reference Manual"><link rel="up" href="index.html" title="libtranslate Reference Manual"><link rel="prev" href="compiling-modules.html" title="Compiling libtranslate Modules"><link rel="next" href="ch02s02.html" title="Implementing Translation Services"><meta name="generator" content="GTK-Doc V1.2 (XML mode)"><style type="text/css">
        .synopsis, .classsynopsis {
            background: #eeeeee;
            border: solid 1px #aaaaaa;
            padding: 0.5em;
        }
        .programlisting {
            background: #eeeeff;
            border: solid 1px #aaaaff;
            padding: 0.5em;
        }
        .variablelist {
            padding: 4px;
            margin-left: 3em;
        }
        .navigation {
            background: #ffeeee;
            border: solid 1px #ffaaaa;
            margin-top: 0.5em;
            margin-bottom: 0.5em;
        }
        .navigation a {
            color: #770000;
        }
        .navigation a:visited {
            color: #550000;
        }
        .navigation .title {
            font-size: 200%;
        }
      </style></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="compiling-modules.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">libtranslate Reference Manual</th><td><a accesskey="n" href="ch02s02.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="tutorials"></a>Tutorials</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="tutorials.html#id2534105">Translating Text or Web Pages</a></span></dt><dt><span class="section"><a href="ch02s02.html">Implementing Translation Services</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2534105"></a>Translating Text or Web Pages</h2></div></div></div><p>
	To translate text or web pages, you need to initialize libtranslate
	with a call to <a href="libtranslate-translate.html#translate-init">translate_init()</a>, create a new
	session using <a href="TranslateSession.html#translate-session-new">translate_session_new()</a>,
	and call the appropriate translation function, <a href="TranslateSession.html#translate-session-translate-text">translate_session_translate_text()</a>
	or <a href="TranslateSession.html#translate-session-translate-web-page">translate_session_translate_web_page()</a>.
      </p><div class="example"><a name="id2534691"></a><p class="title"><b>Example 1. A Simple Command-Line Translator</b></p><p>
	  The following example demonstrates how to use libtranslate for
	  creating a simple command-line text and web page translator.
	</p><p>
	  The source code of this example is available in the libtranslate
	  source distribution
	  (<tt class="filename">docs/reference/example-application.c</tt>),
	  and is reproduced below.
	  On UNIX, compile it as follows:
	  </p><pre class="programlisting">$ cc `pkg-config --cflags --libs libtranslate` example-application.c -o example-application</pre><p>
	</p><pre class="programlisting">/*
 * Copyright (C) 2005 Jean-Yves Lefort
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of Jean-Yves Lefort nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#include &lt;locale.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;translate.h&gt;

int
main (int argc, char **argv)
{
  GError *err = NULL;
  GSList *services;
  TranslateSession *session;
  char *translation;

  setlocale(LC_ALL, "");	/* use user's locale */

  if (argc != 4)
    {
      g_printerr("Usage: translate FROM TO {TEXT | HTTP_URL | HTTPS_URL}\n");
      exit(1);
    }

  /* initialize libtranslate */
  if (! translate_init(&amp;err))
    {
      g_printerr("Unable to initialize libtranslate: %s\n", err-&gt;message);
      g_error_free(err);
      exit(1);
    }

  /* create a session which will use all the services */
  services = translate_get_services();
  session = translate_session_new(services);
  g_slist_foreach(services, (GFunc) g_object_unref, NULL);
  g_slist_free(services);

  /* translate text or web page, depending on the string given */
  translation = (g_str_has_prefix(argv[3], "http://")
		 || g_str_has_prefix(argv[3], "https://"))
    ? translate_session_translate_web_page(session, argv[3], argv[1], argv[2],
					   NULL, NULL, &amp;err)
    : translate_session_translate_text(session, argv[3], argv[1], argv[2],
				       NULL, NULL, &amp;err);

  /* handle failure */
  if (! translation)
    {
      g_printerr("Unable to translate: %s\n", err-&gt;message);
      g_error_free(err);
      exit(1);
    }

  /* success, print the translation, cleanup and exit */
  g_print("%s\n", translation);
  g_free(translation);
  g_object_unref(session);

  return 0;
}
</pre></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="compiling-modules.html"><b>&lt;&lt; Compiling libtranslate Modules</b></a></td><td align="right"><a accesskey="n" href="ch02s02.html"><b>Implementing Translation Services &gt;&gt;</b></a></td></tr></table></body></html>