diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2011-03-09 11:34:25 (GMT) |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2011-03-09 13:52:56 (GMT) |
commit | d4250d9e1d4ed23e0cf41e6ce35d9dda6323455c (patch) | |
tree | 35f25380afa3adeddf9aceff0da470b39fec623d /mkspecs/features/symbian | |
parent | 796b084fbaaeeacbb6af7b3a2d132b5900c3db62 (diff) | |
download | Qt-d4250d9e1d4ed23e0cf41e6ce35d9dda6323455c.zip Qt-d4250d9e1d4ed23e0cf41e6ce35d9dda6323455c.tar.gz Qt-d4250d9e1d4ed23e0cf41e6ce35d9dda6323455c.tar.bz2 |
Implement language fallback logic for localize_deployment
When querying system locale it does return both language and country,
so sometimes users want to have both in their .ts file names
(e.g. myapp_zh_CN.ts). This is bit problematic in Symbian, where
there are separate language codes for only very few language +
country combinations. Until now, the unsupported combinations were
simply dropped from deployment localization.
More proper way to handle these unknown language + country combinations
is to fall back to using the plain language code for them instead of
dropping them altogether. This is somewhat analogous to how
QTranslator::load() loads .ts files if it can't find the file for
specified language + country combination.
E.g. User defines:
TRANSLATIONS += myapp_zh_CN.ts myapp_zh_HK.ts myapp_zh_TW.ts
There are separate Symbian language codes for HongKong Chinese
(zh_HK = 30) and Taiwanese Chinese (zh_TW = 29), but rest of the world
is expected to use just Chinese (zh = 31). This means "zh_CN" mapping
is not provided as it would be same as plain "zh".
With this fix, qmake will now automatically generate a fallback
mapping from "zh_CN" to "31" for deployment localization purposes, and
is able to read application captions and pkg names from myapp_zh_CN.ts.
If there are multiple TRANSLATIONS defined that would result in same
Symbian language code, only the first one is used.
Task-number: QTBUG-17927
Reviewed-by: Oswald Buddenhagen
Diffstat (limited to 'mkspecs/features/symbian')
-rw-r--r-- | mkspecs/features/symbian/localize_deployment.prf | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mkspecs/features/symbian/localize_deployment.prf b/mkspecs/features/symbian/localize_deployment.prf index 26a254b..185c713 100644 --- a/mkspecs/features/symbian/localize_deployment.prf +++ b/mkspecs/features/symbian/localize_deployment.prf @@ -101,6 +101,15 @@ isEmpty(SYMBIAN_MATCHED_LANGUAGES) { matchSymbianLanguages() } +# If there are translations that do not have Symbian language code defined for that exact +# language + country combination, but have Symbian language code defined for just the language, +# map the language + country combination to the same value as the plain language. +for(language, SYMBIAN_UNMAPPED_LANGUAGES) { + languageVar = SYMBIAN_LANG.$${language} + fallbackLanguageVar = SYMBIAN_LANG.$$eval(SYMBIAN_LANGUAGE_FALLBACK.$$language) + $$languageVar = $$eval($$fallbackLanguageVar) +} + !isEmpty(SYMBIAN_MATCHED_TRANSLATIONS) { # Generate dependencies to .ts files for pkg files template_pkg_target.depends += $$SYMBIAN_MATCHED_TRANSLATIONS |