]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/lib/i18n.qh
Merge branch 'master' into TimePath/unified_weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / i18n.qh
1 #ifndef I18N_H
2 #define I18N_H
3
4 #include "log.qh"
5
6 // translation helpers
7 string prvm_language;
8
9 string language_filename(string s)
10 {
11     string fn = prvm_language;
12     if (fn == "" || fn == "dump")
13         return s;
14     fn = strcat(s, ".", fn);
15     int fh = fopen(fn, FILE_READ);
16     if (fh >= 0)
17     {
18         fclose(fh);
19         return fn;
20     }
21     return s;
22 }
23
24 string CTX(string s)
25 {
26     int p = strstrofs(s, "^", 0);
27     if (p < 0)
28         return s;
29     return substring(s, p + 1, -1);
30 }
31
32 #define ZCTX(s) strzone(CTX(s))
33
34 #endif