1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Added the new i18n macro trVDR()

This commit is contained in:
Klaus Schmidinger 2007-08-24 14:03:47 +02:00
parent 98bdd0cfea
commit a241ad38b8
5 changed files with 29 additions and 26 deletions

View File

@ -2159,3 +2159,7 @@ Tobias Bratfisch <tobias@reel-multimedia.com>
Bruno Roussel <bruno.roussel@free.fr>
for translating OSD texts to the French language
Matthias Becker <becker.matthias@gmail.com>
for suggesting to add a new i18n macro that can be used by plugins to mark
texts they want to reuse from VDR's core translations

View File

@ -5396,3 +5396,6 @@ Video Disk Recorder Revision History
- Changed the default for LOCDIR in Makefile and Make.config.template to
"./locale", so that internationalization works by default when running VDR
from within its source directory (suggested by Anssi Hannula).
- Added the new i18n macro trVDR(), which can be used by plugins to mark
texts they want to reuse from VDR's core translations (suggested by Matthias
Becker).

View File

@ -6,7 +6,7 @@
<center><h1>The VDR Plugin System</h1></center>
<center><b>Version 1.5.3</b></center>
<center><b>Version 1.5.8</b></center>
<p>
<center>
Copyright &copy; 2006 Klaus Schmidinger<br>
@ -14,18 +14,18 @@ Copyright &copy; 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=#0000AA>&nbsp;</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=#00AA00>&nbsp;</td><td width=100%>
<!--X1.5.1--><table width=100%><tr><td bgcolor=#0000AA>&nbsp;</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=#AA0000>&nbsp;</td><td width=100%>
<!--X1.5.3--><table width=100%><tr><td bgcolor=#00AA00>&nbsp;</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>&nbsp;</td><td width=100%>
<!--X1.5.7--><table width=100%><tr><td bgcolor=#AA0000>&nbsp;</td><td width=100%>
Important modifications introduced in version 1.5.7 are marked like this.
<!--X1.5.7--></td></tr></table>
<!--X1.5.8--><table width=100%><tr><td bgcolor=#FF0000>&nbsp;</td><td width=100%>
Important modifications introduced in version 1.5.8 are marked like this.
<!--X1.5.8--></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.
@ -64,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=#00AA00>&nbsp;</td><td width=100%>
<!--X1.5.1--><table width=100%><tr><td bgcolor=#0000AA>&nbsp;</td><td width=100%>
<li><a href="#Wakeup">Wakeup</a>
<!--X1.5.1--></td></tr></table>
<li><a href="#Setup parameters">Setup parameters</a>
@ -88,9 +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=#0000AA>&nbsp;</td><td width=100%>
<li><a href="#Conditional Access">Conditional Access</a>
<!--X1.5.0--></td></tr></table>
</ul>
</ul>
@ -687,7 +685,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=#00AA00>&nbsp;</td><td width=100%>
<!--X1.5.1--><table width=100%><tr><td bgcolor=#0000AA>&nbsp;</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>
@ -912,7 +910,7 @@ const char *MyConfigDir = cPlugin::ConfigDirectory();
<center><i><b>Welcome to Babylon!</b></i></center><p>
<!--X1.5.7--><table width=100%><tr><td bgcolor=#FF0000>&nbsp;</td><td width=100%>
<!--X1.5.7--><table width=100%><tr><td bgcolor=#AA0000>&nbsp;</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
@ -923,9 +921,12 @@ const char *s = tr("Hello world!");
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.
<!--X1.5.8--><table width=100%><tr><td bgcolor=#FF0000>&nbsp;</td><td width=100%>
Texts are searched for in the domain registered for this plugin.
If a plugin wants to make use of texts defined by the core VDR code, it can use
the special <tt>trVDR()</tt> macro to mark these texts without having them
appear in its own translation file.
<!--X1.5.8--></td></tr></table>
<p>
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
@ -943,7 +944,7 @@ for (int i = 0; i &lt; 3; i++)
</pre></td></tr></table><p>
<p>
<!--X1.5.3--><table width=100%><tr><td bgcolor=#AA0000>&nbsp;</td><td width=100%>
<!--X1.5.3--><table width=100%><tr><td bgcolor=#00AA00>&nbsp;</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).
@ -1605,7 +1606,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=#AA0000>&nbsp;</td><td width=100%>
<!--X1.5.3--><table width=100%><tr><td bgcolor=#00AA00>&nbsp;</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
@ -2088,7 +2089,6 @@ 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=#0000AA>&nbsp;</td><td width=100%>
<a name="Conditional Access"><hr><h2>Conditional Access</h2>
<center><i><b>Members only!</b></i></center><p>
@ -2123,7 +2123,6 @@ virtual bool Assign(cDevice *Device, bool Query = false);
</pre></td></tr></table><p>
See the description of this function in <tt>ci.h</tt> for details.
<!--X1.5.0--></td></tr></table>
</body>
</html>

8
i18n.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: i18n.c 1.316 2007/08/24 13:15:48 kls Exp $
* $Id: i18n.c 1.317 2007/08/24 14:03:47 kls Exp $
*
*
*/
@ -206,11 +206,7 @@ const char *I18nTranslate(const char *s, const char *Plugin)
if (!s)
return s;
if (CurrentLanguage) {
const char *t = s;
if (Plugin)
t = dgettext(Plugin, s);
if (t == s)
t = gettext(s);
const char *t = Plugin ? dgettext(Plugin, s) : gettext(s);
if (t != s)
return t;
}

3
i18n.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: i18n.h 1.23 2007/08/19 14:07:17 kls Exp $
* $Id: i18n.h 1.24 2007/08/24 13:35:18 kls Exp $
*/
#ifndef __I18N_H
@ -80,6 +80,7 @@ bool I18nIsPreferredLanguage(int *PreferredLanguages, const char *LanguageCode,
#ifdef PLUGIN_NAME_I18N
#define tr(s) I18nTranslate(s, "vdr-" PLUGIN_NAME_I18N)
#define trVDR(s) I18nTranslate(s) // to use a text that's in the VDR core's translation file
#else
#define tr(s) I18nTranslate(s)
#endif