Go to the documentation of this file.
42 const char *
i18n(
const object *
who,
const char *code) {
43 if (!
who || !
who->contr || !
who->contr->language)
61 if (strcmp(code, language->code) == 0)
88 return static_cast<i18n_file *
>(language)->code;
117 while ((
next = strstr(
line,
"\\n")) != NULL) {
148 if (strncmp(
file->d_name,
"messages.", 9) != 0)
166 if (
line[0] !=
'#' &&
line[0] !=
'\0') {
171 token = strtok(NULL,
"|");
178 language->
messages[scode] = smessage;
193 if (strcmp(language->
code,
"en") == 0)
201 LOG(
llevError,
"i18n: couldn't find default language (en)\n");
212 for (
auto message : language->messages) {
static std::vector< i18n_file * > i18n_files
void LOG(LogLevel logLevel, const char *format,...)
std::map< sstring, sstring > messages
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
void bufferreader_destroy(BufferReader *br)
BufferReader * bufferreader_init_from_file(BufferReader *br, const char *filepath, const char *failureMessage, LogLevel failureLevel)
DIR * opendir(const char *)
sstring add_refcount(sstring str)
sstring i18n_get_language_code(language_t language)
sstring add_string(const char *str)
struct dirent * readdir(DIR *)
void fatal(enum fatal_error err)
void free_string(sstring str)
language_t i18n_get_language_by_code(const char *code)
const typedef char * sstring
void i18n_list_languages(object *who)
language_t i18n_find_language_by_code(const char *code)
static i18n_file * i18n_default
const char * i18n(const object *who, const char *code)
static void convert_newline(char *line)
char * bufferreader_next_line(BufferReader *br)