/usr/share/gtk-doc/html/libtranslate/libtranslate-translate.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 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 213 214 215 216 217 218 219 220 221 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>translate</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="api-reference.html" title="API Reference"><link rel="prev" href="api-reference.html" title="API Reference"><link rel="next" href="libtranslate-translate-common.html" title="translate-common"><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="api-reference.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="api-reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></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="libtranslate-translate-common.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="libtranslate-translate"></a><div class="titlepage"></div><div class="refnamediv"><h2><span class="refentrytitle">translate</span></h2><p>translate — library initialization and core functions</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
#define <a href="libtranslate-translate.html#TRANSLATE-MAJOR-VERSION-CAPS">TRANSLATE_MAJOR_VERSION</a>
#define <a href="libtranslate-translate.html#TRANSLATE-MINOR-VERSION-CAPS">TRANSLATE_MINOR_VERSION</a>
#define <a href="libtranslate-translate.html#TRANSLATE-MICRO-VERSION-CAPS">TRANSLATE_MICRO_VERSION</a>
extern const unsigned int <a href="libtranslate-translate.html#translate-major-version">translate_major_version</a>;
extern const unsigned int <a href="libtranslate-translate.html#translate-minor-version">translate_minor_version</a>;
extern const unsigned int <a href="libtranslate-translate.html#translate-micro-version">translate_micro_version</a>;
#define <a href="libtranslate-translate.html#TRANSLATE-ERROR-CAPS">TRANSLATE_ERROR</a>
#define <a href="libtranslate-translate.html#TRANSLATE-INIT-ERROR-CAPS">TRANSLATE_INIT_ERROR</a>
enum <a href="libtranslate-translate.html#TranslateError">TranslateError</a>;
enum <a href="libtranslate-translate.html#TranslateInitError">TranslateInitError</a>;
gboolean (<a href="libtranslate-translate.html#TranslateModuleInitFunc">*TranslateModuleInitFunc</a>) (GError **err);
extern gboolean <a href="libtranslate-translate.html#translate-initialized">translate_initialized</a>;
gboolean <a href="libtranslate-translate.html#translate-init">translate_init</a> (GError **err);
gboolean <a href="libtranslate-translate.html#translate-add-service">translate_add_service</a> (<a href="TranslateService.html" title="TranslateService">TranslateService</a> *service);
<a href="TranslateService.html" title="TranslateService">TranslateService</a>* <a href="libtranslate-translate.html#translate-get-service">translate_get_service</a> (const char *name);
GSList* <a href="libtranslate-translate.html#translate-get-services">translate_get_services</a> (void);
gboolean <a href="libtranslate-translate.html#translate-add-language">translate_add_language</a> (const char *tag,
const char *name);
const char* <a href="libtranslate-translate.html#translate-get-language-name">translate_get_language_name</a> (const char *tag);
void <a href="libtranslate-translate.html#translate-set-proxy">translate_set_proxy</a> (const char *uri);
char* <a href="libtranslate-translate.html#translate-get-proxy">translate_get_proxy</a> (void);
</pre></div><div class="refsect1" lang="en"><a name="id2598755"></a><h2>Description</h2><p>
The following functions, variables and macros are used to determine
the libtranslate version, initialize libtranslate, manipulate
services, languages and the network proxy.
</p></div><div class="refsect1" lang="en"><a name="id2598764"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2598770"></a><h3><a name="TRANSLATE-MAJOR-VERSION-CAPS"></a>TRANSLATE_MAJOR_VERSION</h3><a class="indexterm" name="id2598778"></a><pre class="programlisting">#define TRANSLATE_MAJOR_VERSION 0
</pre><p>
Like <a href="libtranslate-translate.html#translate-major-version"><span class="type">translate_major_version</span></a>, but from the headers used at
application compile time, rather than from the library linked against
at application runtime.
</p></div><hr><div class="refsect2" lang="en"><a name="id2598800"></a><h3><a name="TRANSLATE-MINOR-VERSION-CAPS"></a>TRANSLATE_MINOR_VERSION</h3><a class="indexterm" name="id2598808"></a><pre class="programlisting">#define TRANSLATE_MINOR_VERSION 99
</pre><p>
Like <a href="libtranslate-translate.html#translate-minor-version"><span class="type">translate_minor_version</span></a>, but from the headers used at
application compile time, rather than from the library linked against
at application runtime.
</p></div><hr><div class="refsect2" lang="en"><a name="id2598829"></a><h3><a name="TRANSLATE-MICRO-VERSION-CAPS"></a>TRANSLATE_MICRO_VERSION</h3><a class="indexterm" name="id2598838"></a><pre class="programlisting">#define TRANSLATE_MICRO_VERSION 0
</pre><p>
Like <a href="libtranslate-translate.html#translate-micro-version"><span class="type">translate_micro_version</span></a>, but from the headers used at
application compile time, rather than from the library linked against
at application runtime.
</p></div><hr><div class="refsect2" lang="en"><a name="id2598859"></a><h3><a name="translate-major-version"></a>translate_major_version</h3><a class="indexterm" name="id2598868"></a><pre class="programlisting">extern const unsigned int translate_major_version;
</pre><p>
The major version number of libtranslate.
This variable is in the library, so it represents the translate
library you have linked against. Contrast with the
<a href="libtranslate-translate.html#TRANSLATE-MAJOR-VERSION-CAPS"><span class="type">TRANSLATE_MAJOR_VERSION</span></a> macro, which represents the major version of
the libtranslate headers you have included.
</p></div><hr><div class="refsect2" lang="en"><a name="id2598889"></a><h3><a name="translate-minor-version"></a>translate_minor_version</h3><a class="indexterm" name="id2598898"></a><pre class="programlisting">extern const unsigned int translate_minor_version;
</pre><p>
The minor version number of libtranslate.
This variable is in the library, so it represents the translate
library you have linked against. Contrast with the
<a href="libtranslate-translate.html#TRANSLATE-MINOR-VERSION-CAPS"><span class="type">TRANSLATE_MINOR_VERSION</span></a> macro, which represents the minor version of
the libtranslate headers you have included.
</p></div><hr><div class="refsect2" lang="en"><a name="id2598919"></a><h3><a name="translate-micro-version"></a>translate_micro_version</h3><a class="indexterm" name="id2598928"></a><pre class="programlisting">extern const unsigned int translate_micro_version;
</pre><p>
The micro version number of libtranslate.
This variable is in the library, so it represents the translate
library you have linked against. Contrast with the
<a href="libtranslate-translate.html#TRANSLATE-MICRO-VERSION-CAPS"><span class="type">TRANSLATE_MICRO_VERSION</span></a> macro, which represents the micro version of
the libtranslate headers you have included.
</p></div><hr><div class="refsect2" lang="en"><a name="id2598949"></a><h3><a name="TRANSLATE-ERROR-CAPS"></a>TRANSLATE_ERROR</h3><a class="indexterm" name="id2598957"></a><pre class="programlisting">#define TRANSLATE_ERROR (translate_error_quark())
</pre><p>
Generic libtranslate error domain. Errors in this domain are from the
<a href="libtranslate-translate.html#TranslateError"><span class="type">TranslateError</span></a> enumeration.
</p></div><hr><div class="refsect2" lang="en"><a name="id2598979"></a><h3><a name="TRANSLATE-INIT-ERROR-CAPS"></a>TRANSLATE_INIT_ERROR</h3><a class="indexterm" name="id2598987"></a><pre class="programlisting">#define TRANSLATE_INIT_ERROR (translate_init_error_quark())
</pre><p>
The error domain of <a href="libtranslate-translate.html#translate-init"><tt class="function">translate_init()</tt></a>. Errors in this domain are from
the <a href="libtranslate-translate.html#TranslateInitError"><span class="type">TranslateInitError</span></a> enumeration.
</p></div><hr><div class="refsect2" lang="en"><a name="id2599018"></a><h3><a name="TranslateError"></a>enum TranslateError</h3><a class="indexterm" name="id2599027"></a><pre class="programlisting">typedef enum
{
TRANSLATE_ERROR_FAILED,
TRANSLATE_ERROR_CANCELLED
} TranslateError;
</pre><p>
Generic error codes returned by libtranslate routines when more
specialized error codes are not relevant.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><tt class="literal">TRANSLATE_ERROR_FAILED</tt></span></td><td>a generic error has occurred
</td></tr><tr><td><span class="term"><tt class="literal">TRANSLATE_ERROR_CANCELLED</tt></span></td><td>the user has cancelled the operation
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2599074"></a><h3><a name="TranslateInitError"></a>enum TranslateInitError</h3><a class="indexterm" name="id2599082"></a><pre class="programlisting">typedef enum
{
TRANSLATE_INIT_ERROR_MULTI_THREADING_NOT_SUPPORTED
} TranslateInitError;
</pre><p>
Error codes returned by <a href="libtranslate-translate.html#translate-init"><tt class="function">translate_init()</tt></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><tt class="literal">TRANSLATE_INIT_ERROR_MULTI_THREADING_NOT_SUPPORTED</tt></span></td><td>multi-threading is not supported
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2599193"></a><h3><a name="TranslateModuleInitFunc"></a>TranslateModuleInitFunc ()</h3><a class="indexterm" name="id2599202"></a><pre class="programlisting">gboolean (*TranslateModuleInitFunc) (GError **err);</pre><p>
Specifies the type of the module initialization function.
</p><p>
A libtranslate module must contain a function named
<tt class="function">translate_module_init()</tt>, which is called when the module is loaded.</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>err</tt></i> :</span></td><td> a location to report errors, or <tt class="literal">NULL</tt>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the function should return <tt class="literal">FALSE</tt> if the module could
not be initialized. In such case it should also set <i class="parameter"><tt>err</tt></i>, which is
printed by libtranslate.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2599290"></a><h3><a name="translate-initialized"></a>translate_initialized</h3><a class="indexterm" name="id2599299"></a><pre class="programlisting">extern gboolean translate_initialized;
</pre><p>
Whether libtranslate is initialized or not (read-only). You probably
do not need to use this variable, as <a href="libtranslate-translate.html#translate-init"><tt class="function">translate_init()</tt></a> can be called
multiple times.
</p></div><hr><div class="refsect2" lang="en"><a name="id2599322"></a><h3><a name="translate-init"></a>translate_init ()</h3><a class="indexterm" name="id2599331"></a><pre class="programlisting">gboolean translate_init (GError **err);</pre><p>
Initializes libtranslate. This function can safely be called
multiple times (however, it is <span class="emphasis"><em>not</em></span>
thread-safe, read below). When it is called more than once, it
returns the status (and error if any) of the initial invocation.
</p><p>
</p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>
Unlike other libtranslate functions, <a href="libtranslate-translate.html#translate-init"><tt class="function">translate_init()</tt></a> is
<span class="emphasis"><em>not</em></span> thread-safe, and must
<span class="emphasis"><em>not</em></span> be called while any mutex is held. The
reason is that <a href="libtranslate-translate.html#translate-init"><tt class="function">translate_init()</tt></a> may call <tt class="function">g_thread_init()</tt>. Refer to
the <tt class="function">g_thread_init()</tt> documentation for more details.
</p></div><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>err</tt></i> :</span></td><td> a location to report errors, or <tt class="literal">NULL</tt>. Any of the errors in
<a href="libtranslate-translate.html#TranslateInitError"><span class="type">TranslateInitError</span></a> or other domains may occur.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> <tt class="literal">TRUE</tt> if the initialization was successful, <tt class="literal">FALSE</tt>
otherwise (in such case <i class="parameter"><tt>err</tt></i> is set to the error that has
occurred).
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2599538"></a><h3><a name="translate-add-service"></a>translate_add_service ()</h3><a class="indexterm" name="id2599546"></a><pre class="programlisting">gboolean translate_add_service (<a href="TranslateService.html" title="TranslateService">TranslateService</a> *service);</pre><p>
Adds <i class="parameter"><tt>service</tt></i> to the libtranslate service list. If a service with
the same name is already in the list, nothing is done and <tt class="literal">FALSE</tt> is
returned.</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>service</tt></i> :</span></td><td> a service.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> <tt class="literal">TRUE</tt> if the service was added, <tt class="literal">FALSE</tt> if it was
already in the list.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2599623"></a><h3><a name="translate-get-service"></a>translate_get_service ()</h3><a class="indexterm" name="id2599632"></a><pre class="programlisting"><a href="TranslateService.html" title="TranslateService">TranslateService</a>* translate_get_service (const char *name);</pre><p>
Looks up a service in the libtranslate service list.</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>name</tt></i> :</span></td><td> a service name, encoded in ASCII.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> a new reference to the service with name <i class="parameter"><tt>name</tt></i>, or
<tt class="literal">NULL</tt> if not found.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2599700"></a><h3><a name="translate-get-services"></a>translate_get_services ()</h3><a class="indexterm" name="id2599708"></a><pre class="programlisting">GSList* translate_get_services (void);</pre><p>
Gets a copy of the libtranslate service list. When no longer
needed, the list should be freed with:
</p><p>
</p><pre class="programlisting">
g_slist_foreach(list, (GFunc) g_object_unref, NULL);
g_slist_free(list);
</pre><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> a copy of the libtranslate service list.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2599753"></a><h3><a name="translate-add-language"></a>translate_add_language ()</h3><a class="indexterm" name="id2599762"></a><pre class="programlisting">gboolean translate_add_language (const char *tag,
const char *name);</pre><p>
Adds a language tag to name mapping to the libtranslate language
database. If a language with the same tag already exists in the
database, nothing is done and <tt class="literal">FALSE</tt> is returned.
</p><p>
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
Some RFC 3066 tag to name mappings are <a href="rfc3066-builtin.html" title="Appendix A. Built-in RFC 3066 Tag to Name Mappings">built into libtranslate</a> and do not
need to be added.
</p></div><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>tag</tt></i> :</span></td><td> a RFC 3066 language tag.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>name</tt></i> :</span></td><td> the language human-readable name.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> <tt class="literal">TRUE</tt> if the language was added, <tt class="literal">FALSE</tt> if it was
already in the database.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2599934"></a><h3><a name="translate-get-language-name"></a>translate_get_language_name ()</h3><a class="indexterm" name="id2599943"></a><pre class="programlisting">const char* translate_get_language_name (const char *tag);</pre><p>
Looks up a language tag in the libtranslate language database, and
returns its human-readable name.</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>tag</tt></i> :</span></td><td> a RFC 3066 language tag.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the human-readable name of the language with tag
<i class="parameter"><tt>tag</tt></i>, or <i class="parameter"><tt>tag</tt></i> itself if not found. If the returned string is not
<i class="parameter"><tt>tag</tt></i>, it is owned by libtranslate and must not be modified or
freed.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2600017"></a><h3><a name="translate-set-proxy"></a>translate_set_proxy ()</h3><a class="indexterm" name="id2600025"></a><pre class="programlisting">void translate_set_proxy (const char *uri);</pre><p>
Sets the URI of a proxy server to use for network transfers.</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>uri</tt></i> :</span></td><td> the URI of a proxy server, or <tt class="literal">NULL</tt> to unset.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2600076"></a><h3><a name="translate-get-proxy"></a>translate_get_proxy ()</h3><a class="indexterm" name="id2600085"></a><pre class="programlisting">char* translate_get_proxy (void);</pre><p>
Gets the URI thas has been previously set with
<a href="libtranslate-translate.html#translate-set-proxy"><tt class="function">translate_set_proxy()</tt></a>.
</p><p>
If you are implementing a service, you <span class="emphasis"><em>must</em></span>
use this URI for proxying network transfers.</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the libtranslate proxy URI, or <tt class="literal">NULL</tt> if no proxy is
set. The returned string should be freed when no longer needed.
</td></tr></tbody></table></div></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="api-reference.html"><b><< API Reference</b></a></td><td align="right"><a accesskey="n" href="libtranslate-translate-common.html"><b>translate-common >></b></a></td></tr></table></body></html>
|