yairm210 / Unciv

Open-source Android/Desktop remake of Civ V
Mozilla Public License 2.0
8.53k stars 1.58k forks source link

How to add a translation file to a module #6483

Closed ghost closed 2 years ago

SomeTroglodyte commented 2 years ago

Do you mean "mod"? Add one or more .properties file(s) in /jsons/translations.

If you can run desktop with the mod installed, then provide at least one valid translation of something that is present in your mod or the base game in that file. The file can be empty otherwise. Now run Unciv and use options-advanced-"Generate translation files". Reload your translation file and it will have added all the necessary "requires translation" entries specific to your mod (I repeat, works only if there's at least one valid entry already there). AFAIK you can also override base game translations, but those won't be output by the "Generate translation files" tool.

If you're modding on Android only - don't. That said, it's not impossible, just make do without the described tool and add everything yourself, test, rinse, repeat. Be aware that the game does not read changed files from disk if it doesn't need to, so on Droid you could either edit locally and force-stop to ensure changes are read, or edit on a github repo and re-install from there, or...

Adding new languages in a mod is not supported (because the completionPercentages.properties file determines which languages Unciv deems as known, and I'm not saying impossible as one could manipulate their GameSettings.json).

Remember, exact case is important both in translations left of the "=" and file names.

That said, such a mod-translation-specific description seems to be missing from our wiki, sorry.

heipizhu4 commented 2 years ago

Here are some mods which are light and are compartively easier to make your first translation. They were all translated by someone else (like me) so you can copy other's translation template.

  1. @paontv 's Difficulty_Sandbox https://github.com/paontv/Difficulty_Sandbox/tree/master/jsons/translations
  2. @SpacedOutChicken 's The Undead https://github.com/SpacedOutChicken/The-Undead/tree/master/jsons/translations
SomeTroglodyte commented 2 years ago

You don't need a template if you run the generator, just one line with a translation that isn't thrown out right away (e.g. because it's unused or is empty on the right side). Say you have a new nation in your mod named "The Borg". You create the translations folder, create an empty file named, say, "Hungarian.properties", add "The Borg = The Borg" to that, run Unciv and run the translation generator from options. Reload the new file, bingo all what Unciv would like to see is there. Only languages present in the main completionpercentages will work.

yairm210 commented 2 years ago

Solved, and please don't use Github Issues to ask questions, that's what the Discord is for :)