Experimenting in the directory where 'make install' installed freeciv, before it was packaged to the installer; localization works for freeciv-server, freeciv-manual, and freeciv-ruleup, i.e., in programs that don't have gui at all. It does not work for the client or modpack installer, not even when run with '--help' -parameter that prints to terminal (and does not launch gui at all)
On a build with --enable-fcmp=gtk3,cli , localization works for cli modpack installer, does not work for gtk3 one. I then experimented by copying mpcli.c over mpgui_gtk3.c. From that build also "gtk3" modpack installer worked -> the problem is not in the different compiler commandline parameters (including list of libraries to link against).
Futher experimenting by adding original mpgui_gtk3.c code back to see when it breaks, it seems to be that adding any gtk function call anywhere (i.e. there's no need for the function to get called before there should be translated text coming out) breaks it. I think the only explanation for that is that code being dependant on gtk causes linking stage to actually link gtk3 (and its dependencies!) in, and then the problem is caused by some global initialization in those libraries.
Qt-client and ruledit are an interesting pair. Qt-client suffers from the problem, but ruledit does not.
We've always known that using relative path for the locale path is a bad thing, but that has been something that we've had to do in Windows as it's not know at the build time where the user will install freeciv. (from autools pov we do sane 'make install', but then files are copied from that installation location to somewhere else and expected to work there)
To see if that was now causing the trouble, I did a simple test of hardcoding get_locale_dir() to return the absolute path to the location where I have the translations - and they started to work.
Still don't know what exactly why linking against gtk causes such a change in behavior - I had already confirmed that getcwd() gave expected directory in every phase of the translation setup and test.
I'm targeting this fix to S3_1 at this time. It's not needed in S3_0 yet, and it's going to be somewhat risky change. It's likely that we have to backport this to S3_0 during its lifetime, though.
- S3_0 version attached. It's dependency also to #43921, so need to go in soon.
This does not affect the fact that review period for S3_1 & master patch has already passed.
master & S3_1 pushed, S3_0 still in review.
Fix for #44070 need to be rolled in to the S3_0 patch.
- New S3_0 version with unistd.h include fix included
S3_1 on a msys2 environment I'm testing (i.e. not current official environment 211115, but unreleased 220220), with minimal freeciv patch to take that environment to use: gtk3.22- and qt-clients show English text even when Finnish should be used. However, most(?) strings coming from the server that the very client has forked, are in Finnish. sdl2-client correctly shows translations.
I'll try to make a build with the 211115 msys2 environment soon (tomorrow?) to make sure that this is not a regression in the environment. That's important to know so we can either go forward with the environment update or not.