blob: de6849d415590de534c3626429a332349ed8ba8f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#include <base/tl/array.hpp>
class LOCALIZATIONDATABASE
{
class STRING
{
public:
unsigned hash;
string replacement;
bool operator ==(unsigned h) const { return hash == h; }
};
array<STRING> strings;
int current_version;
public:
LOCALIZATIONDATABASE();
bool load(const char *filename);
int version() { return current_version; }
void add_string(const char *org_str, const char *new_str);
const char *find_string(unsigned hash);
};
static LOCALIZATIONDATABASE localization;
class LOC_CONSTSTRING
{
const char *default_str;
const char *current_str;
unsigned hash;
int version;
public:
LOC_CONSTSTRING(const char *str);
void reload();
inline operator const char *()
{
if(version != localization.version())
reload();
return current_str;
}
};
|