This commit is contained in:
luboslenco
2025-10-15 18:39:55 +02:00
parent 231fda884a
commit 5405d47fcf
242 changed files with 14647 additions and 15144 deletions
+40 -42
View File
@@ -7,8 +7,8 @@
let locale = scriptArgs[4];
if (!locale) {
console.log("Locale code not set!");
std.exit();
console.log("Locale code not set!");
std.exit();
}
let locale_path = "./paint/assets/locale/" + locale + ".json";
@@ -16,54 +16,52 @@ let locale_path = "./paint/assets/locale/" + locale + ".json";
let out = {};
let old = {};
if (fs_exists(locale_path)) {
old = JSON.parse(fs_readfile(locale_path).toString());
old = JSON.parse(fs_readfile(locale_path).toString());
}
let source_paths = [
"paint/sources", "paint/sources/material_nodes", "paint/sources/brush_nodes", "paint/sources/neural_nodes"
];
let source_paths = [ "paint/sources", "paint/sources/material_nodes", "paint/sources/brush_nodes", "paint/sources/neural_nodes" ];
for (let path of source_paths) {
if (!fs_exists(path)) {
continue;
}
if (!fs_exists(path)) {
continue;
}
let files = fs_readdir(path);
for (let file of files) {
if (!file.endsWith(".ts")) {
continue;
}
let files = fs_readdir(path);
for (let file of files) {
if (!file.endsWith(".ts")) {
continue;
}
let data = fs_readfile(path + "/" + file).toString();
let start = 0;
while (true) {
start = data.indexOf('tr("', start);
if (start == -1) {
break;
}
start += 4; // tr("
let data = fs_readfile(path + "/" + file).toString();
let start = 0;
while (true) {
start = data.indexOf('tr("', start);
if (start == -1) {
break;
}
start += 4; // tr("
let end_a = data.indexOf('")', start);
let end_b = data.indexOf('",', start);
if (end_a == -1) {
end_a = end_b;
}
if (end_b == -1) {
end_b = end_a;
}
let end = end_a < end_b ? end_a : end_b;
let end_a = data.indexOf('")', start);
let end_b = data.indexOf('",', start);
if (end_a == -1) {
end_a = end_b;
}
if (end_b == -1) {
end_b = end_a;
}
let end = end_a < end_b ? end_a : end_b;
let val = data.substring(start, end);
val = val.replaceAll("\\n", "\n");
if (old.hasOwnProperty(val)) {
out[val] = old[val];
}
else {
out[val] = "";
}
start = end;
}
}
let val = data.substring(start, end);
val = val.replaceAll("\\n", "\n");
if (old.hasOwnProperty(val)) {
out[val] = old[val];
}
else {
out[val] = "";
}
start = end;
}
}
}
fs_writefile(locale_path, JSON.stringify(out, Object.keys(out).sort(), 4));