Last active
November 13, 2024 13:12
-
-
Save cshaa/bd781da53589d1b8551487c5941153b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const objToKeysDeep = (obj: object, prefix = ""): string[] => | |
Object.entries(obj).flatMap(([key, value]) => | |
typeof value === "object" | |
? objToKeysDeep(value, `${prefix}${key}.`) | |
: `${prefix}${key}` | |
); | |
const missingInLang = async (lang: string) => { | |
const en = (await import(`./packages/decap-cms-locales/src/en/index.js`)) | |
.default; | |
const transl = ( | |
await import(`./packages/decap-cms-locales/src/${lang}/index.js`) | |
).default; | |
return new Set(objToKeysDeep(en)).difference(new Set(objToKeysDeep(transl))); | |
}; | |
console.log(await missingInLang("cs")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment