aboutsummaryrefslogtreecommitdiff
path: root/client-web/scripts/find_missing_translations.ts
blob: d39590af76d60ebab18c9a1c479e138bf636c932 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 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 }));
}