maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Dynamic text translations in pure QML (https://talk.maemo.org/showthread.php?t=74571)

damagedspline 2011-07-02 21:14

Dynamic text translations in pure QML
 
Posted a blog about it 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 Translator.qml QwazerSettings.qml qwazer.qml 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.

marxian 2011-07-02 21:30

Re: Dynamic text translations in pure QML
 
Interesting approach. :) My only concern would be that it makes it more difficult for users to provide translations (unless the developer takes all the translated strings from the .ts file provided by the translator and puts them into a JS object, which again equals more work). I suppose you could write a script that automates that process. :)

damagedspline 2011-07-03 05:26

Re: Dynamic text translations in pure QML
 
Quote:

Originally Posted by marxian (Post 1043583)
I suppose you could write a script that automates that process. :)

the script is not completed yet - i still need to scan the previous file and perserve the texts that were already translated so it will only add the new entries that dont exist yet. further more, i can make a script parses the actual ts files, but thats not the main project i' working on :p


All times are GMT. The time now is 16:35.

vBulletin® Version 3.8.8