diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-10-21 15:00:29 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-11-04 09:09:57 +0000 |
commit | c3fd2da7fbbc71e2a1f902d2386fbf95de165d39 (patch) | |
tree | 8a2140ae7bd804a06120398d1ce8485b78baf680 /cmake | |
parent | 74f8266e338f69d1220433c8c92e9db19a1a91af (diff) | |
download | qtbase-c3fd2da7fbbc71e2a1f902d2386fbf95de165d39.tar.gz |
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
Change-Id: If7586d342148cbbb1d2a152cef039aad4448b13c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 4709c938dba72b69a91b584bfe34010fec9e2d43)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/ios/Info.plist.app.in | 2 | ||||
-rw-r--r-- | cmake/macos/MacOSXBundleInfo.plist.in | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/cmake/ios/Info.plist.app.in b/cmake/ios/Info.plist.app.in index abaf3418db..2f13828213 100644 --- a/cmake/ios/Info.plist.app.in +++ b/cmake/ios/Info.plist.app.in @@ -31,6 +31,8 @@ <key>CFBundleDevelopmentRegion</key> <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleAllowMixedLocalizations</key> + <true/> <key>LSRequiresIPhoneOS</key> <true/> diff --git a/cmake/macos/MacOSXBundleInfo.plist.in b/cmake/macos/MacOSXBundleInfo.plist.in index 75de15ab50..c791521655 100644 --- a/cmake/macos/MacOSXBundleInfo.plist.in +++ b/cmake/macos/MacOSXBundleInfo.plist.in @@ -30,6 +30,8 @@ <key>CFBundleDevelopmentRegion</key> <string>en</string> + <key>CFBundleAllowMixedLocalizations</key> + <true/> <key>NSPrincipalClass</key> <string>NSApplication</string> |