Lang trimmer
For Minecraft-format language jsons.
Use cases for “Remove keys matching en_us”:
- Minecraft supports English variants like
en_gbanden_nz, which only have minor spelling differences compared toen_us. Most of the lang entries are identical toen_us. - Minecraft falls back to
en_usif it can’t find a lang entry. - We can therefore save a lot of space by removing lang entries from
en_gb.jsonthat are identical to entries inen_us.json. - (Also handy for cleaning up situations where a translator copy-pastes lang entries from
en_usinto their WIP translation.)
Use case for “Remove keys missing from en_us”:
- If a mod is primarily developed in
en_usand third-party translators contribute translations, when the mod developer removes a key inen_usit is possible they’ll forget to remove the key from all translations. - This can cause translation files to build up cruft over time and cause translators to spend time and effort reviewing translations of now-unused content.
- Be careful with this function:
- This tool can’t tell the difference between a key you intended to remove & a key you intended to merely rename.
- Watch out for things like multiline tooltips, where the mod queries the localization system and uses as many language keys as it can find.
- Examine a git diff afterwards to make sure nothing important was deleted.
This tool will always remove duplicate lang entries (choosing the last one) and reformat the language file, as a side-effect of using browser json utililties.
If the button doesn’t do anything, check the browser console; it’s either a bug in my code or ill-formatted JSON.