Registered Member
|
Hello people,
For one of some final details of my script, I want to translate in some languages, French and English for starting. Is it a simple way to do this ? using a file containing all messages in each languages, and with a system to choose the specified language in function of the default system language ? Thanks for your help
Excuse my english.. please
"Before, I had a life, now, I have a PC." |
Registered Member
|
Getting the language might be possible with QLocale: http://doc.trolltech.com/4.5/qlocale.html
I think http://doc.trolltech.com/4.5/qobject.html#tr will not work, as we would need Subclasses of QObject for that... but with a known locale a simple translating system could relatively easy be built, I guess. |
Registered Member
|
Thanks,
I think I will use this method : In two separate .js files, containing all messages in each language (French and English) And on my script, I just have to include the good file depending of the locale settings : if (QLocale.system().country() == QLocale.France) Amarok.import("french_lang.js"); else Amarok.import("english_lang.js"); With the correct syntax for importing files (I don't remember).
Excuse my english.. please
"Before, I had a life, now, I have a PC." |
Registered Member
|
It works great !
I've remplaced all strings in my main.js file by constants like "LANG_DEST_DIR". And on my two languages files, I've defined all constants using "const LANG_DEST_DIR="Set destination dir"; " And now, if I launch amarok using this syntax : LANG=en_US.UTF-8 amarok the script is in English and if I use LANG=fr_FR.UTF-8 amarok the script is in French ! Thanks for your help sven423
Excuse my english.. please
"Before, I had a life, now, I have a PC." |
Registered Member
|
Good, I'm looking for this.
Ignacio Serantes, proud to be a member of KDE forums since 2008-Nov.
|
Registered Member
|
I've published an update containing this translating system
http://kde-apps.org/content/show.php/Sy ... ent=100841 There's a new way in QTScript 4.5 for internationalization : http://doc.trolltech.com/4.5/qtscript.h ... nalization but I don't understand how it's works and on my Amarok Script Console, qsTr() and some others functions are not usable.
Excuse my english.. please
"Before, I had a life, now, I have a PC." |
Registered users: bancha, Bing [Bot], daret, Evergrowing, Google [Bot], lockheed, sandyvee, Sogou [Bot]