kami-blue / client

ARCHIVED - KAMI Blue: a continuation of 1.12.2 KAMI
https://kamiblue.org
GNU Lesser General Public License v3.0
363 stars 378 forks source link

A way for the community to translate the client #797

Open 5HT2 opened 4 years ago

5HT2 commented 4 years ago

This is something that would be very very long term, a way for people to translate the client as a community. Something like variables used in the GUI, which would turn into a String based on the current Minecraft language (obviously not rewriting the entire command system as well).

Maybe something to keep in mind for #790

spide-r commented 4 years ago

You might have already thought of this, but if it's easier to modify the Minecraft locale files, it might be better to splice into them and add community translations there. The I18n module already works pretty well.

5HT2 commented 4 years ago

I'd rather not do that. Preferably we would have a json file with the translation keys in the kami-blue/assets repository so it can be updated without updating the mod.

The only issue is with the current implementation of everything, most strings are hardcoded and I'm not sure how translation keys really work either, especially with users having the ability to rename modules.

I'll probably remove the module renaming functionality in the refactor/rewrite branch to simplify things.

I would like to automatically detect the language based on Minecraft settings when you first start it up and then have the ability to manually changed it, once this is implemented.

spide-r commented 4 years ago

Ah quite fair, that is better.

From what I can tell the translation keys are in the source language and are tied to strings which are prepared with StringFormatter in mind. The translators would probably need to be given a quick lesson or guide as to how string formatting works if we followed that method.

The minecraft implementation seems to load all key/value pairs for the current locale into a HashMap, so maybe something could be started there. It is a royal pain to update everything from hard coded strings though...

5HT2 commented 4 years ago

Yea. I assuming you would replace module names with like module.name.aura and descriptions with module.description.aura etc

I'm thinking we load the english translation into a hashmap, then we replace each key with the selected language if the key is available, so there's an English fallback language if it's not fully translated to the other language.

The code for that would only be like 1 for loop in kotlin, idk about java because java syntax is ew and why more verbose

I think the only hard part is initial implementation and actually replacing every single stupid string

spide-r commented 4 years ago

It's also one for loop in java, but yes kotlin good as I've come to learn.

That implementation does seem very good, better than my own idea of having each translation locale start in english and change over time.

You could always just say any person who ports over more than 100/200+ strings competently gets a code 🐒 cape.

5HT2 commented 4 years ago

Hah yea. It would be a really annoying refactor.

5HT2 commented 3 years ago

Blocked by #790