mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-10 20:45:35 +01:00
21 lines
428 B
Plaintext
21 lines
428 B
Plaintext
|
#region locale
|
||
|
globalvar LOCALE;
|
||
|
LOCALE = {}
|
||
|
|
||
|
function __initLocale() {
|
||
|
var lfile = "data\\locale\\en.json";
|
||
|
var root = DIRECTORY + "Locale";
|
||
|
var path = root + "\\en.json";
|
||
|
|
||
|
if(!directory_exists(root))
|
||
|
directory_create(root);
|
||
|
|
||
|
file_copy(lfile, path);
|
||
|
LOCALE = json_load_struct(path);
|
||
|
}
|
||
|
|
||
|
function get_text(key, def = "") {
|
||
|
if(!struct_has(LOCALE, key)) return def;
|
||
|
return LOCALE[$ key];
|
||
|
}
|
||
|
#endregion
|