promotional bannermobile promotional banner

Many Translations

Split translation files into many for clear separation!
item image

Description

Hi, occasionally I like to just test what's possible, this is a result of that urge.

I got really tired of dealing with SUPER LONG / cumbersome translation files, if you reference vanilla's translations for 1.21.1 it's already at/nearing 500Kb of raw text... and trying to developer large-scale content mods you run into similar issues (assume you're not data-genning, but even then the scale can get crazy.) So...

Many Translations!

This is a small shared-library mod that lets any mod (or resource pack) split a single language file into several smaller ones, instead of maintaining one giant (or multiple giant) files.

What problem does this solve though, really?

Vanilla loads exactly one file per namespace per language code: assets/<namespace>/lang/<code>.json.

ClientLanguage.loadFrom does an exact path lookup (String.format("lang/%s.json", code)); it never scans the lang/ directory, so mods with a lot of content end up with increasingly large, hard-to-review JSON files. Or more typically, a single giant "en_us.json" file.

How it works

ClientLanguageMixin, redirects the ResourceManager#getResourceStack(...) call inside ClientLanguage#loadFrom.

After fetching the normal exact-match stack for lang/<code>.json, it also looks up (via ResourceManager#listResourceStacks) every resource in the same namespace matching lang/<code>_*.json, sorts those matches by filename, and traverses them in that order.

Translation keys are merged in file order, so later files wins on collisions.

Okay, how do I use it?

Create your mod like normal! Use the normal en_us.json / whatever locale code you're building for until it gets overwhelming.

Then with this mod installed, you can simply copy and paste out the huge sections to separate files such as en_us_1.json or en_us_items.json etc.

Note To Developers

This mod can be consumed with CurseMaven for in-development work.

The Many Translations Team

Grand Artisan tier frameprofile avatar
  • 27
    Followers
  • 25
    Projects
  • 33.0M
    Downloads

More from jason13officialView all