qmake: Document Xcode behavior when bundling translation files

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 <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 94207621ee768ddedf0021aef99566a8ce90d22b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexandru Croitor 2022-06-13 16:19:19 +02:00 committed by Qt Cherry-pick Bot
parent 12b1ec4b30
commit 2b8938edeb
3 changed files with 46 additions and 0 deletions

View File

@ -24,6 +24,8 @@ exampledirs = snippets
tagfile = qmake.tags
macro.qtbug = "\\l{https://bugreports.qt.io/browse/\1}{\1}"
depends += \
activeqt \
qt3d \

View File

@ -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]

View File

@ -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.