Add basic documentation for QML translation functions.
authorMichael Brasser <michael.brasser@nokia.com>
Thu, 28 Jun 2012 01:27:23 +0000 (11:27 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 28 Jun 2012 04:02:36 +0000 (06:02 +0200)
Change-Id: I50932ffd956061dd172616c4de863eb1a322394d
Reviewed-by: Bea Lam <bea.lam@nokia.com>
src/qml/doc/snippets/qml/qsTr.qml [new file with mode: 0644]
src/qml/doc/snippets/qml/qsTrId.1.qml [new file with mode: 0644]
src/qml/doc/snippets/qml/qsTrId.qml [new file with mode: 0644]
src/qml/doc/snippets/qml/qsTranslate.qml [new file with mode: 0644]
src/qml/doc/snippets/qml/qtTrIdNoOp.qml [new file with mode: 0644]
src/qml/doc/snippets/qml/qtTrNoOp.qml [new file with mode: 0644]
src/qml/doc/snippets/qml/qtTranslateNoOp.qml [new file with mode: 0644]
src/qml/qml/v8/qqmlbuiltinfunctions.cpp

diff --git a/src/qml/doc/snippets/qml/qsTr.qml b/src/qml/doc/snippets/qml/qsTr.qml
new file mode 100644 (file)
index 0000000..de154ed
--- /dev/null
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+**     the names of its contributors may be used to endorse or promote
+**     products derived from this software without specific prior written
+**     permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//![0]
+Text { text: qsTr("hello") }
+//![0]
diff --git a/src/qml/doc/snippets/qml/qsTrId.1.qml b/src/qml/doc/snippets/qml/qsTrId.1.qml
new file mode 100644 (file)
index 0000000..558aeba
--- /dev/null
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+**     the names of its contributors may be used to endorse or promote
+**     products derived from this software without specific prior written
+**     permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//![0]
+Text {
+    //% "hello"
+    text: qsTrId("hello_id")
+}
+//![0]
diff --git a/src/qml/doc/snippets/qml/qsTrId.qml b/src/qml/doc/snippets/qml/qsTrId.qml
new file mode 100644 (file)
index 0000000..30b64ff
--- /dev/null
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+**     the names of its contributors may be used to endorse or promote
+**     products derived from this software without specific prior written
+**     permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//![0]
+Text { text: qsTrId("hello_id") }
+//![0]
diff --git a/src/qml/doc/snippets/qml/qsTranslate.qml b/src/qml/doc/snippets/qml/qsTranslate.qml
new file mode 100644 (file)
index 0000000..b6a056f
--- /dev/null
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+**     the names of its contributors may be used to endorse or promote
+**     products derived from this software without specific prior written
+**     permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//![0]
+Text { text: qsTranslate("CustomContext", "hello") }
+//![0]
diff --git a/src/qml/doc/snippets/qml/qtTrIdNoOp.qml b/src/qml/doc/snippets/qml/qtTrIdNoOp.qml
new file mode 100644 (file)
index 0000000..c0192f4
--- /dev/null
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+**     the names of its contributors may be used to endorse or promote
+**     products derived from this software without specific prior written
+**     permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//![0]
+Item {
+    property string greetingId: QT_TRID_NOOP("hello_id")
+
+    Text { text: qsTrId(greetingId) }
+}
+//![0]
diff --git a/src/qml/doc/snippets/qml/qtTrNoOp.qml b/src/qml/doc/snippets/qml/qtTrNoOp.qml
new file mode 100644 (file)
index 0000000..050b44c
--- /dev/null
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+**     the names of its contributors may be used to endorse or promote
+**     products derived from this software without specific prior written
+**     permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//![0]
+Item {
+    property string greeting: QT_TR_NOOP("hello")
+
+    Text { text: qsTr(greeting) }
+}
+//![0]
diff --git a/src/qml/doc/snippets/qml/qtTranslateNoOp.qml b/src/qml/doc/snippets/qml/qtTranslateNoOp.qml
new file mode 100644 (file)
index 0000000..96646d9
--- /dev/null
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+**     the names of its contributors may be used to endorse or promote
+**     products derived from this software without specific prior written
+**     permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//![0]
+Item {
+    property string greeting: QT_TRANSLATE_NOOP("CustomContext", "hello")
+
+    Text { text: qsTranslate("CustomContext", greeting) }
+}
+//![0]
index 19a97d9..deaf5f5 100644 (file)
@@ -1178,6 +1178,23 @@ v8::Handle<v8::Value> createComponent(const v8::Arguments &args)
     return v8engine->newQObject(c);
 }
 
+/*!
+    \qmlmethod string qsTranslate(string context, string sourceText, string disambiguation, int n)
+
+    Returns a translated version of \a sourceText within the given \a context, optionally based on a
+    \a disambiguation string and value of \a n for strings containing plurals;
+    otherwise returns \a sourceText itself if no appropriate translated string
+    is available.
+
+    If the same \a sourceText is used in different roles within the
+    same translation \a context, an additional identifying string may be passed in
+    for \a disambiguation.
+
+    Example:
+    \snippet qml/qsTranslate.qml 0
+
+    \sa {Localization And Internationalization Support In Qt Quick}
+*/
 v8::Handle<v8::Value> qsTranslate(const v8::Arguments &args)
 {
     if (args.Length() < 2)
@@ -1185,9 +1202,9 @@ v8::Handle<v8::Value> qsTranslate(const v8::Arguments &args)
     if (!args[0]->IsString())
         V8THROW_ERROR("qsTranslate(): first argument (context) must be a string");
     if (!args[1]->IsString())
-        V8THROW_ERROR("qsTranslate(): second argument (text) must be a string");
+        V8THROW_ERROR("qsTranslate(): second argument (sourceText) must be a string");
     if ((args.Length() > 2) && !args[2]->IsString())
-        V8THROW_ERROR("qsTranslate(): third argument (comment) must be a string");
+        V8THROW_ERROR("qsTranslate(): third argument (disambiguation) must be a string");
 
     QV8Engine *v8engine = V8ENGINE();
     QString context = v8engine->toString(args[0]);
@@ -1213,6 +1230,28 @@ v8::Handle<v8::Value> qsTranslate(const v8::Arguments &args)
     return v8engine->toString(result);
 }
 
+/*!
+    \qmlmethod string QT_TRANSLATE_NOOP(string context, string sourceText, string disambiguation)
+
+    Marks \a sourceText for dynamic translation in the given \a context; i.e, the stored \a sourceText
+    will not be altered.
+
+    If the same \a sourceText is used in different roles within the
+    same translation context, an additional identifying string may be passed in
+    for \a disambiguation.
+
+    Returns the \a sourceText.
+
+    QT_TRANSLATE_NOOP is used in conjunction with the dynamic translation functions
+    qsTr() and qsTranslate(). It identifies a string as requiring
+    translation (so it can be identified by \c lupdate), but leaves the actual
+    translation to the dynamic functions.
+
+    Example:
+    \snippet qml/qtTranslateNoOp.qml 0
+
+    \sa {Localization And Internationalization Support In Qt Quick}
+*/
 v8::Handle<v8::Value> qsTranslateNoOp(const v8::Arguments &args)
 {
     if (args.Length() < 2)
@@ -1220,14 +1259,31 @@ v8::Handle<v8::Value> qsTranslateNoOp(const v8::Arguments &args)
     return args[1];
 }
 
+/*!
+    \qmlmethod string qsTr(string sourceText, string disambiguation, int n)
+
+    Returns a translated version of \a sourceText, optionally based on a
+    \a disambiguation string and value of \a n for strings containing plurals;
+    otherwise returns \a sourceText itself if no appropriate translated string
+    is available.
+
+    If the same \a sourceText is used in different roles within the
+    same translation context, an additional identifying string may be passed in
+    for \a disambiguation.
+
+    Example:
+    \snippet qml/qsTr.qml 0
+
+    \sa {Localization And Internationalization Support In Qt Quick}
+*/
 v8::Handle<v8::Value> qsTr(const v8::Arguments &args)
 {
     if (args.Length() < 1)
         V8THROW_ERROR("qsTr() requires at least one argument");
     if (!args[0]->IsString())
-        V8THROW_ERROR("qsTr(): first argument (text) must be a string");
+        V8THROW_ERROR("qsTr(): first argument (sourceText) must be a string");
     if ((args.Length() > 1) && !args[1]->IsString())
-        V8THROW_ERROR("qsTr(): second argument (comment) must be a string");
+        V8THROW_ERROR("qsTr(): second argument (disambiguation) must be a string");
     if ((args.Length() > 2) && !args[2]->IsNumber())
         V8THROW_ERROR("qsTr(): third argument (n) must be a number");
 
@@ -1252,6 +1308,28 @@ v8::Handle<v8::Value> qsTr(const v8::Arguments &args)
     return v8engine->toString(result);
 }
 
+/*!
+    \qmlmethod string QT_TR_NOOP(string sourceText, string disambiguation)
+
+    Marks \a sourceText for dynamic translation; i.e, the stored \a sourceText
+    will not be altered.
+
+    If the same \a sourceText is used in different roles within the
+    same translation context, an additional identifying string may be passed in
+    for \a disambiguation.
+
+    Returns the \a sourceText.
+
+    QT_TR_NOOP is used in conjunction with the dynamic translation functions
+    qsTr() and qsTranslate(). It identifies a string as requiring
+    translation (so it can be identified by \c lupdate), but leaves the actual
+    translation to the dynamic functions.
+
+    Example:
+    \snippet qml/qtTrNoOp.qml 0
+
+    \sa {Localization And Internationalization Support In Qt Quick}
+*/
 v8::Handle<v8::Value> qsTrNoOp(const v8::Arguments &args)
 {
     if (args.Length() < 1)
@@ -1259,6 +1337,36 @@ v8::Handle<v8::Value> qsTrNoOp(const v8::Arguments &args)
     return args[0];
 }
 
+/*!
+    \qmlmethod string qsTrId(string id, int n)
+
+    Returns a translated string identified by \a id.
+    If no matching string is found, the id itself is returned. This
+    should not happen under normal conditions.
+
+    If \a n >= 0, all occurrences of \c %n in the resulting string
+    are replaced with a decimal representation of \a n. In addition,
+    depending on \a n's value, the translation text may vary.
+
+    Example:
+    \snippet qml/qsTrId.qml 0
+
+    It is possible to supply a source string template like:
+
+    \tt{//% <string>}
+
+    or
+
+    \tt{\\begincomment% <string> \\endcomment}
+
+    Example:
+    \snippet qml/qsTrId.1.qml 0
+
+    Creating binary translation (QM) files suitable for use with this function requires passing
+    the \c -idbased option to the \c lrelease tool.
+
+    \sa QT_TRID_NOOP, {Localization And Internationalization Support In Qt Quick}
+*/
 v8::Handle<v8::Value> qsTrId(const v8::Arguments &args)
 {
     if (args.Length() < 1)
@@ -1276,6 +1384,22 @@ v8::Handle<v8::Value> qsTrId(const v8::Arguments &args)
     return v8engine->toString(qtTrId(v8engine->toString(args[0]).toUtf8().constData(), n));
 }
 
+/*!
+    \qmlmethod string QT_TRID_NOOP(string id)
+
+    Marks \a id for dynamic translation.
+
+    Returns the \a id.
+
+    QT_TRID_NOOP is used in conjunction with the dynamic translation function
+    qsTrId(). It identifies a string as requiring translation (so it can be identified
+    by \c lupdate), but leaves the actual translation to qsTrId().
+
+    Example:
+    \snippet qml/qtTrIdNoOp.qml 0
+
+    \sa qsTrId(), {Localization And Internationalization Support In Qt Quick}
+*/
 v8::Handle<v8::Value> qsTrIdNoOp(const v8::Arguments &args)
 {
     if (args.Length() < 1)