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
merge-requests/1223/head
Chris 6 months ago
parent f0895fdebf
commit a7adfe251b
  1. 13
      .gitlab-ci.yml
  2. 5
      OpenRGB.pro
  3. 1
      fedora/OpenRGB.spec
  4. 8
      main.cpp

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

@ -14,7 +14,9 @@ QT +=
#-----------------------------------------------------------------------------------------------#
# 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
@ -1090,7 +1092,6 @@ contains(QMAKE_PLATFORM, freebsd) {
RESOURCES += \
qt/resources.qrc \
qt/languages.qrc \
TRANSLATIONS += \
qt/i18n/OpenRGB_en.ts \

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

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

Loading…
Cancel
Save