Translating the mod - Skirlez/fabricated-exchange GitHub Wiki

Translation should be the same as any other mod. Except...

To make the translation file look much nicer, I have come up with this system, which other modders will likely find stupid or dislike:

If there's a key with a really long value, say:

"key": "value_1, value_something, value_three, value_4..."

or

"key": "value_1\nvalue_something\nvalue_three\nvalue_4..."

Often, it will be split like this:

"key_1": "value_1",
"key_2": "value_something",
"key_3": "value_three",
"key_4": "value_4",

For example: here's the translation key and value for the /fe help command from en_us.json before this was implemented:

"commands.fabricated-exchange.help": "/fe set (seed/custom) <number> - Set the currently held item's seed or custom EMC value\n/fe remove (seed/custom) - Remove the currently held item's seed or custom EMC value\n/fe recipe (ban/pardon) <recipe> - Ban/Unban a recipe from being considered by the EMC mapper\n/fe reload - Reload all config files and regenerate all EMC values using the the EMC mapper\n/fe reset <datafile> - Resets a datafile to its default state\n/fe help - I don't know what this one does\n",

Hideous!

and here it is now, as of 0.5.5:

"commands.fabricated-exchange.help_1": "/fe set (seed/custom) <number> - Set the currently held item's seed or custom EMC value",
"commands.fabricated-exchange.help_2": "/fe remove (seed/custom) - Remove the currently held item's seed or custom EMC value",
"commands.fabricated-exchange.help_3": "/fe recipe (ban/pardon) <recipe> - Ban/Unban a recipe from being considered by the EMC mapper",
"commands.fabricated-exchange.help_4": "/fe reload - Reload all config files and regenerate all EMC values using the the EMC mapper",
"commands.fabricated-exchange.help_5": "/fe reset <datafile> - Resets a datafile to its default state",
"commands.fabricated-exchange.help_6": "/fe printmissing - Prints to the chat all the items without an EMC value.",
"commands.fabricated-exchange.help_7": "/fe help - I don't know what this one does",

Now adding another entry won't make the catastrophically big string bigger, like it was before, and the file stays nice and readable.

For another example: Keys that I suspect will go off screen in other languages due to their length might be set up like this:

"screen.fabricated-exchange.settings.client_warning_1": "Warning! You are adjusting your client's own config, not the current server's!",

Not only does this keep the file nice in case they would need to add a new line, but in this context it happens that the text widget responsible for rendering this key's value does not work with the newline character ('\n') at all, so you couldn't make this line go downwards in other languages if you tried.

This system allows Fabricated Exchange to easily and cleanly create more text widgets below for new lines, for this specific key if the language needs it. (Otherwise it would've had to manually check for occurrences of '\n' and split the text, so you'd get an ugly file and annoying code)


So if you see keys like in the examples in the translation files, know that you can remove or add as many entries as you'd like.

github.fabricated-exchange.note_1: You can't just start doing this to any old key. Every time a set of keys like this is used, It is addressed inside the code. So if you split one of the keys in your language file to be like this, it just will not be found.

github.fabricated-exchange.note_2: I will happily merge any translation through a pull request, of course.

⚠️ **GitHub.com Fallback** ⚠️