31 lines1.2 KBC
1#ifndef LANG_H
2#define LANG_H
3
4/*
5lang.h: the UI's words in the user's language.
6
7tr("English text") gives the current language's version of it, or the English
8when there's none. The translations are data/lang/<code>.txt, loaded by
9i18n.c (the PS3 build); a table, once in use, is never changed or freed, so
10worker threads can call tr() while the language is switched.
11*/
12const char *tr(const char *english);
13#define N_(s) s
14
15enum { LANG_EN, LANG_ES, LANG_PT, LANG_FR, LANG_DE, LANG_IT, LANG_NL, LANG_PL, LANG_TR, LANG_DA, LANG_ID, LANG_AR, LANG_RU, LANG_ZH, LANG_JA, LANG_KO, LANG_COUNT };
16
17const char *lang_code(int i); // "en", "es"...
18const char *lang_name(int i); // in its own language: "Español"...
19const char *lang_english(int i); // in English: "Spanish"...
20const char *lang_flag(int i); // its flag's file in data/flags: "es"...
21int lang_current(void);
22
23// a loaded table: pairs of English and its translation, hashed (i18n.c builds it)
24typedef struct {
25 int size; // slots, a power of two
26 const char **en, **tx; // NULL en: an empty slot
27} lang_table_t;
28void lang_install(int lang, const lang_table_t *t); // t NULL: English
29unsigned lang_hash(const char *s);
30
31#endif