Commit Graph

12 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
Tor Arne Vestbø
d84ddf5905 Apple: Use 'en' instead of 'English' as development region
This is consistent with what $(DEVELOPMENT_LANGUAGE) reports, as well as
the Apple Locales Programming Guide which states that "Locale names such
as “English”, “French”, and “Japanese” are deprecated in OS X and are
supported solely for backward compatibility."

Pick-to: 6.4
Change-Id: I99779d678ef9d4ea90249572f2f977e9b4df6c62
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-10-23 17:36:46 +02:00
Tor Arne Vestbø
d4b0e0d02e qmake: Add CFBundleDevelopmentRegion to the macOS Info.plist
Aligns with what our CMake Info.plist has for macOS, what we do for
both qmake and CMake on iOS, and what Xcode generates for new projects.

The value is hard-coded to English instead of using $(DEVELOPMENT_LANGUAGE)
as the file will be used by both the Makefile and Xcode generator, and
only the latter does variable replacements for $(FOO).

Task-number: QTBUG-63324
Pick-to: 6.4
Change-Id: I87e1cb14b14a9746b3603016c2ac69c252d37ff6
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-10-20 14:21:32 +02:00
Tor Arne Vestbø
0768a28fbf Remove CFBundleGetInfoString from Info.plist templates
Is't been deprecated since Mac OS X 10.5.

Task-number: QTBUG-74872
Change-Id: I8b1ad7aca6448883cb164fd0c4b329592ca60548
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-04 13:09:34 +00:00
Jake Petroules
0749ba2c5e Rewrite the Info.plist variable replacement handling
This ensures that the same set of variables can be successfully replaced
in both the Makefile and Xcode generators. It also switches the default
templates to use the Xcode-style ${var} syntax instead of the @var@
syntax for better Info.plist compatibility across generators.

Change-Id: Iff330bafd152773aafac9143c4a34e34f92f0ce6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-01-06 19:46:00 +00:00
Jake Petroules
38bfe7a279 Add NSSupportsAutomaticGraphicsSwitching key to Info.plist app templates
This will allow Qt Quick applications to use the integrated GPU on
compatible Apple hardware, which helps preserve battery life.

Change-Id: I9224bd408930e2ed3dd8a022432512e78d69c195
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-08-08 21:42:00 +00:00
Jake Petroules
3ec3f2a5da Sort keys in Info.plist templates
This makes editing the templates easier since they can be read
alphabetically.

Change-Id: I6af5e4f13718ba1145c2dec1f8a05bc600ea937a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-08-08 21:41:55 +00:00
Tor Arne Vestbø
f9a8cf99bc qmake: Pick up default bundle prefix from Xcode preferences
But still fall back to 'com.yourcompany', just like Xcode does for the
initial launch.

Change-Id: I89afadefafc254a0014aca197741d42a0199943e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-10-31 12:33:55 +01:00
Jake Petroules
e440b35bb3 Update Info.plist templates to use the current standard plist format.
Change the version number to 1.0, and use the public doctype.

Change-Id: I9b071c80c410c31c38813c4447edd7b186226fab
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-08-02 05:42:37 +02:00
Morten Sorvig
ee0dbed4db Enable HiDPI mode for retina displays.
Change-Id: I3b62ec9c3bf5e53c6ec056b95c52cfeb6ce5b61f
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2012-10-23 12:43:24 +02:00
Morten Sorvig
53d0829aa1 Fix indentation.
Change-Id: I0e53df9e1903c8cdc79d50c16cfe7f90ae6e1d6f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-09-04 10:30:33 +02:00
Tor Arne Vestbø
75583bd605 Move Clang mkspec for Mac OS X out of unsupported
The plan is to make it the default mkspec for Qt 5 on Mac OS X.

Change-Id: I49cf619a06fd7155dfbddc377558327b4be09cef
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-01-23 14:47:10 +01:00