Qt Creator, localization and work flow



  • I have been looking at the instructions at http://doc.qt.nokia.com/4.7/declarative-i18n-i18n-qml.html to localize some qml. The workflow seems to be...

    1. Under Ubuntu (as that's only where I have mobility 1.1 working ok), in QT Creator IDE, I write code that needs a string
    2. I surround the string with qsTr()
    3. I run lupdate from the command line
    4. I copy the file to Windows and create the translation in Qt Linguist (it only runs under Windows and Mac)
    5. I copy the file back to Ubuntu
    6. I run lrelease from the command line

    This is a long workflow if I have to do this regularly. Is it possible to invoke lupdate and lrelease from Qt Creator and edit the .ts in Qt creator? (it doesn't show up when I try to add the file to the project). If I drag the .ts file into Qt Creator I can edit it but it's not obvious where to put the language pairs.

    Thanks

    Simon



  • I use this on windows, i don't know that linguist not work on linux.



  • [quote author="stuk" date="1292238939"]I use this on windows, i don't know that linguist not work on linux.[/quote]

    It does run on linux. "Here":http://qt.nokia.com/images/products/qt-linguist-screenshot-linux/view is a screenshot of the same.



  • I'll answer my own question. Maybe some people can suggest an even simpler workflow.
    First of all, http://doc.qt.nokia.com/4.7/declarative-i18n-i18n-qml.html is a bit misleading/simplisitic as it's a one file project and the naming conflicts with what I found at http://doc.trolltech.com/stable/qmlviewer.html

    Here's what I am doing now....

    Aggregate all your file string instances (that are in all QML files) in one file per language and name like qml_en.ts (for English). There's no need to run lupdate (it just finds qsTr for you which you probably already know as you added the string - you might like to run it once though to get the .ts file syntax).

    Manually edit qml_en.ts (drag and drop into Qt creator). You then only have to run lrelease i18n/*.ts every time you change the file (good if QT Creator could do this automatically!). Change the QT Creator project settings (Project icon) to use the translation you wish to test e.g. add -translation qml_en.qm as QML viewer arguments.

    Also, I found that qsTr() doesn't work in a listmodel. You will get a run time error "cannot use script for property value parameter". Use QT_TR_NOOP() rather than qsTr().

    In my opinion QT Creator should be doing a lot more for us... including detecting invalid uses of qsTr().

    Simon



  • [quote author="QtK" date="1292240878"]
    [quote author="stuk" date="1292238939"]I use this on windows, i don't know that linguist not work on linux.[/quote]

    It does run on linux. "Here":http://qt.nokia.com/images/products/qt-linguist-screenshot-linux/view is a screenshot of the same.[/quote]

    Interesting. Do you know where to find the download for this? The Windows and Mac downloads are at...
    http://qt-apps.org/content/show.php/Qt+Linguist+Download?content=89360

    Thanks

    Simon



  • Are this link update to the latest version of linguist?
    Last version is 4.7.1 here is 4.6.0.

    [quote author="SimonJudge" date="1292250551"]
    [quote author="QtK" date="1292240878"]
    [quote author="stuk" date="1292238939"]I use this on windows, i don't know that linguist not work on linux.[/quote]

    It does run on linux. "Here":http://qt.nokia.com/images/products/qt-linguist-screenshot-linux/view is a screenshot of the same.[/quote]

    Interesting. Do you know where to find the download for this? The Windows and Mac downloads are at...
    http://qt-apps.org/content/show.php/Qt+Linguist+Download?content=89360

    Thanks

    Simon[/quote]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.