[Qt-qml] QML, qsTr() and variable substitution

Artem Marchenko artem.marchenko at gmail.com
Thu Oct 6 11:19:22 CEST 2011


Hi All

if I have a string that needs a different order of arguments for different languages, I use arg() method of QString. For example, imagine an example from Qt's docs:

====
QString s1 = "%1 of %2 files copied. Copying: %3";
 QString s2 = "Kopierer nu %3. Av totalt %2 filer er %1 kopiert.";
====

How do you do the same in QML?
There is no standard way for templating JavaScript strings and to my understanding Qt doesn't recommend any specific library for it. The what do you do for QML localization?

Or is JavaScript's qsTr() is somehow able to care after the arguments on its own?

Best regards,
Artem.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20111006/2a4b27bb/attachment-0001.html 


More information about the Qt-qml mailing list