From 1de1cc22e2fcc56860ee8174e375070c062f5b30 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 15 Jun 2020 17:25:07 -0400 Subject: qt module: add qresource support to compile_translations A common pattern in Qt5 applications is to embed translations in the executable using the qresource system. In this case, the list of translation files is already available in the .qrc file and there's no good reason to duplicate this info in meson.build. Let compile_translations optionally take a qrc input, in which case it will go straight to generating the relevant translations and rcc-generated .cpp, and directly return the thing users actually care about -- the .cpp for linking. --- .../snippets/qt_compile_translations_from_qrc.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docs/markdown/snippets/qt_compile_translations_from_qrc.md (limited to 'docs/markdown/snippets') diff --git a/docs/markdown/snippets/qt_compile_translations_from_qrc.md b/docs/markdown/snippets/qt_compile_translations_from_qrc.md new file mode 100644 index 0000000..bfa8619 --- /dev/null +++ b/docs/markdown/snippets/qt_compile_translations_from_qrc.md @@ -0,0 +1,19 @@ +## Qt5 compile_translations now supports qresource preprocessing + +When using qtmod.preprocess() in combination with qtmod.compile_translations() +to embed translations using rcc, it is no longer required to do this: + +```meson +ts_files = ['list', 'of', 'files'] +qtmod.compile_translations(ts_files) +# lang.qrc also contains the duplicated list of files +lang_cpp = qtmod.preprocess(qresources: 'lang.qrc') +``` + +Instead, use: +```meson +lang_cpp = qtmod.compile_translations(qresource: 'lang.qrc') +``` + +which will automatically detect and generate the needed compile_translations +targets. -- cgit v1.1