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 | localeMapping_s |
List of all mappings for a locale. More... | |
struct | language_s |
Struct that reflects parsed language definitions from our script files. More... | |
Typedefs | |
typedef struct localeMapping_s | localeMapping_t |
List of all mappings for a locale. | |
typedef struct language_s | language_t |
Struct that reflects parsed language definitions from our script files. | |
Functions | |
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 qboolean | CL_LanguageTest (const char *localeID) |
Test given language by trying to set locale. | |
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. | |
qboolean | CL_LanguageTryToSet (const char *localeID) |
Cycle through all parsed locale mappings and try to set one after another. | |
Variables | |
static language_t * | languageList |
static int | languageCount |
Language code.
Definition in file cl_language.c.
typedef struct language_s language_t |
Struct that reflects parsed language definitions from our script files.
typedef struct localeMapping_s localeMapping_t |
List of all mappings for a locale.
static const char* CL_GetLocaleID | ( | const char * | fullLocale | ) | [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 61 of file cl_language.c.
References Com_DPrintf(), DEBUG_CLIENT, i, languageCount, language_s::localeID, localeMapping_s::localeMapping, language_s::localeMapping, localeMapping_s::next, and language_s::next.
Referenced by CL_LanguageInit().
void CL_LanguageInit | ( | void | ) |
Fills the options language menu node with the parsed language mappings.
Definition at line 219 of file cl_language.c.
References CL_GetLocaleID(), CL_LanguageTest(), CL_LanguageTryToSet(), Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, i, languageCount, language_s::localeID, language_s::localeString, MAX_VAR, language_s::next, OPTION_LANGUAGES, Q_strncpyz(), s_language, cvar_s::string, Sys_GetLocale(), UI_AddOption(), UI_RegisterOption(), and UI_SortOptions().
Referenced by CL_InitAfter().
static qboolean CL_LanguageTest | ( | const char * | localeID | ) | [static] |
Test given language by trying to set locale.
[in] | localeID | language abbreviation. |
Definition at line 146 of file cl_language.c.
References BASEDIRNAME, Com_DPrintf(), Com_sprintf(), Cvar_Get(), DEBUG_CLIENT, FS_FileExists(), FS_GetCwd(), i, languageCount, language_s::localeID, localeMapping_s::localeMapping, language_s::localeMapping, MAX_OSPATH, localeMapping_s::next, language_s::next, Q_strcat(), Q_strncpyz(), qfalse, qtrue, cvar_s::string, and Sys_Setenv().
Referenced by CL_LanguageInit().
qboolean 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 281 of file cl_language.c.
References CL_NewLanguage(), Com_DPrintf(), Com_Printf(), Cvar_Set(), DEBUG_CLIENT, i, languageCount, language_s::localeID, localeMapping_s::localeMapping, language_s::localeMapping, cvar_s::modified, localeMapping_s::next, language_s::next, qfalse, qtrue, s_language, and Sys_SetLocale().
Referenced by CL_LanguageInit(), and CL_SlowFrame().
static void CL_NewLanguage | ( | void | ) | [static] |
Adjust game for new language: reregister fonts, etc.
Definition at line 268 of file cl_language.c.
References _, 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 83 of file cl_language.c.
References cl_genericPool, Com_EParse(), Com_Printf(), languageCount, language_s::localeID, language_s::localeMapping, localeMapping_s::localeMapping, language_s::localeString, Mem_PoolAlloc, Mem_PoolStrDup, language_s::next, and localeMapping_s::next.
Referenced by CL_ParseClientData().
int languageCount [static] |
how many languages do we have
Definition at line 55 of file cl_language.c.
Referenced by CL_GetLocaleID(), CL_LanguageInit(), CL_LanguageTest(), CL_LanguageTryToSet(), and CL_ParseLanguages().
language_t* languageList [static] |
linked list of all parsed languages
Definition at line 54 of file cl_language.c.