damagedspline
07-02-2011, 05:14 PM
Posted a blog about it (http://damagedspline.blogspot.com/2011/07/dynamic-translations-in-pure-qml.html) and thought it should also be published here.
Basically it deals with translating texts and also allow a QML event to change the language - all in pure QML.
If you'd like to see the code in a formatted form, it is available: translator.js (https://code.google.com/p/qwazer/source/browse/qwazer/qml/qwazer/js/translator.js) Translator.qml (https://code.google.com/p/qwazer/source/browse/qwazer/qml/qwazer/Translator.qml) QwazerSettings.qml (https://code.google.com/p/qwazer/source/browse/qwazer/qml/qwazer/QwazerSettings.qml) qwazer.qml (https://code.google.com/p/qwazer/source/browse/qwazer/qml/qwazer/qwazer.qml) qwazer.he.js (https://code.google.com/p/qwazer/source/browse/qwazer/qml/qwazer/js/translations/qwazer.he.js)
Edit:
I forgot to mention that I added a bash script that scans the qml files and create new translations file (similar to lupdate) as a comment at the beginning of translator.js.
Basically it deals with translating texts and also allow a QML event to change the language - all in pure QML.
If you'd like to see the code in a formatted form, it is available: translator.js (https://code.google.com/p/qwazer/source/browse/qwazer/qml/qwazer/js/translator.js) Translator.qml (https://code.google.com/p/qwazer/source/browse/qwazer/qml/qwazer/Translator.qml) QwazerSettings.qml (https://code.google.com/p/qwazer/source/browse/qwazer/qml/qwazer/QwazerSettings.qml) qwazer.qml (https://code.google.com/p/qwazer/source/browse/qwazer/qml/qwazer/qwazer.qml) qwazer.he.js (https://code.google.com/p/qwazer/source/browse/qwazer/qml/qwazer/js/translations/qwazer.he.js)
Edit:
I forgot to mention that I added a bash script that scans the qml files and create new translations file (similar to lupdate) as a comment at the beginning of translator.js.