diff options
Diffstat (limited to 'client-web/scripts')
-rw-r--r-- | client-web/scripts/apply_translations.ts | 0 | ||||
-rw-r--r-- | client-web/scripts/find_missing_translations.ts | 29 | ||||
-rw-r--r-- | client-web/scripts/gen_param_table.ts | 27 | ||||
-rw-r--r-- | client-web/scripts/reformat_json.ts | 16 | ||||
-rw-r--r-- | client-web/scripts/translate_argos.py | 31 |
5 files changed, 0 insertions, 103 deletions
diff --git a/client-web/scripts/apply_translations.ts b/client-web/scripts/apply_translations.ts deleted file mode 100644 index e69de29..0000000 --- a/client-web/scripts/apply_translations.ts +++ /dev/null diff --git a/client-web/scripts/find_missing_translations.ts b/client-web/scripts/find_missing_translations.ts deleted file mode 100644 index d39590a..0000000 --- a/client-web/scripts/find_missing_translations.ts +++ /dev/null @@ -1,29 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -/// <reference lib="deno.worker" /> -import { LOCALES } from "../source/locale/mod.ts"; - -const global_lc = "en" - -function traverse_object(target: any, current: any): any { - if (typeof target == "string") return target - if (typeof target == "function") return undefined - 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 - if (lc.search("-") != -1) continue - const k = traverse_object(master, LOCALES[lc]); - if (JSON.stringify(k).length <= 2) continue - console.log(JSON.stringify({ source: global_lc, target: lc, strings: k })); -} diff --git a/client-web/scripts/gen_param_table.ts b/client-web/scripts/gen_param_table.ts deleted file mode 100644 index 49634c0..0000000 --- a/client-web/scripts/gen_param_table.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - This file is part of keks-meet (https://codeberg.org/metamuffin/keks-meet) - which is licensed under the GNU Affero General Public License (version 3); see /COPYING. - Copyright (C) 2023 metamuffin <metamuffin.org> -*/ -import { PREF_DECLS } from "../source/preferences/decl.ts"; -import { PrefDecl } from "../source/preferences/mod.ts"; - -console.log(`Option name|Type|Default|Description`); -console.log(`---|---|---|---`); - -const P = PREF_DECLS as Record<string, PrefDecl<unknown>> -for (const key in P) { - const e = P[key]; - if (key == "username") e.default = "guest-…" // maybe generalize - const q = (e: string) => `\`${e}\`` - console.log([ - q(key), - typeof e.type, - e.default === undefined ? "-" : q(JSON.stringify(e.default)), - (e.description ?? "*none*") + ( - e.possible_values - ? " (" + e.possible_values.map(e => JSON.stringify(e)).map(q).join(" / ") + ")" - : "" - ) - ].join("|")); -}
\ No newline at end of file diff --git a/client-web/scripts/reformat_json.ts b/client-web/scripts/reformat_json.ts deleted file mode 100644 index 35fc1dd..0000000 --- a/client-web/scripts/reformat_json.ts +++ /dev/null @@ -1,16 +0,0 @@ - - - - -const decoder = new TextDecoder(); -let text = "" -for await (const chunk of Deno.stdin.readable) { - text += decoder.decode(chunk); -} - -for (const ob of text.split("\n")) { - if (!ob.length) continue - console.log(JSON.stringify(JSON.parse(ob), null, 4)); -} - - diff --git a/client-web/scripts/translate_argos.py b/client-web/scripts/translate_argos.py deleted file mode 100644 index 2f45446..0000000 --- a/client-web/scripts/translate_argos.py +++ /dev/null @@ -1,31 +0,0 @@ -import json -import sys -from argostranslate import translate - -for line in sys.stdin: - task = json.loads(line) - srclang = task["source"] - dstlang = task["target"] - - installed_languages = { lang.code: lang for lang in translate.load_installed_languages() } - if srclang not in installed_languages: - raise Exception(f"need language {srclang}") - if dstlang not in installed_languages: - raise Exception(f"need language {dstlang}") - srclang = installed_languages[srclang] - dstlang = installed_languages[dstlang] - translator = srclang.get_translation(dstlang) - if translator is None: - raise Exception("no translator available") - - - def tr(key, ob): - if ob == None: return None - if isinstance(ob, list): return [ tr(None,e) for e in ob ] - if isinstance(ob, dict): return { k: tr(k,v) for k, v in ob.items() } - if isinstance(ob, str): - print(f"{srclang.code}->{dstlang.code} {key}", file=sys.stderr) - return translator.translate(ob) - - print(json.dumps(tr("root", task["strings"]))) - |