Commit Graph

5 Commits

Author SHA1 Message Date
Tor Arne Vestbø
4709c938db Apple: Add CFBundleAllowMixedLocalizations=YES to Info.plist files
We currently don't have any machinery for qmake or CMake to map
translations declared via TRANSLATIONS += or qt_add_translations
to the Info.plist CFBundleLocalizations key.

This results in macOS and iOS falling back to the development region,
CFBundleDevelopmentRegion, as the only supported localization of the
app, which is in most cases set to 'en'.

Unfortunately this doesn't work well with the behavior of iOS 11+
and macOS 10.13+ where the OS will set the locale of the app to
the best match between the app's supported localizations and the
user's preferred language.

https://developer.apple.com/library/archive/qa/qa1828/

Since we only support a single localization, the development region,
the locale always ends up as 'en_<REGION>', which after QTBUG-104930
is also reflected in the QLocale's uiLanguages(), resulting in the
QTranslator machinery always picking English translation for the app.

As long as we don't explicitly declare CFBundleLocalizations we need
to opt out of the system's behavior of finding the best match between
the app's declared localizations and the user's preferences, which we
can do via the CFBundleAllowMixedLocalizations key.

Fixes: QTBUG-63324
Pick-to: 6.4
Change-Id: If7586d342148cbbb1d2a152cef039aad4448b13c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-10-25 10:06:59 +00:00
Alexandru Croitor
c81da821c4 CMake: Remove NSHumanReadableCopyright from iOS Info.plist
The key only applies to macOS bundles. Also, qmake doesn't have it.

Pick-to: 6.4
Task-number: QTBUG-95838
Change-Id: I438f0079cc7b74672dfbe956769138a8bb006669
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-25 17:28:15 +02:00
Alexandru Croitor
f16c7e15a2 CMake: Default CFBundleDevelopmentRegion to $(DEVELOPMENT_LANGUAGE)
That's what new projects in Xcode set.

Pick-to: 6.4
Task-number: QTBUG-95838
Change-Id: Id07dca0f56c8849a93085c5d36910679e45381b4
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-25 17:28:15 +02:00
Alexandru Croitor
c0bb65ec02 CMake: Replace tabs with spaces in iOS Info.plist template
Change-Id: Ied8f31a22c14688fd250955bb54f161f07bea90b
Pick-to: 6.4
Task-number: QTBUG-95838
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-25 17:28:15 +02:00
Alexandru Croitor
578f4ba00c CMake: Add per-target support for iOS launch screens
To support per-target iOS launch screens we need a way to specify
custom Info.plist entries without using cache variables, which we were
forced to use due to the implicit configure_file done for
MACOSX_BUNDLE_INFO_PLIST.

We now introduce an extra configure_file call done in a finalizer,
before we hand off the Info.plist file to MACOSX_BUNDLE_INFO_PLIST.

This extra configure_file call allows us to insert / substitute
additional Info.plist entries that CMake does not allow setting.

If a custom Info.plist file is provided, the finalizer will simply
skip the logic for creating a new one.

Amends e5b3436255

Pick-to: 6.4
Fixes: QTBUG-101064
Change-Id: I65496da146c9430a949a8163817021d54da28386
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-27 16:24:10 +02:00