Adding i18n resource file generation into .pro

+ Adding `lrelease` and `embed_translations` to .pro CONFIG as per [translation config](https://doc.qt.io/qt-5/qmake-variable-reference.html#translations)
- Removing `generate-qm-files` step from CI/CD
+ Adjusting "how to" comment to reflect changes
This commit is contained in:
Chris
2022-05-28 22:41:36 +10:00
parent f0895fdebf
commit a7adfe251b
4 changed files with 7 additions and 20 deletions

View File

@@ -27,9 +27,6 @@ before_script:
- export QT_SELECT=qt5 - export QT_SELECT=qt5
- export APPIMAGE_EXTRACT_AND_RUN=1 - export APPIMAGE_EXTRACT_AND_RUN=1
.generate-qm-files: &generate-qm-files
- lrelease OpenRGB.pro
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
# Linux (AppImage) 32-bit Build Target # # Linux (AppImage) 32-bit Build Target #
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
@@ -39,7 +36,6 @@ before_script:
stage: build stage: build
script: script:
- export $(dpkg-architecture) - export $(dpkg-architecture)
- *generate-qm-files
- ./scripts/build-appimage.sh - ./scripts/build-appimage.sh
artifacts: artifacts:
@@ -59,7 +55,6 @@ before_script:
stage: build stage: build
script: script:
- export $(dpkg-architecture) - export $(dpkg-architecture)
- *generate-qm-files
- ./scripts/build-appimage.sh - ./scripts/build-appimage.sh
artifacts: artifacts:
@@ -79,7 +74,6 @@ before_script:
stage: build stage: build
script: script:
- dpkg-architecture -l - dpkg-architecture -l
- *generate-qm-files
- dpkg-buildpackage --target-arch i386 -us -B - dpkg-buildpackage --target-arch i386 -us -B
- rm -v ../openrgb-dbgsym*.deb - rm -v ../openrgb-dbgsym*.deb
- mv -v ../openrgb*.deb ./ - mv -v ../openrgb*.deb ./
@@ -101,7 +95,6 @@ before_script:
stage: build stage: build
script: script:
- dpkg-architecture -l - dpkg-architecture -l
- *generate-qm-files
- dpkg-buildpackage -us -B - dpkg-buildpackage -us -B
- rm -v ../openrgb-dbgsym*.deb - rm -v ../openrgb-dbgsym*.deb
- mv -v ../openrgb*.deb ./ - mv -v ../openrgb*.deb ./
@@ -123,7 +116,6 @@ before_script:
stage: build stage: build
script: script:
- dpkg-architecture -l - dpkg-architecture -l
- *generate-qm-files
- dpkg-buildpackage --target-arch i386 -us -B - dpkg-buildpackage --target-arch i386 -us -B
- rm -v ../openrgb-dbgsym*.deb - rm -v ../openrgb-dbgsym*.deb
- mv -v ../openrgb*.deb ./ - mv -v ../openrgb*.deb ./
@@ -145,7 +137,6 @@ before_script:
stage: build stage: build
script: script:
- dpkg-architecture -l - dpkg-architecture -l
- *generate-qm-files
- dpkg-buildpackage -us -B - dpkg-buildpackage -us -B
- rm -v ../openrgb-dbgsym*.deb - rm -v ../openrgb-dbgsym*.deb
- mv -v ../openrgb*.deb ./ - mv -v ../openrgb*.deb ./
@@ -166,7 +157,7 @@ before_script:
stage: build stage: build
script: script:
- dnf install rpmdevtools dnf-plugins-core -y - dnf install rpmdevtools dnf-plugins-core -y
- rpmdev-setuptree - rpmdev-setuptree
- ls /root/ - ls /root/
- cp fedora/OpenRGB.spec /root/rpmbuild/SPECS - cp fedora/OpenRGB.spec /root/rpmbuild/SPECS
- cp ../OpenRGB /root/rpmbuild/SOURCES/ -r - cp ../OpenRGB /root/rpmbuild/SOURCES/ -r
@@ -501,7 +492,6 @@ before_script:
stage: build stage: build
script: script:
- eval $(/opt/homebrew/bin/brew shellenv) - eval $(/opt/homebrew/bin/brew shellenv)
- *generate-qm-files
- qmake OpenRGB.pro - qmake OpenRGB.pro
- make -j16 - make -j16
- macdeployqt OpenRGB.app -codesign=OpenRGB - macdeployqt OpenRGB.app -codesign=OpenRGB
@@ -524,7 +514,6 @@ before_script:
stage: build stage: build
script: script:
- eval $(/usr/local/bin/brew shellenv) - eval $(/usr/local/bin/brew shellenv)
- *generate-qm-files
- arch -x86_64 /usr/local/bin/qmake OpenRGB.pro - arch -x86_64 /usr/local/bin/qmake OpenRGB.pro
- arch -x86_64 make -j16 - arch -x86_64 make -j16
- arch -x86_64 macdeployqt OpenRGB.app -codesign=OpenRGB - arch -x86_64 macdeployqt OpenRGB.app -codesign=OpenRGB

View File

@@ -14,7 +14,9 @@ QT +=
#-----------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------#
# Set compiler to use C++17 to make std::filesystem available # # Set compiler to use C++17 to make std::filesystem available #
#-----------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------#
CONFIG += c++17 CONFIG += c++17 \
lrelease \
embed_translations \
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -1090,7 +1092,6 @@ contains(QMAKE_PLATFORM, freebsd) {
RESOURCES += \ RESOURCES += \
qt/resources.qrc \ qt/resources.qrc \
qt/languages.qrc \
TRANSLATIONS += \ TRANSLATIONS += \
qt/i18n/OpenRGB_en.ts \ qt/i18n/OpenRGB_en.ts \

View File

@@ -22,7 +22,6 @@ cp %{_sourcedir}/%{_name}/* %{_builddir} -r
%build %build
cd %{_builddir} cd %{_builddir}
/usr/bin/lrelease-qt5 OpenRGB.pro
%qmake_qt5 PREFIX=%{_prefix} "QMAKE_CXXFLAGS+=-save-temps" %qmake_qt5 PREFIX=%{_prefix} "QMAKE_CXXFLAGS+=-save-temps"
%make_build %make_build

View File

@@ -335,13 +335,11 @@ int main(int argc, char* argv[])
/*---------------------------------------------------------*\ /*---------------------------------------------------------*\
| App translation | | App translation |
| How to add a new language: | | To add a new language: |
| Create a file under qt/i18n/OpenRGB_<locale>.ts | | Create a file under qt/i18n/OpenRGB_<locale>.ts |
| Add it to TRANSLATIONS in OpenRGB.pro | | Add it to TRANSLATIONS in OpenRGB.pro |
| Run: lupdate -verbose OpenRGB.pro |
| Edit this file (manually or with | | Edit this file (manually or with |
| linguist qt/i18n/OpenRGB_en.ts qt/i18n/OpenRGB_XX.ts | | linguist qt/i18n/OpenRGB_en.ts qt/i18n/OpenRGB_XX.ts |
| Generate the .qm file: lrelease OpenRGB.pro |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
QTranslator translator; QTranslator translator;
@@ -381,7 +379,7 @@ int main(int argc, char* argv[])
} }
dlg.AddClientTab(); dlg.AddClientTab();
if(ret_flags & RET_FLAG_START_MINIMIZED) if(ret_flags & RET_FLAG_START_MINIMIZED)
{ {
#ifdef __APPLE__ #ifdef __APPLE__
@@ -393,7 +391,7 @@ int main(int argc, char* argv[])
{ {
dlg.show(); dlg.show();
} }
return a.exec(); return a.exec();
} }
else else