|
UFO: Alien Invasion
|
Language code. More...
#include "client.h"#include "cl_language.h"#include "../shared/parse.h"#include "../ports/system.h"#include "ui/ui_main.h"#include "ui/ui_font.h"#include "ui/node/ui_node_abstractoption.h"
Go to the source code of this file.
Data Structures | |
| struct | msgid_t |
| struct | localeMapping_t |
| List of all mappings for a locale. More... | |
| struct | language_t |
| Struct that reflects parsed language definitions from our script files. More... | |
Macros | |
| #define | MAX_MSGIDS 512 |
| #define | MAX_MSGIDHASH 256 |
| #define | MSGIDSIZE 65536 |
Functions | |
| static void | CL_ParseMessageID (const char *name, const char **text) |
| static const char * | CL_GetMessageID (const char *id) |
| const char * | CL_Translate (const char *t) |
| void | CL_ParseMessageIDs (void) |
| static const char * | CL_GetLocaleID (const char *fullLocale) |
| Searches the locale script id with the given locale string. | |
| void | CL_ParseLanguages (const char *name, const char **text) |
| Parse all language definitions from the script files. | |
| static bool | CL_LanguageTest (const char *localeID) |
| Test given language by trying to set locale. | |
| void | CL_LanguageShutdown (void) |
| void | CL_LanguageInitMenu (void) |
| void | CL_LanguageInit (void) |
| Fills the options language menu node with the parsed language mappings. | |
| static void | CL_NewLanguage (void) |
| Adjust game for new language: reregister fonts, etc. | |
| bool | CL_LanguageTryToSet (const char *localeID) |
| Cycle through all parsed locale mappings and try to set one after another. | |
Variables | |
| static cvar_t * | fs_i18ndir |
| static memPool_t * | cl_msgidPool |
| static msgid_t | msgIDs [MAX_MSGIDS] |
| static int | numMsgIDs |
| static msgid_t * | msgIDHash [MAX_MSGIDHASH] |
| static char * | msgIDText |
| static language_t * | languageList |
| static int | languageCount |
Language code.
Definition in file cl_language.cpp.
| #define MAX_MSGIDHASH 256 |
Definition at line 51 of file cl_language.cpp.
Referenced by CL_GetMessageID(), and CL_ParseMessageID().
| #define MAX_MSGIDS 512 |
Definition at line 38 of file cl_language.cpp.
Referenced by CL_ParseMessageID().
| #define MSGIDSIZE 65536 |
Definition at line 54 of file cl_language.cpp.
Referenced by CL_ParseMessageID(), and CL_ParseMessageIDs().
|
static |
Searches the locale script id with the given locale string.
| [in] | fullLocale | The full locale string. E.g. en_US.UTF-8 |
Definition at line 191 of file cl_language.cpp.
References Com_DPrintf(), DEBUG_CLIENT, languageList, language_t::localeID, language_t::localeMapping, localeMapping_t::localeMapping, language_t::next, localeMapping_t::next, and Q_streq.
Referenced by CL_LanguageInit().
|
static |
Definition at line 113 of file cl_language.cpp.
References Com_HashKey(), hash, id, MAX_MSGIDHASH, msgIDHash, and Q_streq.
Referenced by CL_Translate().
Fills the options language menu node with the parsed language mappings.
Definition at line 376 of file cl_language.cpp.
References CL_GetLocaleID(), Com_DPrintf(), Com_Printf(), Cvar_Get(), DEBUG_CLIENT, fs_i18ndir, MAX_VAR, Q_strncpyz(), Q_strvalid, s_language, and Sys_GetLocale().
Referenced by CL_InitAfter().
Definition at line 352 of file cl_language.cpp.
References CL_LanguageTest(), CL_LanguageTryToSet(), uiNode_t::disabled, languageList, language_t::localeID, language_t::nativeString, language_t::next, OPTION_LANGUAGES, Q_streq, s_language, UI_AddOption(), UI_RegisterOption(), and UI_SortOptions().
Referenced by CLMN_Init().
Definition at line 341 of file cl_language.cpp.
References cl_msgidPool, languageCount, languageList, Mem_DeletePool, msgIDHash, msgIDText, numMsgIDs, and OBJZERO.
Referenced by CL_Shutdown().
|
static |
Test given language by trying to set locale.
| [in] | localeID | language abbreviation. |
Definition at line 277 of file cl_language.cpp.
References BASEDIRNAME, Com_DPrintf(), Com_sprintf(), DEBUG_CLIENT, FS_FileExists(), FS_GetCwd(), fs_i18ndir, i, languageCount, languageList, language_t::localeID, language_t::localeMapping, localeMapping_t::localeMapping, MAX_OSPATH, language_t::next, localeMapping_t::next, Q_strcat(), Q_streq, Q_strncpyz(), and Sys_Setenv().
Referenced by CL_LanguageInitMenu().
| bool CL_LanguageTryToSet | ( | const char * | localeID | ) |
Cycle through all parsed locale mappings and try to set one after another.
| [in] | localeID | the locale id parsed from scriptfiles (e.g. en or de [the short id]) |
Definition at line 413 of file cl_language.cpp.
References CL_NewLanguage(), Com_DPrintf(), Com_Printf(), Cvar_Set(), DEBUG_CLIENT, i, languageCount, languageList, language_t::localeID, language_t::localeMapping, localeMapping_t::localeMapping, language_t::next, localeMapping_t::next, Q_streq, s_language, and Sys_SetLocale().
Referenced by CL_LanguageInitMenu(), and CL_SlowFrame().
Adjust game for new language: reregister fonts, etc.
Definition at line 399 of file cl_language.cpp.
References _, CL_ParseMessageIDs(), R_FontInit(), R_FontSetTruncationMarker(), R_FontShutdown(), and UI_InitFonts().
Referenced by CL_LanguageTryToSet().
| void CL_ParseLanguages | ( | const char * | name, |
| const char ** | text ) |
Parse all language definitions from the script files.
Definition at line 211 of file cl_language.cpp.
References cl_genericPool, Com_EParse(), Com_Error(), Com_ParseList(), Com_Printf(), ERR_DROP, ERR_FATAL, languageCount, languageList, LIST_Delete(), language_t::localeID, language_t::localeMapping, localeMapping_t::localeMapping, language_t::localeString, Mem_PoolAllocType, Mem_PoolStrDup, name, language_t::nativeString, language_t::next, linkedList_t::next, localeMapping_t::next, and Q_streq.
Referenced by CL_ParseClientData().
|
static |
Definition at line 57 of file cl_language.cpp.
References _, cl_msgidPool, Com_DPrintf(), Com_EParse(), Com_HashKey(), Com_Parse(), Com_Printf(), Com_SkipBlock(), DEBUG_CLIENT, hash, HASH_Add, i, msgid_t::id, MAX_MSGIDHASH, MAX_MSGIDS, Mem_PoolStrDup, msgIDHash, msgIDs, MSGIDSIZE, msgIDText, name, numMsgIDs, OBJZERO, Q_streq, Sys_Error(), and msgid_t::text.
Referenced by CL_ParseMessageIDs().
Definition at line 137 of file cl_language.cpp.
References cl_msgidPool, CL_ParseMessageID(), Com_Printf(), FS_BuildFileList(), FS_NextScriptHeader(), Mem_CreatePool, Mem_FreePool, Mem_PoolAllocTypeN, msgIDHash, MSGIDSIZE, msgIDText, name, numMsgIDs, OBJZERO, Q_streq, and type.
Referenced by CL_NewLanguage().
| const char * CL_Translate | ( | const char * | t | ) |
Definition at line 123 of file cl_language.cpp.
References _, CL_GetMessageID(), and Q_strstart().
Referenced by uiOptionListNode::draw(), uiOptionTreeNode::draw(), uiSelectBoxNode::draw(), uiTabNode::draw(), uiTextNode::draw(), uiSelectBoxNode::drawOverWindow(), uiTextNode::drawText(), uiTabNode::drawTooltip(), GAME_GetImportData(), Irc_Proto_ProcessServerMsg(), SEQ_Render2D(), UI_ExecuteSetAction(), UI_GetReferenceString(), UI_GetText(), UI_OptionNodeRemoveHigherOption(), UI_TabNodeTabAtPosition(), UI_TextNodeGenerateLineSplit(), and uiTextNode::updateCache().
|
static |
Definition at line 36 of file cl_language.cpp.
Referenced by CL_LanguageShutdown(), CL_ParseMessageID(), and CL_ParseMessageIDs().
|
static |
Definition at line 35 of file cl_language.cpp.
Referenced by CL_Init(), CL_LanguageInit(), and CL_LanguageTest().
|
static |
how many languages do we have
Definition at line 185 of file cl_language.cpp.
Referenced by CL_LanguageShutdown(), CL_LanguageTest(), CL_LanguageTryToSet(), and CL_ParseLanguages().
|
static |
linked list of all parsed languages
Definition at line 184 of file cl_language.cpp.
Referenced by CL_GetLocaleID(), CL_LanguageInitMenu(), CL_LanguageShutdown(), CL_LanguageTest(), CL_LanguageTryToSet(), and CL_ParseLanguages().
|
static |
Definition at line 52 of file cl_language.cpp.
Referenced by CL_GetMessageID(), CL_LanguageShutdown(), CL_ParseMessageID(), and CL_ParseMessageIDs().
|
static |
Definition at line 49 of file cl_language.cpp.
Referenced by CL_ParseMessageID().
|
static |
Definition at line 55 of file cl_language.cpp.
Referenced by CL_LanguageShutdown(), CL_ParseMessageID(), and CL_ParseMessageIDs().
|
static |
Definition at line 50 of file cl_language.cpp.
Referenced by CL_LanguageShutdown(), CL_ParseMessageID(), and CL_ParseMessageIDs().