vdr 2.6.3
i18n.h
Go to the documentation of this file.
1/*
2 * i18n.h: Internationalization
3 *
4 * See the main source file 'vdr.c' for copyright information and
5 * how to reach the author.
6 *
7 * $Id: i18n.h 2.1 2012/03/11 14:07:45 kls Exp $
8 */
9
10#ifndef __I18N_H
11#define __I18N_H
12
13#include <stdio.h>
14#include "tools.h"
15
16#define I18N_DEFAULT_LOCALE "en_US"
17#define I18N_MAX_LOCALE_LEN 16 // for buffers that hold en_US etc.
18#define I18N_MAX_LANGUAGES 256 // for buffers that hold all available languages
19
20void I18nInitialize(const char *LocaleDir = NULL);
24void I18nRegister(const char *Plugin);
26void I18nSetLocale(const char *Locale);
30int I18nCurrentLanguage(void);
36void I18nSetLanguage(int Language);
42const cStringList *I18nLanguages(void);
49const char *I18nTranslate(const char *s, const char *Plugin = NULL) __attribute_format_arg__(1);
53const char *I18nLocale(int Language);
57const char *I18nLanguageCode(int Language);
63int I18nLanguageIndex(const char *Code);
66const char *I18nNormalizeLanguageCode(const char *Code);
70bool I18nIsPreferredLanguage(int *PreferredLanguages, const char *LanguageCode, int &OldPreference, int *Position = NULL);
80
81#ifdef PLUGIN_NAME_I18N
82#define tr(s) I18nTranslate(s, "vdr-" PLUGIN_NAME_I18N)
83#define trVDR(s) I18nTranslate(s) // to use a text that's in the VDR core's translation file
84#else
85#define tr(s) I18nTranslate(s)
86#endif
87
88#define trNOOP(s) (s)
89
90#endif //__I18N_H
const char * LanguageCode
Definition: i18n.c:30
const char * I18nLocale(int Language)
Returns the locale code of the given Language (which is an index as returned by I18nCurrentLanguage()...
Definition: i18n.c:266
const cStringList * I18nLanguages(void)
Returns the list of available languages.
Definition: i18n.c:249
int I18nLanguageIndex(const char *Code)
Returns the index of the language with the given three letter language Code.
Definition: i18n.c:276
void I18nInitialize(const char *LocaleDir=NULL)
Detects all available locales and loads the language names and codes.
Definition: i18n.c:142
int I18nNumLanguagesWithLocale(void)
Returns the number of entries in the list returned by I18nLanguages() that actually have a locale.
Definition: i18n.c:244
int I18nCurrentLanguage(void)
Returns the index of the current language.
Definition: i18n.c:231
bool I18nIsPreferredLanguage(int *PreferredLanguages, const char *LanguageCode, int &OldPreference, int *Position=NULL)
Checks the given LanguageCode (which may be something like "eng" or "eng+deu") against the PreferredL...
Definition: i18n.c:317
const char * I18nTranslate(const char *s, const char *Plugin=NULL) __attribute_format_arg__(1)
Translates the given string (with optional Plugin context) into the current language.
Definition: i18n.c:254
const char * I18nNormalizeLanguageCode(const char *Code)
Returns a 3 letter language code that may not be zero terminated.
Definition: i18n.c:286
void I18nSetLocale(const char *Locale)
Sets the current locale to Locale.
Definition: i18n.c:217
void I18nRegister(const char *Plugin)
Registers the named plugin, so that it can use internationalized texts.
Definition: i18n.c:211
void I18nSetLanguage(int Language)
Sets the current language index to Language.
Definition: i18n.c:236
const char * I18nLanguageCode(int Language)
Returns the three letter language code of the given Language (which is an index as returned by I18nCu...
Definition: i18n.c:271