]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/lib/i18n.qh
Uncrustify lib/*
[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") return s;
13         fn = strcat(s, ".", fn);
14         int fh = fopen(fn, FILE_READ);
15         if (fh >= 0)
16         {
17                 fclose(fh);
18                 return fn;
19         }
20         return s;
21 }
22
23 string CTX(string s)
24 {
25         int p = strstrofs(s, "^", 0);
26         if (p < 0) return s;
27         return substring(s, p + 1, -1);
28 }
29
30 #define ZCTX(s) strzone(CTX(s))
31
32 #endif