Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate compiled translation files correctly #799

Merged
merged 2 commits into from Jan 7, 2021

Conversation

mirabilos
Copy link
Contributor

  • restore qmake’s lrelease option
  • let the resource compiler pick up the compiled files correctly
  • remove the precompiled binaries from the repository

Tested in Debian.

A possible improvement on this is to set CONFIG += embed_translations as well and don’t add them to src/resources.qrc (but let qmake do that); we’d have to redo the part that lists the available translations in src/util.cpp:CLocale::GetAvailableTranslations() then (but given it maps all languages from xx_XX to xx except Portuguese is doubled, some more insightful algorithm might be used there anyway, or the consumers could just deal with having the countries there as well).

@mirabilos
Copy link
Contributor Author

… wait, this fails on buster (but succeeds on sid, hmm)…

@mirabilos
Copy link
Contributor Author

I think for a proper fix we must use embed_translations as well :|

@mirabilos
Copy link
Contributor Author

qmake in buster doesn’t seem to call lrelease at all‽

@mirabilos
Copy link
Contributor Author

Right, buster is missing /usr/lib/«MULTIARCH»/qt5/mkspecs/features/lrelease.prf from qt5-qmake… Qt too old, I guess…

@mirabilos
Copy link
Contributor Author

Ah right, Qt 5.12 and newer…

@corrados
Copy link
Contributor

Thanks but Jamulus should support all Qt 5 versions. How do we solve this?

@mirabilos
Copy link
Contributor Author

mirabilos commented Dec 29, 2020

Turns out one cannot simply add lrelease.prf to the buster build. I’ve been trying to track down why. I believe it is commit 97d7a00989f8d5df15eb68d90c1af547b67b3fa4 in Qt:

Author: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Date:   Wed Mar 21 18:03:10 2018 +0100

    rcc: don't drop entries with missing files in -list mode
    
    the files may not exist _yet_. this change allows dynamically generating
    the resource contents.
    
    the ignoreErrors parameter is renamed to listMode and made less
    aggressive, to better reflect the actual usage.
    
    Change-Id: I2f6a75a23f1ef903f0d957f9a09f4df0ce2a2b35
    Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
    Reviewed-by: hjk <hjk@qt.io>
    Reviewed-by: Kai Koehne <kai.koehne@qt.io>

Since this changes the C++ part of Qt itself… bad luck.

@mirabilos
Copy link
Contributor Author

mirabilos commented Dec 29, 2020

Let’s see whether this works. Let users either add CONFIG+=force-lrelease to the qmake invocation or run lrelease manually or use the precompiled versions.

Update:

Hmm, considering that CONFIG+=lrelease doesn’t do anything in Qt < 5.12, do we even need to make it conditional? I think not…

… might even be useful to require manual lrelease calling or using Qt 5.12+ from users, so we can get rid of the .qm files in the git repository as well. (Currently, I’m just excluding them from the downloaded release tarball for Debian.)

@corrados
Copy link
Contributor

corrados commented Jan 1, 2021

How is your new code supposed to work? If I clone from your repo/branch and delete the *.qm files in the translation directory, under Windows I then get compiler errors. I thought that with lrelease the *.qm files are created on every build?

@mirabilos
Copy link
Contributor Author

mirabilos commented Jan 1, 2021 via email

@corrados
Copy link
Contributor

corrados commented Jan 1, 2021

I have Qt version 5.15.2 on Windows.

@corrados
Copy link
Contributor

corrados commented Jan 6, 2021

How do we proceed with this pull request?

@mirabilos
Copy link
Contributor Author

mirabilos commented Jan 6, 2021 via email

@corrados
Copy link
Contributor

corrados commented Jan 6, 2021

If you commit this change but do NOT delete the .qm binary files for now, will it break anything?

I don't think so. To make sure I'll try that once more.

I am still a bit concerned about this change: https://github.com/corrados/jamulus/pull/799/files#diff-3b059d403dbbf0c4c127642ee3318bc2c3b10f70f929b71e2746c4a6ef907244L654. This will influence the tar.gz release of Jamulus. If someone uses a Linux distrubition with an old Qt version, the .qm files will not be created and since they are no longer distributed, he will not have them at all. What do you think?

@mirabilos
Copy link
Contributor Author

mirabilos commented Jan 6, 2021 via email

@corrados
Copy link
Contributor

corrados commented Jan 6, 2021

If you wish I can add such a commit.

Yes, please. Thanks.

@corrados
Copy link
Contributor

corrados commented Jan 6, 2021

If you commit this change but do NOT delete the .qm binary files for now, will it break anything?

I don't think so. To make sure I'll try that once more.

I just checked it without deleting the .qm files and it compiles and runs fine on my Windows.

users of older releases either must manually run…

	(cd src/res/translation && lrelease *.ts)

… before the build or use precompiled *.qm files
as discussed in jamulussoftware#799
these files need to be present in the .tar.gz distribution until
we can require every user to either have a working lrelease.prf
(Qt 5.12 and above, but seemingly not working right under Windows®
either) or to manually run lrelease before building, as is done
e.g. for the Debian backport to buster:

diff --git a/debian/rules b/debian/rules
index 7d93ed2..5234e86 100755
--- a/debian/rules
+++ b/debian/rules
@@ -45,4 +49,5 @@ endif
 	dh $@
 
 override_dh_auto_configure:
+	cd src/res/translation && lrelease *.ts
 	dh_auto_configure -- ${CONFIG_ARGS}

----

This is a separate commit from its parent so, when the time
comes, it’ll be easy to “git revert” it.
@mirabilos
Copy link
Contributor Author

mirabilos commented Jan 6, 2021 via email

@corrados
Copy link
Contributor

corrados commented Jan 7, 2021

Thank you. Do you need a official Jamulus release soon or is it enough for now to have it in the Git repo?

@corrados corrados merged commit 3b4aeca into jamulussoftware:master Jan 7, 2021
@mirabilos
Copy link
Contributor Author

mirabilos commented Jan 7, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants