From a241ad38b82baea3a8cb73ac1714f8f481fddc01 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 24 Aug 2007 14:03:47 +0200 Subject: Added the new i18n macro trVDR() --- CONTRIBUTORS | 4 ++++ HISTORY | 3 +++ PLUGINS.html | 37 ++++++++++++++++++------------------- i18n.c | 8 ++------ i18n.h | 3 ++- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 8cfa2cf9..c064eeec 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2159,3 +2159,7 @@ Tobias Bratfisch Bruno Roussel for translating OSD texts to the French language + +Matthias Becker + 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 diff --git a/HISTORY b/HISTORY index 98abf08e..6fbced45 100644 --- a/HISTORY +++ b/HISTORY @@ -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). diff --git a/PLUGINS.html b/PLUGINS.html index d18bc424..0b0b4956 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -6,7 +6,7 @@

The VDR Plugin System

-
Version 1.5.3
+
Version 1.5.8

Copyright © 2006 Klaus Schmidinger
@@ -14,18 +14,18 @@ Copyright © 2006 Klaus Schmidinger
www.cadsoft.de/vdr

-
  -Important modifications introduced in version 1.5.0 are marked like this. -
-
  +
  Important modifications introduced in version 1.5.1 are marked like this.
-
  +
  Important modifications introduced in version 1.5.3 are marked like this.
-
  +
  Important modifications introduced in version 1.5.7 are marked like this.
+
  +Important modifications introduced in version 1.5.8 are marked like this. +

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

  • Housekeeping
  • Main thread hook
  • Activity -
      +
     
  • Wakeup
  • Setup parameters @@ -88,9 +88,7 @@ structures and allows it to hook itself into specific areas to perform special a
  • Devices
  • Audio
  • Remote Control -
     
  • Conditional Access -
  • @@ -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. -
      +
     

    Wakeup

    Wake me up before you go-go

    @@ -912,7 +910,7 @@ const char *MyConfigDir = cPlugin::ConfigDirectory();

    Welcome to Babylon!

    -
      +
      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. +
      +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 trVDR() macro to mark these texts without having them +appear in its own translation file. +

    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 < 3; i++)

    -
      +
      The system VDR is running on may use a character encoding where a single character (or symbol) 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).

    -
      +
      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 anti-aliasing, 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. -
     

    Conditional Access

    Members only!

    @@ -2123,7 +2123,6 @@ virtual bool Assign(cDevice *Device, bool Query = false);

    See the description of this function in ci.h for details. -

    diff --git a/i18n.c b/i18n.c index cf0798fd..da699d97 100644 --- a/i18n.c +++ b/i18n.c @@ -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; } diff --git a/i18n.h b/i18n.h index 2d1c79bd..cbe42b99 100644 --- a/i18n.h +++ b/i18n.h @@ -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 -- cgit v1.2.3