-
Notifications
You must be signed in to change notification settings - Fork 0
/
appLang.c
113 lines (106 loc) · 1.81 KB
/
appLang.c
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include "appLng.h"
LANG const _appDefLang =
{
{
// Main list
{"Organisation"},
{"Platform"},
{"Target"},
{"Profile"},
{"Search"},
{"Results"},
{"Editor"},
{"Hacks"},
{"Hack"},
{"About"},
// Search Menu
{"Dump"},
{"Undo"},
{"Redo"},
// Other
{"Name"},
{"File"},
{"Endian"},
{"System"},
{"Little"},
{"PDP"},
{"Big"},
{"Path"},
{"Type"},
{"ID"},
{"Memory"},
{"Address"},
{"Size"},
{"Depth"},
{"Range"},
{"Codes"},
{"Code"},
{"Write"},
{"Copy"},
{"Add"},
{"Remove"},
{"Comparison"},
{"Joker"},
{"Format"},
{"(M)"},
{"???"},
{"Value"},
{"Always"},
{"True"},
{"False"},
// List
{"First"},
{"Previous"},
{"Next"},
{"Final"},
{"New"},
{"Insert"},
{"Shift Up"},
{"Shift Up (NB)"},
{"Shift Down"},
{"Shift Down (NB)"},
{"Shift Left"},
{"Shift Right"},
{"Delete"},
{"Move"},
// Data <> GUI Actions
{"Apply"},
{"Reset"},
{"Load"},
{"Save"}
}
};
LANG _appLang = {{{{0}}}};
LANG const *appLang = &_appLang;
void appLoadLang ( char *name )
{
FILE *file;
char fname[ PATH_MAX ] = {0};
size_t r = istrcmp( name, "en" ).i;
if ( r )
{
copystri( fname, "lang", PATH_MAX );
appendstr ( fname, DIR_SEP, PATH_MAX );
appendstr ( fname, name, PATH_MAX );
appendstr ( fname, ".applang", PATH_MAX );
if ( _access( fname, 0 ) != 0 )
{
goto fail;
}
file = fopen( fname, "r+b" );
if ( !file )
{
goto fail;
}
fread( &_appLang, sizeof ( LANG ), 1, file );
fclose( file );
}
else
{
fail:
memset ( name, 0, strlen ( name ) );
name[0] = 'e';
name[1] = 'n';
memcpy ( &_appLang, &_appDefLang, sizeof ( LANG ) );
}
}