From 0f7a4af1683abfe892cb6d05536818a964d8cfe6 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 11 Aug 2007 12:39:06 +0200 Subject: Switched I18N to gettext --- PLUGINS.html | 94 +++++++++++++++++++++--------------------------------------- 1 file changed, 32 insertions(+), 62 deletions(-) (limited to 'PLUGINS.html') diff --git a/PLUGINS.html b/PLUGINS.html index dc725a51..d18bc424 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -14,15 +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. +

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

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

    Wakeup

    Wake me up before you go-go

    @@ -909,72 +912,38 @@ const char *MyConfigDir = cPlugin::ConfigDirectory();

    Welcome to Babylon!

    -If a plugin displays texts to the user, it should implement internationalized -versions of these texts and call the function +
      +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

    -void RegisterI18n(const tI18nPhrase * const Phrases);
    +const char *s = tr("Hello world!");
     

    -to register them with VDR's internationalization mechanism. +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.

    -The call to this function must be done in the Initialize() -or Start() function of the plugin: +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

    -const tI18nPhrase Phrases[] = {
    -  { "Hello world!",
    -    "Hallo Welt!",
    -    "",// TODO
    -    "",// TODO
    -    "",// TODO
    -    "",// TODO
    -    "",// TODO
    -    "",// TODO
    -    "",// TODO
    -    "",// TODO
    -    "",// TODO
    -    "",// TODO
    -    "",// TODO
    -    "",// TODO
    -    "",// TODO
    -    "",// TODO
    -  },
    -  { NULL }
    +const char *Texts = {
    +  trNOOP("First text"),
    +  trNOOP("Second text"),
    +  trNOOP("Third one")
       };
     
    -void cPluginHello::Start(void)
    -{
    -  RegisterI18n(Phrases);
    -}
    -

    - -Each entry of type tI18nPhrase must have exactly as many members as defined -by the constant I18nNumLanguages in the file VDR/i18n.h, and the -sequence of the various languages must be the same as defined in VDR/i18n.c.
    -It is very important that the array is terminated with a { NULL } -entry!. -

    -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 -VDR/i18n.c) and ask them to provide the additional translations. -

    -The actual runtime selection of the texts corresponding to the selected language -is done by wrapping each internationalized text with the tr() macro: - -

    -const char *s = tr("Hello world!");
    +for (int i = 0; i < 3; i++)
    +    MyFunc(tr(Texts[i]));
     

    -The text given here must be the first one defined in the related Phrases -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 Phrases 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.

    -
      +
      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). @@ -986,6 +955,7 @@ and are defined in VDR/tools.h. 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.
    +


    Custom services

    @@ -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).

    -
      +
      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 @@ -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. -
      +
     

    Conditional Access

    Members only!

    -- cgit v1.2.3