From 2b8938edeb59bf7b37ba6e2d702c6877d15f4b99 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 13 Jun 2022 16:19:19 +0200 Subject: [PATCH] qmake: Document Xcode behavior when bundling translation files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Xcode's legacy and new build system modes have different behavior in how they bundle resource paths that start with lang_code.lproj. Document how to bundle translation files for both legacy and new build systems. Fixes: QTBUG-98417 Change-Id: I857ec76577f8244a751d4bf38fbe305fef614734 Reviewed-by: Alexey Edelev Reviewed-by: Jörg Bornemann Reviewed-by: Kai Koehne (cherry picked from commit 94207621ee768ddedf0021aef99566a8ce90d22b) Reviewed-by: Qt Cherry-pick Bot --- qmake/doc/qmake.qdocconf | 2 ++ .../snippets/code/doc_src_qmake-manual.pro | 17 ++++++++++++ qmake/doc/src/qmake-manual.qdoc | 27 +++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/qmake/doc/qmake.qdocconf b/qmake/doc/qmake.qdocconf index f3e5c1920a2..f0ab617801d 100644 --- a/qmake/doc/qmake.qdocconf +++ b/qmake/doc/qmake.qdocconf @@ -24,6 +24,8 @@ exampledirs = snippets tagfile = qmake.tags +macro.qtbug = "\\l{https://bugreports.qt.io/browse/\1}{\1}" + depends += \ activeqt \ qt3d \ diff --git a/qmake/doc/snippets/code/doc_src_qmake-manual.pro b/qmake/doc/snippets/code/doc_src_qmake-manual.pro index e82799c5bff..76f0eec2fec 100644 --- a/qmake/doc/snippets/code/doc_src_qmake-manual.pro +++ b/qmake/doc/snippets/code/doc_src_qmake-manual.pro @@ -944,3 +944,20 @@ win32-g++:contains(QMAKE_HOST.arch, x86_64):{ ... } #! [187] + +#! [188] +translations_en.files = $$PWD/en.lproj/InfoPlist.strings +translations_en.path = en.lproj +QMAKE_BUNDLE_DATA += translations_en +#! [188] + +#! [189] +# Approach 1 +translations_en.files = $$PWD/InfoPlist.strings +translations_en.path = en.lproj + +# Approach 2 +translations_de.files = $$PWD/de.lproj/InfoPlist.strings + +QMAKE_BUNDLE_DATA += translations_en translations_de +#! [189] diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index a8002d816e0..6255e0e451e 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -1876,6 +1876,33 @@ See \l{Platform Notes#Creating Frameworks}{Platform Notes} for more information about creating library bundles. + A project can also use this variable to bundle application translation + files. The exact syntax depends on whether the project is using Xcode's + legacy build system or its new build system. + + For example when the following project snippet is built using the + legacy build system: + + \snippet code/doc_src_qmake-manual.pro 188 + + Xcode will ignore the original location of \c InfoPlist.strings + and the file will placed into the bundle \c Resources directory + under the provided \c translations_en.path path, so + \c Resources/en.lproj/InfoPlist.strings + + With the new build system, the relative location of the file is + preserved, which means the file will incorrectly be placed under + \c Resources/en.lproj/en.lproj/InfoPlist.strings + + To ensure correct file placement, the project can either move + the original file not to be in a sub-directory or it can choose + not to specify the \c translations_en.path variable. + + \snippet code/doc_src_qmake-manual.pro 189 + + See \qtbug QTBUG-98417 for more details on how the Xcode build + system changed its behavior in bundling translation files. + \section1 QMAKE_BUNDLE_EXTENSION \note This variable is used on \macos, iOS, tvOS, and watchOS only.