From 93d09d0aaef7586389daa360c1a361e915c4a228 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 3 Apr 2024 17:02:15 +0200 Subject: maybe autogen languages --- client-web/scripts/autogen_locale.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 client-web/scripts/autogen_locale.ts (limited to 'client-web/scripts/autogen_locale.ts') diff --git a/client-web/scripts/autogen_locale.ts b/client-web/scripts/autogen_locale.ts new file mode 100644 index 0000000..c2f3d5b --- /dev/null +++ b/client-web/scripts/autogen_locale.ts @@ -0,0 +1,28 @@ +// deno-lint-ignore-file no-explicit-any +import { LOCALES } from "../source/locale/mod.ts"; + +const global_lc = "en-US" + +function traverse_object(target: any, current: any): any { + if (typeof target == "string") return target + const out = {} as any + for (const key in target) { + if (!current) { + out[key] = target[key] + } else { + if (key in current) continue + out[key] = traverse_object(target[key], current) + } + } + return out +} + +const master = LOCALES[global_lc] +for (const lc in LOCALES) { + if (lc == global_lc) continue + const k = JSON.stringify(traverse_object(master, LOCALES[lc])); + if (k.length <= 2) continue + console.log( + `New strings required in ${lc}:\n\t${k}` + ); +} -- cgit v1.2.3-70-g09d2