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