summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-10-21 15:00:29 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-02-13 18:29:00 +0100
commit8ad0a8fe28a8810308abf42dade81a5f3f0f5ef0 (patch)
tree40359b7be69365c4830ea7f6725f94d5fb1922cb
parent77bd4e34c6030cb824ea394e917d0bbbb58c7125 (diff)
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> (cherry picked from commit 4709c938dba72b69a91b584bfe34010fec9e2d43)
-rw-r--r--mkspecs/macx-clang/Info.plist.app2
-rw-r--r--mkspecs/macx-ios-clang/Info.plist.app2
-rw-r--r--mkspecs/macx-tvos-clang/Info.plist.app2
-rw-r--r--mkspecs/macx-watchos-clang/Info.plist.app2
-rw-r--r--mkspecs/macx-xcode/QtTest.plist2
5 files changed, 10 insertions, 0 deletions
diff --git a/mkspecs/macx-clang/Info.plist.app b/mkspecs/macx-clang/Info.plist.app
index 9aca41b6dd..e37d8975f8 100644
--- a/mkspecs/macx-clang/Info.plist.app
+++ b/mkspecs/macx-clang/Info.plist.app
@@ -22,5 +22,7 @@
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
+ <key>CFBundleAllowMixedLocalizations</key>
+ <true/>
</dict>
</plist>
diff --git a/mkspecs/macx-ios-clang/Info.plist.app b/mkspecs/macx-ios-clang/Info.plist.app
index 761a91b946..d9e348a0ea 100644
--- a/mkspecs/macx-ios-clang/Info.plist.app
+++ b/mkspecs/macx-ios-clang/Info.plist.app
@@ -37,5 +37,7 @@
</array>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
+ <key>CFBundleAllowMixedLocalizations</key>
+ <true/>
</dict>
</plist>
diff --git a/mkspecs/macx-tvos-clang/Info.plist.app b/mkspecs/macx-tvos-clang/Info.plist.app
index b9b67fe41e..e94aeb5b92 100644
--- a/mkspecs/macx-tvos-clang/Info.plist.app
+++ b/mkspecs/macx-tvos-clang/Info.plist.app
@@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
+ <key>CFBundleAllowMixedLocalizations</key>
+ <true/>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
diff --git a/mkspecs/macx-watchos-clang/Info.plist.app b/mkspecs/macx-watchos-clang/Info.plist.app
index 5ac0ef78a0..72c2af30b1 100644
--- a/mkspecs/macx-watchos-clang/Info.plist.app
+++ b/mkspecs/macx-watchos-clang/Info.plist.app
@@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
+ <key>CFBundleAllowMixedLocalizations</key>
+ <true/>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
diff --git a/mkspecs/macx-xcode/QtTest.plist b/mkspecs/macx-xcode/QtTest.plist
index 41dddb1a53..9ee08217ef 100644
--- a/mkspecs/macx-xcode/QtTest.plist
+++ b/mkspecs/macx-xcode/QtTest.plist
@@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
+ <key>CFBundleAllowMixedLocalizations</key>
+ <true/>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>