vdr  1.7.31
include/vdr/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 
20 void I18nInitialize(const char *LocaleDir = NULL);
24 void I18nRegister(const char *Plugin);
26 void I18nSetLocale(const char *Locale);
30 int I18nCurrentLanguage(void);
36 void I18nSetLanguage(int Language);
42 const cStringList *I18nLanguages(void);
49 const char *I18nTranslate(const char *s, const char *Plugin = NULL) __attribute_format_arg__(1);
53 const char *I18nLocale(int Language);
57 const char *I18nLanguageCode(int Language);
63 int I18nLanguageIndex(const char *Code);
66 const char *I18nNormalizeLanguageCode(const char *Code);
70 bool 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