Localization not working on OBS?

When I compile my app on QT Creator to one of the build targets everything works fine and the result is a rpm that loads on a device the right localized language version (i test that with German).
If I compile my package on OBS, e. g. for CHUM, and install then from CHUM GUI or with zipper, the app loads in the English localization. Same when I download the rpm from OBS and install it manually. However, the localization from the Qt side seems to be recognized as German, as texts that I fetch from a remote source are fetched in the correctly localized version.
Any Idea what I’m doing wrong there?

Check the build logs on OBS. It should show failure to run lrelease which results in the l10n files (.qm) not being built and not packaged.

If that is the case you must add a build dep on qt5-qttools-linguist to your .spec.

1 Like

Oh, indeed, that seems to be the problem. Do I have to write that to the (auto generated?) .spec directly, or could I also write something like - qt5-qttools-linguist in the PkgConfigBR: section of the yaml-file?
(If i write exactly that, SailfishSDKs qmake is not happy as it sais: No provider of 'pkgconfig(qt5-qttools-linguist)' found.)
I would be most happy, if I could still compile from SailfishSDK for harbour and on OBS for CHUM with the same code.

Obviously.
However, the .spec file is really missing its build dep, which shows in the failure of the (very minimal) build environment on OBS. The fact that it works in qtcreator/SailfishSDK is because that environment happens to include the linguist tools, despite the .spec file being incomplete…

So after adding the correct dep it will work on both, satisfying your requirement.

For a .yaml file, use

PkgBR:
  - qt5-qttools-linguist

so not PkgConfigBR

For a .spec file that would be

BuildRequires: qt5-qttools-linguist
# or possibly this would work, although it's not exactly the correct requirement:
#BuildRequires: cmake(Qt5LinguistTools)
2 Likes

Indeed, that is working! Thanks, @nephros, for your help!

I wonder if it’s wise, but I’ve been doing this:

%if "%{?vendor}" == "chum"
BuildRequires: qt5-qttools-linguist
%endif

?

Works, but why wrap in that conditional.

If you need it , it is a real build time dep and should be specified as such.

Otherwise the build will fail in the next build environment that is not the SDK or chum (like GH actions or some users private build environment).
I think this will even fail on OBS if the project is not sailfishos:chum or sailfishos:chum:testing (like a user home project) because AFAIK the vendor is not set everywhere, but I haven’t checked.

This is true. I introduced the conditional to ensure that building from the sdk (I’ve had some issues before) is not influenced.

I’ll test and switch tactics. Thanks!