mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Switched I18N to gettext
This commit is contained in:
102
PLUGINS.html
102
PLUGINS.html
@@ -14,15 +14,18 @@ Copyright © 2006 Klaus Schmidinger<br>
|
||||
<a href="http://www.cadsoft.de/vdr">www.cadsoft.de/vdr</a>
|
||||
</center>
|
||||
<p>
|
||||
<!--X1.5.0--><table width=100%><tr><td bgcolor=#00AA00> </td><td width=100%>
|
||||
<!--X1.5.0--><table width=100%><tr><td bgcolor=#0000AA> </td><td width=100%>
|
||||
Important modifications introduced in version 1.5.0 are marked like this.
|
||||
<!--X1.5.0--></td></tr></table>
|
||||
<!--X1.5.1--><table width=100%><tr><td bgcolor=#AA0000> </td><td width=100%>
|
||||
<!--X1.5.1--><table width=100%><tr><td bgcolor=#00AA00> </td><td width=100%>
|
||||
Important modifications introduced in version 1.5.1 are marked like this.
|
||||
<!--X1.5.1--></td></tr></table>
|
||||
<!--X1.5.3--><table width=100%><tr><td bgcolor=#FF0000> </td><td width=100%>
|
||||
<!--X1.5.3--><table width=100%><tr><td bgcolor=#AA0000> </td><td width=100%>
|
||||
Important modifications introduced in version 1.5.3 are marked like this.
|
||||
<!--X1.5.3--></td></tr></table>
|
||||
<!--X1.5.7--><table width=100%><tr><td bgcolor=#FF0000> </td><td width=100%>
|
||||
Important modifications introduced in version 1.5.7 are marked like this.
|
||||
<!--X1.5.7--></td></tr></table>
|
||||
<p>
|
||||
VDR provides an easy to use plugin interface that allows additional functionality
|
||||
to be added to the program by implementing a dynamically loadable library file.
|
||||
@@ -61,7 +64,7 @@ structures and allows it to hook itself into specific areas to perform special a
|
||||
<li><a href="#Housekeeping">Housekeeping</a>
|
||||
<li><a href="#Main thread hook">Main thread hook</a>
|
||||
<li><a href="#Activity">Activity</a>
|
||||
<!--X1.5.1--><table width=100%><tr><td bgcolor=#AA0000> </td><td width=100%>
|
||||
<!--X1.5.1--><table width=100%><tr><td bgcolor=#00AA00> </td><td width=100%>
|
||||
<li><a href="#Wakeup">Wakeup</a>
|
||||
<!--X1.5.1--></td></tr></table>
|
||||
<li><a href="#Setup parameters">Setup parameters</a>
|
||||
@@ -85,7 +88,7 @@ structures and allows it to hook itself into specific areas to perform special a
|
||||
<li><a href="#Devices">Devices</a>
|
||||
<li><a href="#Audio">Audio</a>
|
||||
<li><a href="#Remote Control">Remote Control</a>
|
||||
<!--X1.5.0--><table width=100%><tr><td bgcolor=#00AA00> </td><td width=100%>
|
||||
<!--X1.5.0--><table width=100%><tr><td bgcolor=#0000AA> </td><td width=100%>
|
||||
<li><a href="#Conditional Access">Conditional Access</a>
|
||||
<!--X1.5.0--></td></tr></table>
|
||||
</ul>
|
||||
@@ -684,7 +687,7 @@ be queried, and further prompts may show up. If all prompts have been confirmed,
|
||||
the shutdown will take place. As soon as one prompt is not confirmed, no
|
||||
further plugins will be queried and no shutdown will be done.
|
||||
|
||||
<!--X1.5.1--><table width=100%><tr><td bgcolor=#AA0000> </td><td width=100%>
|
||||
<!--X1.5.1--><table width=100%><tr><td bgcolor=#00AA00> </td><td width=100%>
|
||||
<a name="Wakeup"><hr><h2>Wakeup</h2>
|
||||
|
||||
<center><i><b>Wake me up before you go-go</b></i></center><p>
|
||||
@@ -909,72 +912,38 @@ const char *MyConfigDir = cPlugin::ConfigDirectory();
|
||||
|
||||
<center><i><b>Welcome to Babylon!</b></i></center><p>
|
||||
|
||||
If a plugin displays texts to the user, it should implement internationalized
|
||||
versions of these texts and call the function
|
||||
|
||||
<p><table><tr><td bgcolor=#F0F0F0><pre>
|
||||
void RegisterI18n(const tI18nPhrase * const Phrases);
|
||||
</pre></td></tr></table><p>
|
||||
|
||||
to register them with VDR's internationalization mechanism.
|
||||
<p>
|
||||
The call to this function must be done in the <a href="#Getting started"><tt>Initialize()</tt></a>
|
||||
or <a href="#Getting started"><tt>Start()</tt></a> function of the plugin:
|
||||
|
||||
<p><table><tr><td bgcolor=#F0F0F0><pre>
|
||||
const tI18nPhrase Phrases[] = {
|
||||
{ "Hello world!",
|
||||
"Hallo Welt!",
|
||||
"",// TODO
|
||||
"",// TODO
|
||||
"",// TODO
|
||||
"",// TODO
|
||||
"",// TODO
|
||||
"",// TODO
|
||||
"",// TODO
|
||||
"",// TODO
|
||||
"",// TODO
|
||||
"",// TODO
|
||||
"",// TODO
|
||||
"",// TODO
|
||||
"",// TODO
|
||||
"",// TODO
|
||||
},
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
void cPluginHello::Start(void)
|
||||
{
|
||||
RegisterI18n(Phrases);
|
||||
}
|
||||
</pre></td></tr></table><p>
|
||||
|
||||
Each entry of type <tt>tI18nPhrase</tt> must have exactly as many members as defined
|
||||
by the constant <tt>I18nNumLanguages</tt> in the file <tt>VDR/i18n.h</tt>, and the
|
||||
sequence of the various languages must be the same as defined in <tt>VDR/i18n.c</tt>.<br>
|
||||
<b>It is very important that the array is terminated with a <tt>{ NULL }</tt>
|
||||
entry!</b>.
|
||||
<p>
|
||||
Usually you won't be able to fill in all the different translations by yourself, so
|
||||
you may want to contact the maintainers of these languages (listed in the file
|
||||
<tt>VDR/i18n.c</tt>) and ask them to provide the additional translations.
|
||||
<p>
|
||||
The actual runtime selection of the texts corresponding to the selected language
|
||||
is done by wrapping each internationalized text with the <tt>tr()</tt> macro:
|
||||
<!--X1.5.7--><table width=100%><tr><td bgcolor=#FF0000> </td><td width=100%>
|
||||
If a plugin displays texts to the user, it should prepare for internationalization
|
||||
of these texts. All that is necessary for this is to mark every text that is
|
||||
presented to the user as translatable, as in
|
||||
|
||||
<p><table><tr><td bgcolor=#F0F0F0><pre>
|
||||
const char *s = tr("Hello world!");
|
||||
</pre></td></tr></table><p>
|
||||
|
||||
The text given here must be the first one defined in the related <i>Phrases</i>
|
||||
entry (which is the English version), and the returned pointer is either a translated
|
||||
version (if available) or the original string. In the latter case a message will be
|
||||
written to the log file, indicating that a translation is missing.
|
||||
Texts are first searched for in the <i>Phrases</i> registered for this plugin (if any)
|
||||
The text given here must be the English version, and the returned pointer is either
|
||||
a translated version (if available) or the original string.
|
||||
Texts are first searched for in the domain registered for this plugin (if any)
|
||||
and then in the global VDR texts. So a plugin can make use of texts defined by the
|
||||
core VDR code.
|
||||
<p>
|
||||
<!--X1.5.3--><table width=100%><tr><td bgcolor=#FF0000> </td><td width=100%>
|
||||
Sometimes texts are stored in an array, in which case they need to be marked
|
||||
differently, using the trNOOP() macro. The actual translation is then done
|
||||
when such a text is used, as in
|
||||
|
||||
<p><table><tr><td bgcolor=#F0F0F0><pre>
|
||||
const char *Texts = {
|
||||
trNOOP("First text"),
|
||||
trNOOP("Second text"),
|
||||
trNOOP("Third one")
|
||||
};
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
MyFunc(tr(Texts[i]));
|
||||
</pre></td></tr></table><p>
|
||||
|
||||
<p>
|
||||
<!--X1.5.3--><table width=100%><tr><td bgcolor=#AA0000> </td><td width=100%>
|
||||
The system VDR is running on may use a character encoding where a single character
|
||||
(or <i>symbol</i>) consists of more than one byte (UTF-8, as opposed to, for instance,
|
||||
ISO8859-1, where every character is represented by a single byte in memory).
|
||||
@@ -986,6 +955,7 @@ and are defined in <tt>VDR/tools.h</tt>.
|
||||
Most of the time a plugin doesn't need to care about this, but when it comes to
|
||||
handling individual characters these functions may come in handy.
|
||||
<!--X1.5.3--></td></tr></table>
|
||||
<!--X1.5.7--></td></tr></table>
|
||||
|
||||
<a name="Custom services"><hr><h2>Custom services</h2>
|
||||
|
||||
@@ -1635,7 +1605,7 @@ with the full required resolution. Only if this fails shall it use alternate
|
||||
areas. Drawing areas are always rectangular and may not overlap (but do not need
|
||||
to be adjacent).
|
||||
<p>
|
||||
<!--X1.5.3--><table width=100%><tr><td bgcolor=#FF0000> </td><td width=100%>
|
||||
<!--X1.5.3--><table width=100%><tr><td bgcolor=#AA0000> </td><td width=100%>
|
||||
Special consideration may have to be given to color usage if the OSD provides
|
||||
8bpp (256 colors). In that case, fonts may be drawn using <i>anti-aliasing</i>,
|
||||
which requires several blended color values between the foreground and background
|
||||
@@ -2118,7 +2088,7 @@ Put(uint64 Code, bool Repeat = false, bool Release = false);
|
||||
|
||||
The other parameters have the same meaning as in the first version of this function.
|
||||
|
||||
<!--X1.5.0--><table width=100%><tr><td bgcolor=#00AA00> </td><td width=100%>
|
||||
<!--X1.5.0--><table width=100%><tr><td bgcolor=#0000AA> </td><td width=100%>
|
||||
<a name="Conditional Access"><hr><h2>Conditional Access</h2>
|
||||
|
||||
<center><i><b>Members only!</b></i></center><p>
|
||||
|
Reference in New Issue
Block a user