vcmi / vcmi

Open-source engine for Heroes of Might and Magic III
https://vcmi.eu/
GNU General Public License v2.0
4.52k stars 489 forks source link

Translations support #1300

Open IvanSavenko opened 1 year ago

IvanSavenko commented 1 year ago

Meta-issue to organize progress, will be done in series of PR to avoid large amount of changes at once

Progress

Documentation https://github.com/vcmi/vcmi/wiki/Translations

Functionality:

Languages:

Translation assistance If there is anyone willing to provide missing/new translation ask me here or on Slack. What I will need is following:

heroesiiifan commented 1 year ago

Hi @IvanSavenko

First of all, thank you for your effort of a better language support.

For german-translation I have a few questions:

IvanSavenko commented 1 year ago

Hi.

how is it thought in the future with the translate.json?

Current plan - is to have translate.json for all languages in vcmi repo, specifically - as part of integrated "vcmi" mod. Since I am planning to add support for translation of mods, it makes sense to reuse this functionality and integrate translation of vcmi strings into vcmi mod and have them auto-selected based on language selected by user/autodetected by game.

(Yes, format of translate.json was changed in recent PR, so it won't load as it. I already have fixed version for German and few other languages, but have not uploaded it anywhere yet)

What about the bonuses_texts.json? Doesn't it need to be replaced as well?

Yes, eventually. I still have quite long list of things to do for translations. Current plan is to merge its content into translate.json (and any other stray untranslated strings we have in vcmi) I see this file in your mod, so will integrate it into translation once I get to this part.

In my case I would leave the translated TXT as they are, they should still load without problems (regardless of the new option), right?

Yes, they can load without problems. In fact, with #1399 game will also automatically detect German install (whether in form of your mod or some custom H3 install).

Whether you switch to this "new option" is up to you. Generally speaking, conversion should be trivial. VCMI will be able to generate json output of loaded text which you can copy-paste into a mod.

Main reasoning behind this option was:

Can we make it so that when you select "German" in the launcher the translation mod is automatically installed? Or how should we do it for cases without official translation?

Yes, I am considering this. Although not fully automatic. My current plan is to have user select desired language of vcmi itself (e.g. for Launcher) and, if language of detected H3 install is different - provide option to install translation mod in one click, without search through repository.

heroesiiifan commented 1 year ago

I've tested the Mod-Translation.

Seems to work without problems: https://github.com/vcmi-mods/cathedral-town/pull/1

IvanSavenko commented 1 year ago

Not exactly fully supported yet - I'd like to have some "validation", that will automatically report strings to translate. Still, great to see its first usage. Glad that it works. Haven't tested much apart from UI texts.

heroesiiifan commented 1 year ago

Hi @IvanSavenko: I've brought the german translation up to date.

I have created a vcmi-1.2 branch. Is there actually a way that the mod manager in the development build uses this one and not on the master?

Otherwise I still have a few questions:

IvanSavenko commented 1 year ago

Hi @heroesiiifan . I think we're using this file for mods that require daily builds version: https://github.com/vcmi/vcmi-mods-repository/blob/develop/beta.json Once you have your mod in there you can add this URL as second mod repository in settings.

As for your questions:

And by the way - please add "language" : "german" into your mod.json. This field will be used to detect translations and as a way to detect encoding of h3m/h3c/txt/fnt files (this part not applicable to German though - looks like English & German use same encoding anyway)

heroesiiifan commented 1 year ago

Hi @IvanSavenko

* H3M support itself is done, but yeah, no way to export without modifying source code. Will add h3m export to `convert txt`
* H3C - untested. Strictly speaking - it may work since h3c is largely collection of h3m maps, but not something I tested yet and so far no way to generate translations using existing h3c files.

Would be really nice if we could export these too.

Yes, the H3C are essentially H3M. Except that there is an additional campaign description and name.

And by the way - please add "language" : "german" into your mod.json. This field will be used to detect translations and as a way to detect encoding of h3m/h3c/txt/fnt files (this part not applicable to German though - looks like English & German use same encoding anyway)

done :)

IvanSavenko commented 1 year ago

Would be really nice if we could export these too.

Yep, planned, worst-case scenario - will be done for 1.2.1

All in all my TODO list so far is:

More long-term TODO's, potentially for 1.3:

tytannial commented 1 year ago

Hi, is there any plan to make a converter or importer for game locale file, which imports the txt/map files, and encode them with utf8. Also provide an option using utf8 as game encoding.

kambala-decapitator commented 1 year ago

user reported issue with Russian language in 1.2.1/1.3: https://forum.vcmi.eu/t/russian-thread/357/837?u=kambala (check also the full conversation)

IvanSavenko commented 1 year ago

@kambala-decapitator Not sure what's going on there...

According to your log - he has English text files - pretty much exact match. Not Chinese or Russian. Logs should say something like "Comparing to Engilsh: 0.0002" - value closest to 0 is the one that is detected.

However it is possible that his H3 copy has different files layout that vcmi is not aware of and because of that localized text files were not found. For example in English version .txt files are in 'H3bitmap.lod' but in Polish they are in 'h3abp_bm.lod', which vcmi was ignoring before fix.

heroesiiifan commented 1 year ago

Another small addition for the todo: Support VCMP Campaign format

Even if I don't know if this is already actively in use.

heroesiiifan commented 11 months ago

Maybe also add moat names to english.json instead of moats.json. To able to do a clear translation.