ihhub / fheroes2

fheroes2 is a recreation of Heroes of Might and Magic II game engine.
https://ihhub.github.io/fheroes2/
GNU General Public License v2.0
2.69k stars 375 forks source link

Add support for localizations #2211

Closed Baltix closed 2 years ago

Baltix commented 3 years ago

Hi,

It seems changing interface translation language in this fheroes2 fork doesn't work - I put lang = lt into fheroes2.cfg but this doesn't change interface language to Lithuanian. I've tried with fheroes2_linux_sdl2.zip ver 0.8.3

I've compiled lt.po file with msgfmt command and copied this file to ~/.fheroes2/files/lang/lt.mo Also tried to put this file to extracted files/lang subfolder of location where I've extracted fheroes2_linux_sdl2.zip file

Lithuanian translation works fine with original fheroes2 latest SVN code from http://sourceforge.net/projects/fheroes2/

I'm attaching zipped fheroes2.cfg file fheroes2.cfg.zip, which changes interface language to Lithuanian with original fheroes2.cfg but doesn't work with your fork - line "lang = lt" is removed automatically when I start your fheroes2 fork :(

Thanks for improving such nice game :)

ihhub commented 3 years ago

Hi @Baltix ,

We rewrote the whole rendering engine which right now doesn't support any translations. This is not a priority at the moment as many things should be fixed before we could even start translating the game to another languages. Such feature could be supported closer to 1.0 release or after it.

Baltix commented 3 years ago

It's very sad to hear, that you don't have any plans for localization until 1.0 release :( Is it so hard to add an ability to use existing translations from lang folder with new rendering engine?

P.S. I think label should be "enhancement" or "localization", not "question" ;)

ihhub commented 3 years ago

Sveikas @Baltix ,

The playable game is more important than a buggy one but with localization like it was at Sourceforge. That's why our priority is to make the full game first and only then add a support of extra features. The problem with localization is that the old engine utilizes an external fonts with combination of SDL. We removed SDL from image generation completely except the part of rendering the image on screen. In this case the new engine doesn't support SDL readable fonts but needs some conversion from SDL images to fheroes2 image format. To make things right we need to generate needed alphabets instead of using external fonts to have the same look in the game as in the original.

On top of this we changed a lot of text in the game so old translation is not valid for many places.

ihhub commented 3 years ago

Also, @Baltix , would you mind to support Lithuanian language localization once it's being implemented? Most likely it'll be added after New Year.

dimag0g commented 3 years ago

I could update the translation files to match the latest sources. I will be able to proofread languages I'm reasonably comfortable with (Russian, French and German), for the rest I will just merge translation files and leave fuzzy comments untouched.

ihhub commented 3 years ago

Hi @dimag0g , internalisation of strings is currently broken so we need to fix string logic first.

dimag0g commented 3 years ago

@ihhub, the translations seem to be broken because of a single bug in crc32b: https://github.com/dimag0g/fheroes2/commit/f7f55b367eac6b8429367441e178ab73ca8319ac Because of this bug, all strings have the same hash and a single string is used everywhere as a result.

With the fix above, I have updated the .pot file in files/lang: https://github.com/dimag0g/fheroes2/commit/5f8d73452e79b0c159e3296a71a3bfbeb351ae46. I also temporarily modified the Makefile to run .po files though iconv to restrict the character set to ASCII: https://github.com/dimag0g/fheroes2/commit/46feb986a8d83a1434ad8c9913b7216dbf983e48.

The resulting .mo files work fine (though they are incomplete), and I already started to update RU/FR translations: https://github.com/dimag0g/fheroes2/commit/3bdd18afb19fb0cf03e68bfb844e2e4860cb572d

Let me know which changes you would like me to submit in a PR. And if you have any hints regarding the unicode support, I'm interested to know the details.

ihhub commented 3 years ago

Hi @dimag0g , I thought that it's broken because we don't use unicode anymore. Could you please then make a pull request?

dimag0g commented 3 years ago

I will make a PR later today. Missing unicode support is indeed a problem: all non-ASCII characters simply disappear when a string is displayed. That's why I'm doing the iconv trick for now. BTW, would you like me to submit that commit too, since it can let people test translations and can be trivially undone once unicode support is back?

ihhub commented 3 years ago

Hi @dimag0g , yes, please submit. Let's have some support than no support at all.

dimag0g commented 3 years ago

For people who are interested, here's a screenshot of fheroes2 with lang=fr side by side with a French version of HoMM2 from GoG:

homm2_fr

ihhub commented 2 years ago

I am closing this issue as in general we added a solid support of many languages and it is a well-known way how to add a new language.