Crossfire Server, Trunk
|
Go to the source code of this file.
Data Structures | |
struct | i18n_file |
struct | i18n_message |
Typedefs | |
typedef struct i18n_file | i18n_file |
typedef struct i18n_message | i18n_message |
Functions | |
static void | convert_newline (char *line) |
const char * | i18n (const object *who, const char *code) |
int | i18n_find_language_by_code (const char *code) |
void | i18n_free (void) |
int | i18n_get_language_by_code (const char *code) |
sstring | i18n_get_language_code (int language) |
void | i18n_init (void) |
void | i18n_list_languages (object *who) |
static int | i18n_message_compare_code (const i18n_message *a, const i18n_message *b) |
Variables | |
static int | i18n_count = 0 |
static int | i18n_default = -1 |
static struct i18n_file * | i18n_files = NULL |
typedef struct i18n_message i18n_message |
One message.
|
static |
Replaces '
' by a newline char.
Since we are replacing 2 chars by 1, no overflow should happen.
line | text to replace into. |
Definition at line 137 of file languages.c.
References buf, is_valid_types_gen::line, MAX_BUF, and give::next.
Referenced by i18n_init().
const char* i18n | ( | const object * | who, |
const char * | code | ||
) |
Translate a message in the appropriate language.
who | who to translate for. |
code | string to translate, usually the English version. |
Definition at line 55 of file languages.c.
References add_string(), i18n_message::code, i18n_file::code, i18n_file::count, is_valid_types_gen::found, free_string(), i18n_count, i18n_files, i18n_message_compare_code(), make_face_from_files::int, i18n_file::messages, and autojail::who.
Referenced by command_body(), command_delete(), command_passwd(), command_quest(), command_statistics(), confirm_password(), do_harvest(), draw_ext_info(), draw_ext_info_format(), get_name(), get_party_password(), get_password(), key_change_class(), key_roll_stat(), play_again(), quest_display(), quest_info(), receive_player_password(), and roll_again().
int i18n_find_language_by_code | ( | const char * | code | ) |
Attempt to find the identifier of a language from its code.
code | language code. |
Definition at line 81 of file languages.c.
References i18n_file::code, i18n_count, i18n_files, and npc_dialog::index.
Referenced by command_language(), and i18n_get_language_by_code().
void i18n_free | ( | void | ) |
Clears all i18n-related data.
Definition at line 239 of file languages.c.
References i18n_file::count, mad_mage_user::file, free_string(), i18n_count, i18n_files, diamondslots::message, and navar-midane_apply::messages.
Referenced by cleanup().
int i18n_get_language_by_code | ( | const char * | code | ) |
Find the identifier of a language from its code.
code | language's code. |
Definition at line 96 of file languages.c.
References i18n_file::code, i18n_default, and i18n_find_language_by_code().
Referenced by check_login().
sstring i18n_get_language_code | ( | int | language | ) |
Return the code of a specified language.
language | identifier of the language. |
Definition at line 108 of file languages.c.
References i18n_file::code, i18n_count, i18n_default, and i18n_files.
Referenced by command_help(), help_topics(), and save_player().
void i18n_init | ( | void | ) |
Initializes the i18n subsystem. Will load all found strings. If there is an error, calls fatal().
Definition at line 154 of file languages.c.
References add_refcount(), add_string(), bufferreader_destroy(), bufferreader_init_from_file(), bufferreader_next_line(), closedir(), i18n_message::code, i18n_file::code, convert_newline(), disinfect::count, i18n_file::count, Settings::datadir, dirent, fatal(), mad_mage_user::file, npc_dialog::filename, is_valid_types_gen::found, free_string(), i18n_count, i18n_default, i18n_files, i18n_message_compare_code(), is_valid_types_gen::line, llevDebug, llevError, LOG(), MAX_BUF, i18n_message::message, navar-midane_apply::messages, i18n_file::messages, i18n_file::name, opendir(), OUT_OF_MEMORY, readdir(), SEE_LAST_ERROR, and settings.
Referenced by init_library().
void i18n_list_languages | ( | object * | who | ) |
List all languages for who.
who | who to display languages for. |
Definition at line 118 of file languages.c.
References i18n_file::code, draw_ext_info_format(), i18n_count, i18n_files, npc_dialog::index, MSG_SUBTYPE_NONE, MSG_TYPE_COMMAND, give::name, NDI_UNIQUE, and autojail::who.
Referenced by command_language().
|
static |
Definition at line 45 of file languages.c.
References disinfect::a, and Ice::b.
Referenced by i18n(), and i18n_init().
|
static |
Number of defined languages.
Definition at line 39 of file languages.c.
Referenced by i18n(), i18n_find_language_by_code(), i18n_free(), i18n_get_language_code(), i18n_init(), and i18n_list_languages().
|
static |
Index of "English" in the i18nfiles array.
Definition at line 43 of file languages.c.
Referenced by i18n_get_language_by_code(), i18n_get_language_code(), and i18n_init().
|
static |
Defined languages.
Definition at line 41 of file languages.c.
Referenced by i18n(), i18n_find_language_by_code(), i18n_free(), i18n_get_language_code(), i18n_init(), and i18n_list_languages().