diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-09-10 02:35:52 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-09-10 17:57:28 -0400 |
commit | ad3bf77ff0f599594b417da8d437501c44410987 (patch) | |
tree | 4c57ba7cb02df7c93fc8ed761a5c64070f71ff01 /test cases/frameworks | |
parent | d2bf77342eb1b7bcd77148c79581fe2b85889ddd (diff) | |
download | meson-ad3bf77ff0f599594b417da8d437501c44410987.zip meson-ad3bf77ff0f599594b417da8d437501c44410987.tar.gz meson-ad3bf77ff0f599594b417da8d437501c44410987.tar.bz2 |
add test case for qrc translations
Diffstat (limited to 'test cases/frameworks')
-rw-r--r-- | test cases/frameworks/4 qt/main.cpp | 9 | ||||
-rw-r--r-- | test cases/frameworks/4 qt/meson.build | 6 | ||||
-rw-r--r-- | test cases/frameworks/4 qt/qt4_lang.qrc | 6 | ||||
-rw-r--r-- | test cases/frameworks/4 qt/qt4embedded_fr.ts | 12 | ||||
-rw-r--r-- | test cases/frameworks/4 qt/qt5_lang.qrc | 6 | ||||
-rw-r--r-- | test cases/frameworks/4 qt/qt5embedded_fr.ts | 12 |
6 files changed, 51 insertions, 0 deletions
diff --git a/test cases/frameworks/4 qt/main.cpp b/test cases/frameworks/4 qt/main.cpp index de00b15..3c141b9 100644 --- a/test cases/frameworks/4 qt/main.cpp +++ b/test cases/frameworks/4 qt/main.cpp @@ -1,4 +1,6 @@ #include <QApplication> +#include <QTranslator> +#include <QDebug> #include "mainWindow.h" #if QT_VERSION > 0x050000 @@ -16,6 +18,13 @@ int main(int argc, char **argv) { Q_INIT_RESOURCE(stuff2); #endif QApplication app(argc, argv); + + auto *translator = new QTranslator; + if (translator->load(QLocale(), QT "embedded", "_", ":/lang")) + qApp->installTranslator(translator); + + qDebug() << QObject::tr("Translate me!"); + MainWindow *win = new MainWindow(); QImage qi(":/thing.png"); if(qi.width() != 640) { diff --git a/test cases/frameworks/4 qt/meson.build b/test cases/frameworks/4 qt/meson.build index 2ec5825..1630593 100644 --- a/test cases/frameworks/4 qt/meson.build +++ b/test cases/frameworks/4 qt/meson.build @@ -81,10 +81,16 @@ foreach qt : ['qt4', 'qt5', 'qt6'] # qt4-rcc and qt5-rcc take different arguments, for example qt4: ['-compress', '3']; qt5: '--compress=3' qtmodule.preprocess(qt + 'testrccarg', qresources : files(['stuff.qrc', 'stuff2.qrc']), rcc_extra_arguments : '--compress=3', method : get_option('method')) + translations_cpp = qtmodule.compile_translations(qresource: qt+'_lang.qrc') + # unity builds suck and definitely cannot handle two qrc embeds in one compilation unit + unityproof_translations = static_library('unityproof_translations', translations_cpp) + + extra_cpp_args += '-DQT="@0@"'.format(qt) qexe = executable(qt + 'app', sources : ['main.cpp', 'mainWindow.cpp', # Sources that don't need preprocessing. prep, prep_rcc], dependencies : qtdep, + link_with: unityproof_translations, cpp_args: extra_cpp_args, gui_app : true) diff --git a/test cases/frameworks/4 qt/qt4_lang.qrc b/test cases/frameworks/4 qt/qt4_lang.qrc new file mode 100644 index 0000000..a6d2b54 --- /dev/null +++ b/test cases/frameworks/4 qt/qt4_lang.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/lang"> + <file>qt4embedded_fr.qm</file> + </qresource> +</RCC> + diff --git a/test cases/frameworks/4 qt/qt4embedded_fr.ts b/test cases/frameworks/4 qt/qt4embedded_fr.ts new file mode 100644 index 0000000..0638bd5 --- /dev/null +++ b/test cases/frameworks/4 qt/qt4embedded_fr.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="fr_FR"> +<context> + <name>QObject</name> + <message> + <location filename="q5core.cpp" line="23"/> + <source>Translate me!</source> + <translation>Traduisez moi!</translation> + </message> +</context> +</TS> diff --git a/test cases/frameworks/4 qt/qt5_lang.qrc b/test cases/frameworks/4 qt/qt5_lang.qrc new file mode 100644 index 0000000..cf4ddc6 --- /dev/null +++ b/test cases/frameworks/4 qt/qt5_lang.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/lang"> + <file>qt5embedded_fr.qm</file> + </qresource> +</RCC> + diff --git a/test cases/frameworks/4 qt/qt5embedded_fr.ts b/test cases/frameworks/4 qt/qt5embedded_fr.ts new file mode 100644 index 0000000..4e3116b --- /dev/null +++ b/test cases/frameworks/4 qt/qt5embedded_fr.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="fr_FR"> +<context> + <name>QObject</name> + <message> + <location filename="q5core.cpp" line="23"/> + <source>Translate me!</source> + <translation>Traduisez moi!</translation> + </message> +</context> +</TS> |