82 {
"qaa",
trNOOP(
"LanguageName$original language (qaa)") },
83 {
"mis",
trNOOP(
"LanguageName$uncoded languages (mis)") },
84 {
"mul",
trNOOP(
"LanguageName$multiple languages (mul)") },
85 {
"nar",
trNOOP(
"LanguageName$narrative (nar)") },
86 {
"und",
trNOOP(
"LanguageName$undetermined (und)") },
87 {
"zxx",
trNOOP(
"LanguageName$no linguistic content (zxx)") },
105 for ( ; l < 3 &&
Code[l]; l++) {
106 if (Codes[l] != tolower(
Code[l]))
118 const char *p = strchr(s,
'$');
119 return p ? p + 1 : s;
124 setenv(
"LANGUAGE", Locale, 1);
125 extern int _nl_msg_cat_cntr;
134 const char *TranslatedName = gettext(slc->Name);
149 if (Locales.
Size() > 0) {
150 char *OldLocale = strdup(setlocale(LC_MESSAGES, NULL));
151 for (
int i = 0; i < Locales.
Size(); i++) {
153 if (access(FileName, F_OK) == 0) {
156 const char *TranslatedLanguageName = gettext(
LanguageName);
159 if (strstr(OldLocale, Locales[i]) == OldLocale)
174 esyslog(
"ERROR: too many locales - increase I18N_MAX_LANGUAGES!");
194 dsyslog(
"no locale for language code '%s'", *lc);
203 const char *TranslatedName = gettext(slc->Name);
217 if (Locale && *Locale) {
225 dsyslog(
"unknown locale: '%s'", Locale);
257 const char *t = Plugin ? dgettext(Plugin, s) : gettext(s);
286 for (
int i = 0; i < 3; i++) {
299 if (!isprint(
Code[i])) {
306 *((
char *)&
Code[i]) =
'_';
322 if (PreferredLanguages[i] < 0)
324 if (PreferredLanguages[i] == LanguageIndex) {
325 if (OldPreference < 0 || i < OldPreference) {
338 else if (pos == 1 && Position)
341 if (OldPreference < 0) {
int Find(const char *s) const
static cString sprintf(const char *fmt,...) __attribute__((format(printf
virtual void Append(T Data)
void I18nInitialize(const char *LocaleDir)
Detects all available locales and loads the language names and codes.
static void SetLanguageNames(void)
const char * I18nLanguageCode(int Language)
Returns the three letter language code of the given Language (which is an index as returned by I18nCu...
static const char * SkipContext(const char *s)
bool I18nIsPreferredLanguage(int *PreferredLanguages, const char *LanguageCode, int &OldPreference, int *Position)
Checks the given LanguageCode (which may be something like "eng" or "eng+deu") against the PreferredL...
static void SetEnvLanguage(const char *Locale)
static cStringList LanguageCodes
int I18nLanguageIndex(const char *Code)
Returns the index of the language with the given three letter language Code.
const cStringList * I18nLanguages(void)
Returns the list of available languages.
const char * LanguageCode
int I18nNumLanguagesWithLocale(void)
Returns the number of entries in the list returned by I18nLanguages() that actually have a locale.
static cStringList LanguageLocales
int I18nCurrentLanguage(void)
Returns the index of the current language.
const char * I18nLocale(int Language)
Returns the locale code of the given Language (which is an index as returned by I18nCurrentLanguage()...
const char * LanguageName
const char * I18nTranslate(const char *s, const char *Plugin)
Translates the given string (with optional Plugin context) into the current language.
const struct tSpecialLc SpecialLanguageCodeList[]
static cString I18nLocaleDir
static cStringList LanguageNames
static bool ContainsCode(const char *Codes, const char *Code)
void I18nSetLocale(const char *Locale)
Sets the current locale to Locale.
void I18nRegister(const char *Plugin)
Registers the named plugin, so that it can use internationalized texts.
const char * I18nNormalizeLanguageCode(const char *Code)
Returns a 3 letter language code that may not be zero terminated.
const char * LanguageCodeList[]
void I18nSetLanguage(int Language)
Sets the current language index to Language.
static int CurrentLanguage
#define I18N_MAX_LANGUAGES
#define I18N_DEFAULT_LOCALE