Pixel-Composer/scripts/locale_data/locale_data.gml

21 lines
425 B
Plaintext
Raw Normal View History

2023-02-14 02:48:33 +01:00
#region locale
globalvar LOCALE;
LOCALE = {}
function __initLocale() {
2023-03-08 12:14:01 +01:00
var lfile = "data/locale/en.json";
2023-02-14 02:48:33 +01:00
var root = DIRECTORY + "Locale";
2023-03-08 12:14:01 +01:00
var path = root + "/en.json";
2023-02-14 02:48:33 +01:00
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