diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2010-11-09 14:39:20 (GMT) |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2010-11-12 08:38:36 (GMT) |
commit | 16575f7aef840b6aae0dc767468ab713fbcfd7a6 (patch) | |
tree | b217b8e866bad40d2140180adc8c635aca4e68b2 /mkspecs/common | |
parent | 924be25253471ababfcf560a6ca098543838c0aa (diff) | |
download | Qt-16575f7aef840b6aae0dc767468ab713fbcfd7a6.zip Qt-16575f7aef840b6aae0dc767468ab713fbcfd7a6.tar.gz Qt-16575f7aef840b6aae0dc767468ab713fbcfd7a6.tar.bz2 |
Localize .loc and .pkg content based on TRANSLATIONS
If developer specifies "CONFIG += localize_deployment" in .pro file,
the generated .loc and .pkg will now use translatable strings from
.ts files defined in TRANSLATIONS. The .ts files must have an
underscore and Qt language code at the end of the filename body
to be compatible with deployment localization. E.g. myapp_en.ts.
Running lupdate will generate these entries into .ts files:
- Application short caption
- Application long caption
- Package name
- Smart installer package name
Task-number: QTBUG-13917
Reviewed-by: Oswald Buddenhagen
Reviewed-by: Janne Anttila
Reviewed-by: axis
Diffstat (limited to 'mkspecs/common')
-rw-r--r-- | mkspecs/common/symbian/appCaptionForTranslation.cpp | 46 | ||||
-rw-r--r-- | mkspecs/common/symbian/packageNameForTranslation.cpp | 47 | ||||
-rw-r--r-- | mkspecs/common/symbian/symbian.conf | 63 |
3 files changed, 145 insertions, 11 deletions
diff --git a/mkspecs/common/symbian/appCaptionForTranslation.cpp b/mkspecs/common/symbian/appCaptionForTranslation.cpp new file mode 100644 index 0000000..c295147 --- /dev/null +++ b/mkspecs/common/symbian/appCaptionForTranslation.cpp @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//: Application short caption, currently only relevant for application projects in Symbian. +QT_TRANSLATE_NOOP("QtApplicationCaptions", "Application short caption") + +//: Application long caption, currently only relevant for application projects in Symbian. +QT_TRANSLATE_NOOP("QtApplicationCaptions", "Application long caption") diff --git a/mkspecs/common/symbian/packageNameForTranslation.cpp b/mkspecs/common/symbian/packageNameForTranslation.cpp new file mode 100644 index 0000000..bc4a7f4 --- /dev/null +++ b/mkspecs/common/symbian/packageNameForTranslation.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//: Installation package name, currently only relevant for Symbian projects that deploy something. +QT_TRANSLATE_NOOP("QtPackageNames", "Package name") + +//: Smart installer installation package name, currently only relevant for Symbian projects that +//: deploy something. +QT_TRANSLATE_NOOP("QtPackageNames", "Smart installer package name") diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 69188a8..f8586b0 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -130,6 +130,17 @@ QMAKE_LIBS_QT_ENTRY = -lqtmain$${QT_LIBINFIX}.lib QMAKE_LIBS_NO_QT_ENTRY = -llibcrt0.lib QMAKE_LIBS_NO_QT_ENTRY_GCCE = -llibcrt0_gcce.lib +# List of languages that have a Symbian language code mapping provided in localize_deployment.prf +SYMBIAN_SUPPORTED_LANGUAGES = \ + af sq am ar hy bn bg my be ca \ + hr cs da nl en et fi fr gd ka \ + de el gu he hi hu is id ga it \ + ja kn kk ko lo lv lt mk ms ml \ + mr mo mn nb pl pt pa ro ru sr \ + si sk sl so es sw sv tl ta te \ + th bo ti tr tk uk ur vi cy zu \ + nn + # These directories must match what configure uses for QT_INSTALL_PLUGINS and QT_INSTALL_IMPORTS QT_PLUGINS_BASE_DIR = /resource/qt$${QT_LIBINFIX}/plugins QT_IMPORTS_BASE_DIR = /resource/qt/imports @@ -194,17 +205,6 @@ isEmpty(S60_VERSION) { # multiple language compatible dependency statements him/herself. default_deployment.pkg_prerules += pkg_depends_webkit pkg_depends_qt pkg_platform_dependencies - -# Supports S60 3.1, 3.2, 5.0, Symbian^3, and Symbian^4 by default -pkg_platform_dependencies = \ - "; Default HW/platform dependencies" \ - "[0x102032BE],0,0,0,{\"S60ProductID\"}" \ - "[0x102752AE],0,0,0,{\"S60ProductID\"}" \ - "[0x1028315F],0,0,0,{\"S60ProductID\"}" \ - "[0x20022E6D],0,0,0,{\"S60ProductID\"}" \ - "[0x20032DE7],0,0,0,{\"S60ProductID\"}" \ - " " - DEPLOYMENT += default_deployment default_bin_deployment default_resource_deployment default_reg_deployment defineReplace(symbianRemoveSpecialCharacters) { @@ -225,3 +225,44 @@ defineReplace(symbianRemoveSpecialCharacters) { return ($$fixedStr) } +# Determines translations that are Symbian supported +defineTest(matchSymbianLanguages) { + SYMBIAN_MATCHED_LANGUAGES = + SYMBIAN_MATCHED_TRANSLATIONS = + + # Cannot parse .ts file for language here, so detect it from filename. + # Allow two and three character language and country codes. + for(translation, TRANSLATIONS) { + language = $$replace(translation, "^(.*/)?[^/]+_(([^_]{2,3}_)?[^_]{2,3})\\.ts$", \\2) + contains(SYMBIAN_SUPPORTED_LANGUAGES, $$language) { + SYMBIAN_MATCHED_LANGUAGES += $$language + SYMBIAN_MATCHED_TRANSLATIONS += $$translation + } + } + + isEmpty(SYMBIAN_MATCHED_LANGUAGES): SYMBIAN_MATCHED_LANGUAGES = en + + export(SYMBIAN_MATCHED_LANGUAGES) + export(SYMBIAN_MATCHED_TRANSLATIONS) +} + +# Symbian pkg files that define multiple languages require a language specific string to be +# defined for various items, even though the string often needs to be same for all languages. +# This replacement method will generate correct string for such cases based on TRANSLATIONS +# variable. +defineReplace(addLanguageDependentPkgItem) { + localize_deployment:!isEmpty(TRANSLATIONS):isEmpty(SYMBIAN_MATCHED_LANGUAGES) { + matchSymbianLanguages() + } + + pkgItem = $$eval($$1) + pkgLanguageList = + + for(dummyItem, SYMBIAN_MATCHED_LANGUAGES) { + pkgLanguageList += "\"$$pkgItem\"" + } + + isEmpty(pkgLanguageList): pkgLanguageList = "\"$$pkgItem\"" + + return($$join(pkgLanguageList,",",,)) +} |