Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
i18n.qh File Reference
#include "log.qh"
#include "map.qh"
#include "unsafe.qh"
Include dependency graph for i18n.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CTX_CACHE   1
#define ZCTX(s)

Functions

ERASEABLE string CTX (string s)
ERASEABLE string language_filename (string s)

Variables

string prvm_language

Macro Definition Documentation

◆ CTX_CACHE

#define CTX_CACHE   1

Definition at line 30 of file i18n.qh.

◆ ZCTX

Function Documentation

◆ CTX()

Definition at line 46 of file i18n.qh.

47{
48#if CTX_CACHE
49 string c = HM_gets(CTX_cache, s);
50 if (c != "")
51 return c;
52#endif
53 int caret_ofs = strstrofs(s, "^", 0);
54 string ret = s;
55 // empty (caret_ofs == 0) and one char (caret_ofs == 1) prefixes are invalid
56 if (caret_ofs > 1)
57 {
58 int space_ofs = strstrofs(substring(s, 0, caret_ofs), " ", 0);
59 // prefixes containing a space are invalid (likely the caret is part of a color code)
60 if (space_ofs < 0 || space_ofs > caret_ofs)
61 ret = substring(s, caret_ofs + 1, -1);
62 }
63#if CTX_CACHE
64 LOG_DEBUGF("CTX(\"%s\")", s);
65 HM_sets(CTX_cache, s, ret);
66#endif
67 return ret;
68}
#define strstrofs
#define LOG_DEBUGF(...)
Definition log.qh:79
#define HM_sets(this, key, val)
Definition map.qh:108
#define HM_gets(this, k)
Definition map.qh:98
string substring(string s, float start, float length)

References HM_gets, HM_sets, LOG_DEBUGF, strstrofs, and substring().

Referenced by count_fill(), KeyBinds_BuildList(), QuickMenu_Default(), Scoreboard_Fraglimit_Draw(), and XonoticDecibelsSlider_valueToText().

◆ language_filename()

ERASEABLE string language_filename ( string s)
Deprecated
prefer _("translatable text") - GMQCC's -ftranslatable-strings feature

Definition at line 14 of file i18n.qh.

15{
16 string fn = prvm_language;
17 if (fn == "" || fn == "en" || fn == "dump")
18 return s;
19 fn = strcat(s, ".", fn);
20 int fh = fopen(fn, FILE_READ);
21 if (fh >= 0)
22 {
23 fclose(fh);
24 return fn;
25 }
26 return s;
27}
const float FILE_READ
string prvm_language
Definition i18n.qh:8
void fclose(float fhandle)
float fopen(string filename, float mode)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

References fclose(), FILE_READ, fopen(), prvm_language, and strcat().

Referenced by CampaignFile_Load().

Variable Documentation

◆ prvm_language