diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-03-06 16:19:42 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-11 18:31:21 +0100 |
commit | 914b72418b7e766026f2679254fcee93fc920866 (patch) | |
tree | 202634bd203c830ddc7eeb7dab1d071ca506b8a3 /tests/auto/qml/qqmltranslation/data | |
parent | af7ba8a6194b83fe7380b8d4ae027e2f04e21f17 (diff) |
Add support for resolving translation bindings at compile time
Simple calls to qsTr and qsTrId are detected at type compile time and
reduced to a special Translation and TranslationById binding type, which
avoids allocating a QML binding at type instantiation type just to perform
a translation.
Change-Id: I61e4f2db2a8092b5e6870e174b832d9c20cd62b5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmltranslation/data')
-rw-r--r-- | tests/auto/qml/qqmltranslation/data/translation.qml | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/auto/qml/qqmltranslation/data/translation.qml b/tests/auto/qml/qqmltranslation/data/translation.qml index 8435bedb28..b96471c9dd 100644 --- a/tests/auto/qml/qqmltranslation/data/translation.qml +++ b/tests/auto/qml/qqmltranslation/data/translation.qml @@ -1,13 +1,15 @@ import QtQuick 2.0 QtObject { + objectName: "test" + property string basic: qsTr("hello") property string basic2: qsTranslate("CustomContext", "goodbye") - property string basic3: if (1) qsTr("hello") + property string basic3: if (objectName.length > 0) qsTr("hello") property string disambiguation: qsTr("hi", "informal 'hello'") property string disambiguation2: qsTranslate("CustomContext", "see ya", "informal 'goodbye'") - property string disambiguation3: if (1) qsTr("hi", "informal 'hello'") + property string disambiguation3: if (objectName.length > 0) qsTr("hi", "informal 'hello'") property string _noop: QT_TR_NOOP("hello") property string _noop2: QT_TRANSLATE_NOOP("CustomContext", "goodbye") @@ -15,7 +17,7 @@ QtObject { property string noop2: qsTranslate("CustomContext", _noop2) property string singular: qsTr("%n duck(s)", "", 1) - property string singular2: if (1) qsTr("%n duck(s)", "", 1) + property string singular2: if (objectName.length > 0) qsTr("%n duck(s)", "", 1) property string plural: qsTr("%n duck(s)", "", 2) - property string plural2: if (1) qsTr("%n duck(s)", "", 2) + property string plural2: if (objectName.length > 0) qsTr("%n duck(s)", "", 2) } |