mmatyas / openblok

A customizable, cross platform, open-source falling block game, packed with a bunch of features.
GNU General Public License v3.0
99 stars 15 forks source link

Add Localistion through GNU gettext #39

Closed SkoricIT closed 3 years ago

SkoricIT commented 3 years ago

This implements localization through gettext and adds an unfinished German translation file.

grafik

I think the process described in LANGUAGES.md could be streamlined with the makefile but I have no experience with that so I will leave this open.

mmatyas commented 3 years ago

Thank you! The patch looks generally fine, but I'll review it in more detail next week (and get a bit more familiar with gettext too). Yeah, seems like the build platforms are broken again, I'll have to start with fixing them first.

mmatyas commented 3 years ago

Ok, the build system should work now. If you rebase the branch to the current master, the checks should now run (though gettext is still probably not installed on the Windows one).

SkoricIT commented 3 years ago

I merged in your change but the build is unfortunately still failing.

mmatyas commented 3 years ago

So, it seems gettext is part of Linux, thus does not require any more setup, but on Windows some more CMake steps are required (see FindIntl and FindGettext). Building on Windows is always a bit complicated, but I think some parts of this patch could be merged already; I'll fix the Windows builds myself later.

For now, please:

I've also noticed some points of interest in the commits, will finish the review in a second. With the above changes, I'm happy to merge this, and I can fix the releases after that.

SkoricIT commented 3 years ago

I will make the requested changes and update the pull.

SkoricIT commented 3 years ago

I have performed the requested changes. Please be advised that localization is currently being read with a relative path (main.cpp:68 bindtextdomain ("main", "../locale");) which you might want to change to fit your CMake configuration.

mmatyas commented 3 years ago

Thanks! I'll see if I can finish the CMake part this week or the next.

SkoricIT commented 3 years ago

That would be great, thanks!

mmatyas commented 3 years ago

Ok, added gettext support through CMake, without any specific language, and tested it with some dummy translations.

To add a new translation, place it in the locale directory and add it at the top of locale/CMakeLists.txt. In this case it would be at locale/de/main.po and the CMake file should have set(LOCALES de). The build then handles generating and deploying the MO files automatically. I've also updated the POT with some default values (eg. project name).

With that, I'm closing this for now; feel free to open a new pull request for the German-specific changes!