elan-ev / opencast-studio

Web-based recording studio for Opencast
https://studio.opencast.org
MIT License
50 stars 46 forks source link

Cleanup translations and remove Turkish & Greek #1135

Closed LukasKalbertodt closed 11 months ago

LukasKalbertodt commented 11 months ago

Fixes #1075

This moves around translations (i.e. giving them a different key), mostly to transition to the nested form. This PR also removes unused translations. Not all keys are in the nested form yet as I lost motivation at this point some are just used in several places and don't fit well into the nested structure. Finally, Greek and Turkish are removed. See the relevant commit for more info.

This is quite a big and annoying-to-review PR, unfortunately. I don't think a code review is useful or necessary:

I already asked and will still ask a few contacts to provide full translations for French, Farsi, Spanish, Chinese simplified. Those will be added in a follow up PR.


My used scripts, just for reference:

`flatten.ts`: prints the flat translation keys of a JSON file. Run with `deno --allow-read flatten.ts -- path/to/file`. ``` const flatten = (obj: object, prefix: string) => { for (const key in obj) { if (isObject(obj[key])) { flatten(obj[key], `${prefix}${key}.`); } else { console.log(`${prefix}${key}`); } } }; const isObject = (v: unknown): v is object => ( typeof v === "object" && !Array.isArray(v) && v !== null ); const filename = Deno.args[1]; const content = await Deno.readTextFile(filename); const jsonIn = JSON.parse(content); flatten(jsonIn, ""); ``` Run that for `en.json` and save to `enkeys.txt`. Then run this script on the output of `flatten.ts` for all other files: ``` #!/bin/bash while IFS= read -r line do rg -q "$line" ./enkeys.txt || echo "$line" done ```