cl_language.c File Reference

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"
Include dependency graph for cl_language.c:

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_tlanguageList
static int languageCount

Detailed Description

Language code.

Definition in file cl_language.c.


Typedef Documentation

typedef struct language_s language_t

Struct that reflects parsed language definitions from our script files.

List of all mappings for a locale.


Function Documentation

static const char* CL_GetLocaleID ( const char *  fullLocale  )  [static]

Searches the locale script id with the given locale string.

Parameters:
[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   ) 
static qboolean CL_LanguageTest ( const char *  localeID  )  [static]

Test given language by trying to set locale.

Parameters:
[in] localeID language abbreviation.
Returns:
qtrue if setting given language is possible.

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.

Parameters:
[in] localeID the locale id parsed from scriptfiles (e.g. en or de [the short id])
See also:
CL_LocaleSet

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 
)

Variable Documentation

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().

linked list of all parsed languages

Definition at line 54 of file cl_language.c.


Generated by  doxygen 1.6.2