Re: [SailfishDevel] How to translate (lupdate) ?
On Monday 13 January 2014 16:28 Timur Kristóf wrote: Not sure what you mean by already performs all the checks you do - it doesn't check LANG, nor does it check QLocale::system().name() It does check LANG. That's how I test the translations: $ LANG=da_DK harbour-myapp On Mon, Jan 13, 2014 at 1:21 PM, Thomas Tanghus tho...@tanghus.net wrote: On Monday 13 January 2014 12:52 Timur Kristóf wrote: Here is how I do it: 1. Check the LANG environment variable 2. Check QLocale::system().name() Take a look at the code here: https://github.com/Venemo/puzzle-master/blob/master/helpers/util.cpp#L24 QTranslator::load()[1] already performs all the checks you do, so is there really a need to do more than this? QTranslator* translator = new QTranslator; QString locale = QLocale::system().name(); if(!translator-load(SailfishApp::pathTo(translations).toLocalFile() + / + locale + .qm)) { qDebug() Couldn't load translation; } [1] http://qt-project.org/doc/qt-5.0/qtcore/qtranslator.html#load -- Med venlig hilsen / Best Regards Thomas Tanghus ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] How to translate (lupdate) ?
Not sure what you mean by already performs all the checks you do - it doesn't check LANG, nor does it check QLocale::system().name() Timur On Mon, Jan 13, 2014 at 1:21 PM, Thomas Tanghus tho...@tanghus.net wrote: On Monday 13 January 2014 12:52 Timur Kristóf wrote: Here is how I do it: 1. Check the LANG environment variable 2. Check QLocale::system().name() Take a look at the code here: https://github.com/Venemo/puzzle-master/blob/master/helpers/util.cpp#L24 QTranslator::load()[1] already performs all the checks you do, so is there really a need to do more than this? QTranslator* translator = new QTranslator; QString locale = QLocale::system().name(); if(!translator-load(SailfishApp::pathTo(translations).toLocalFile() + / + locale + .qm)) { qDebug() Couldn't load translation; } [1] http://qt-project.org/doc/qt-5.0/qtcore/qtranslator.html#load -- Med venlig hilsen / Best Regards Thomas Tanghus ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] How to translate (lupdate) ?
In my application I am using just: QString locale = QLocale::system().name(); QTranslator translator; if (translator.load(QString(i18n:quandoparte_) + locale)) { qDebug() Translation for locale locale loaded; a-installTranslator(translator); } else { qDebug() Translation for locale locale not found; } Why do I need to check the environment? Isn't QLocale::system() using it behind the scenes anyway? Thank you, Luciano On Mon, Jan 13, 2014 at 4:28 PM, Timur Kristóf timur.kris...@gmail.com wrote: Not sure what you mean by already performs all the checks you do - it doesn't check LANG, nor does it check QLocale::system().name() Timur On Mon, Jan 13, 2014 at 1:21 PM, Thomas Tanghus tho...@tanghus.net wrote: On Monday 13 January 2014 12:52 Timur Kristóf wrote: Here is how I do it: 1. Check the LANG environment variable 2. Check QLocale::system().name() Take a look at the code here: https://github.com/Venemo/puzzle-master/blob/master/helpers/util.cpp#L24 QTranslator::load()[1] already performs all the checks you do, so is there really a need to do more than this? QTranslator* translator = new QTranslator; QString locale = QLocale::system().name(); if(!translator-load(SailfishApp::pathTo(translations).toLocalFile() + / + locale + .qm)) { qDebug() Couldn't load translation; } [1] http://qt-project.org/doc/qt-5.0/qtcore/qtranslator.html#load -- Med venlig hilsen / Best Regards Thomas Tanghus ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list -- Luciano Montanaro Anyone who is capable of getting themselves made President should on no account be allowed to do the job. -- Douglas Adams ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] How to translate (lupdate) ?
Ok, I'm replying to myself here and for reference in case someone else is disappointed. I launched the app from Jolla's app menu and found out it was translated so in fact this only happens when running from QtCreator. -- Unai IRIGOYEN Le dimanche 12 janvier 2014 17:54:50, vous avez écrit : I followed those steps to try to fix my app translations but QLocale::system() still returns C. Am I the only one in this case? I'm running my app on Jolla so it's not a problem with emulator. you can use any /usr/share/appname location. use qm file with QTranslator and install translator to QGuiApplication qsTr is enough you can use LC_ALL On 03.01.2014 02:26, Franck Routier (perso) wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ok, now I have .ts file, I did translate the strings, and produced the .qm file. So my next questions are: 1) how do I include the qm file in the rpm ? Should I put it in a specific directory, or directly in /usr/share/MyApp ? 2) is there something special I need to do in my app to trigger the magic, or is using qsTr() in the qml files sufficient to to make it happen ? 3) Is there a way I can test if it is working from within the SDK (I did not receive my device yet...) ? Should I ssh into the emulator and play with LC_ALL, or is there another way ? Thanks in advance, Franck Le 02/01/2014 21:02, Andrey Kozhevnikov a écrit : for directly use lupdare/lrelease you need to chroot to target (inside VM): sb2 -t SailfishOS-armv7hl -s sdk-install On 03.01.2014 02:00, Franck Routier (perso) wrote: I finally used the lupdate binary found in the Harmattan SDK somewhere on my hard disk. Also, to make it process qml files, I used this trick (https://developer.nokia.com/Community/Wiki/Lupdate_with_qml_files), which consists in listing the qml files this way in the .pro file: evil_hack_to_fool_lupdate { SOURCES += \ qml/Splash.qml \ qml/Login.qml \ ... } Notice that running lupdate with a ts.list file as Andrey suggested failed with a message telling me the files had a no recognized extension. Ok, this did the trick for now, but I'm still wondering how this is supposed to work from within the SailfishOS SDK... Best regards, Franck Le 02/01/2014 19:11, Andrey Kozhevnikov a écrit : i'm always using self-created ts.list text file with list of paths to files contains strings and my lupdate syntax: lupdate -verbose -ts languages/en_US.ts @ts.list On 02.01.2014 23:44, Franck Routier (perso) wrote: Le 02/01/2014 18:37, Andrey Kozhevnikov a écrit : its inside build machine. qmake will run lupdate/lrelease from internal path. Ok, I understand. So I have to start the MerSDK virtual machine for lupdate to work. Then, shouldn't it generate some .ts file in my project ? (its the first time I use QT Linguist, still learning, thanks for your patience) Regards, Franck ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSxcuOAAoJEGEvoAir78Ro8ucIANB8cgLDVhuh3W2vwGay83iL PLA1N/Js18e6VkGR80XPCarC/vvUGPbrdag5+OhGsWGNPGjX85mUMXVde8tgVTBa FA/2s8E24YJsGAATOHIPBp161uxEU6iPDFmteBa1m/5Ze34DHpc4aeye62/eagy7 9l6sJdDd7C/jAdCUpHwrLBaYjkkDM2DpVgRLdQ3/Q1MksgFSwWxESrwbfsvrplcb XYM5KHpCAGPnq95nAjYshkQk2Ca6/B245ZChq5OfjbMDilGWwHThQzLbcB215icM 3A4RrxWNDoNcGF+wLUutLpyPAR3mzz/y6qHETWpRyXq2tFFunAaUiv7K34C8r3Y= =4sHU -END PGP SIGNATURE- ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] How to translate (lupdate) ?
When running from Qt Creator the locale is always C, when clicking the app button on the emulator then the locale is right. I also run my app from the emulator through ssh with something like : LC_ALL=fr_FR.UTF-8 my_app to test different locales. On Sun, Jan 12, 2014 at 12:20 PM, Unai IRIGOYEN u.irigo...@gmail.comwrote: Ok, I'm replying to myself here and for reference in case someone else is disappointed. I launched the app from Jolla's app menu and found out it was translated so in fact this only happens when running from QtCreator. -- Unai IRIGOYEN Le dimanche 12 janvier 2014 17:54:50, vous avez écrit : I followed those steps to try to fix my app translations but QLocale::system() still returns C. Am I the only one in this case? I'm running my app on Jolla so it's not a problem with emulator. you can use any /usr/share/appname location. use qm file with QTranslator and install translator to QGuiApplication qsTr is enough you can use LC_ALL On 03.01.2014 02:26, Franck Routier (perso) wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ok, now I have .ts file, I did translate the strings, and produced the .qm file. So my next questions are: 1) how do I include the qm file in the rpm ? Should I put it in a specific directory, or directly in /usr/share/MyApp ? 2) is there something special I need to do in my app to trigger the magic, or is using qsTr() in the qml files sufficient to to make it happen ? 3) Is there a way I can test if it is working from within the SDK (I did not receive my device yet...) ? Should I ssh into the emulator and play with LC_ALL, or is there another way ? Thanks in advance, Franck Le 02/01/2014 21:02, Andrey Kozhevnikov a écrit : for directly use lupdare/lrelease you need to chroot to target (inside VM): sb2 -t SailfishOS-armv7hl -s sdk-install On 03.01.2014 02:00, Franck Routier (perso) wrote: I finally used the lupdate binary found in the Harmattan SDK somewhere on my hard disk. Also, to make it process qml files, I used this trick (https://developer.nokia.com/Community/Wiki/Lupdate_with_qml_files ), which consists in listing the qml files this way in the .pro file: evil_hack_to_fool_lupdate { SOURCES += \ qml/Splash.qml \ qml/Login.qml \ ... } Notice that running lupdate with a ts.list file as Andrey suggested failed with a message telling me the files had a no recognized extension. Ok, this did the trick for now, but I'm still wondering how this is supposed to work from within the SailfishOS SDK... Best regards, Franck Le 02/01/2014 19:11, Andrey Kozhevnikov a écrit : i'm always using self-created ts.list text file with list of paths to files contains strings and my lupdate syntax: lupdate -verbose -ts languages/en_US.ts @ts.list On 02.01.2014 23:44, Franck Routier (perso) wrote: Le 02/01/2014 18:37, Andrey Kozhevnikov a écrit : its inside build machine. qmake will run lupdate/lrelease from internal path. Ok, I understand. So I have to start the MerSDK virtual machine for lupdate to work. Then, shouldn't it generate some .ts file in my project ? (its the first time I use QT Linguist, still learning, thanks for your patience) Regards, Franck ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSxcuOAAoJEGEvoAir78Ro8ucIANB8cgLDVhuh3W2vwGay83iL PLA1N/Js18e6VkGR80XPCarC/vvUGPbrdag5+OhGsWGNPGjX85mUMXVde8tgVTBa FA/2s8E24YJsGAATOHIPBp161uxEU6iPDFmteBa1m/5Ze34DHpc4aeye62/eagy7 9l6sJdDd7C/jAdCUpHwrLBaYjkkDM2DpVgRLdQ3/Q1MksgFSwWxESrwbfsvrplcb XYM5KHpCAGPnq95nAjYshkQk2Ca6/B245ZChq5OfjbMDilGWwHThQzLbcB215icM 3A4RrxWNDoNcGF+wLUutLpyPAR3mzz/y6qHETWpRyXq2tFFunAaUiv7K34C8r3Y= =4sHU -END PGP SIGNATURE- ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] How to translate (lupdate) ?
Hi, You can use Qt Linguist, lupdate and other such tools from the regular upstream Qt SDK, you don't need the Sailfish SDK to support it. Cheers, Timur Timur On Thu, Jan 2, 2014 at 6:36 PM, Franck Routier (perso) a...@mecadu.orgwrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I would like to translate my QML application, now that it runs fine. I have used qsTr() for literal strings. Then I have tried to run 'lupdate' from tools/external/Linguist in the Sailfish SDK QtCreator, but it does not seem to do anything... Also, 'find . -name lupdate' in the sdk finds nothing... (it did in the Harmattan Qt SDK). How should I translate my application ? Is there a specific trick from within the SDK, or is this just a missing feature ? Secondary question: I have images that contain textual information. Is there a best way (standard API) to pick the right file, or should I play with suffix in a custom way ? Thanks in advance, Franck -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSxaOOAAoJEGEvoAir78Ro19MH/2KUVc/fGFnVxcFhCc14MFXG vKNdSzFplRdhqdkhjX9XKf0TqiWEW3YF1eZrNi0UipNDQo91pVKVPhhno3w2ZjA0 UG/o9ILl/nlw8J3m8NXQlW0FdZBAi33gN5TaU7cIvFC70FKtF6rsf39vJ9sqHJqO gAsM2HEAoCyiHaoaoxfFSfwHZ5Pd5c2k8tAXYrj1NkVFwzbWF5gSmj/B43fIJVfG nsDLd2aF5FZr1/w+Cp4qBQ8XdWr0P+1ADeGUnj4Lxd4olsUAkRdI2UJRCrp3q3Ef 3fxe2v0VInUMExq8Px7nsFwfPokdazVXbpDwOKIpljc67ywDsZw3rrsNb3P+pKg= =NSoA -END PGP SIGNATURE- ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] How to translate (lupdate) ?
its inside build machine. qmake will run lupdate/lrelease from internal path. On 02.01.2014 23:36, Franck Routier (perso) wrote: Hi, I would like to translate my QML application, now that it runs fine. I have used qsTr() for literal strings. Then I have tried to run 'lupdate' from tools/external/Linguist in the Sailfish SDK QtCreator, but it does not seem to do anything... Also, 'find . -name lupdate' in the sdk finds nothing... (it did in the Harmattan Qt SDK). How should I translate my application ? Is there a specific trick from within the SDK, or is this just a missing feature ? Secondary question: I have images that contain textual information. Is there a best way (standard API) to pick the right file, or should I play with suffix in a custom way ? Thanks in advance, Franck ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] How to translate (lupdate) ?
Le 02/01/2014 18:37, Andrey Kozhevnikov a écrit : its inside build machine. qmake will run lupdate/lrelease from internal path. Ok, I understand. So I have to start the MerSDK virtual machine for lupdate to work. Then, shouldn't it generate some .ts file in my project ? (its the first time I use QT Linguist, still learning, thanks for your patience) Regards, Franck ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] How to translate (lupdate) ?
i'm always using self-created ts.list text file with list of paths to files contains strings and my lupdate syntax: lupdate -verbose -ts languages/en_US.ts @ts.list On 02.01.2014 23:44, Franck Routier (perso) wrote: Le 02/01/2014 18:37, Andrey Kozhevnikov a écrit : its inside build machine. qmake will run lupdate/lrelease from internal path. Ok, I understand. So I have to start the MerSDK virtual machine for lupdate to work. Then, shouldn't it generate some .ts file in my project ? (its the first time I use QT Linguist, still learning, thanks for your patience) Regards, Franck ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] How to translate (lupdate) ?
for directly use lupdare/lrelease you need to chroot to target (inside VM): sb2 -t SailfishOS-armv7hl -s sdk-install On 03.01.2014 02:00, Franck Routier (perso) wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I finally used the lupdate binary found in the Harmattan SDK somewhere on my hard disk. Also, to make it process qml files, I used this trick (https://developer.nokia.com/Community/Wiki/Lupdate_with_qml_files), which consists in listing the qml files this way in the .pro file: evil_hack_to_fool_lupdate { SOURCES += \ qml/Splash.qml \ qml/Login.qml \ ... } Notice that running lupdate with a ts.list file as Andrey suggested failed with a message telling me the files had a no recognized extension. Ok, this did the trick for now, but I'm still wondering how this is supposed to work from within the SailfishOS SDK... Best regards, Franck Le 02/01/2014 19:11, Andrey Kozhevnikov a écrit : i'm always using self-created ts.list text file with list of paths to files contains strings and my lupdate syntax: lupdate -verbose -ts languages/en_US.ts @ts.list On 02.01.2014 23:44, Franck Routier (perso) wrote: Le 02/01/2014 18:37, Andrey Kozhevnikov a écrit : its inside build machine. qmake will run lupdate/lrelease from internal path. Ok, I understand. So I have to start the MerSDK virtual machine for lupdate to work. Then, shouldn't it generate some .ts file in my project ? (its the first time I use QT Linguist, still learning, thanks for your patience) Regards, Franck ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSxcVFAAoJEGEvoAir78RowoQH/idqyCx/+mYDYSkxEQrH3xkf s1E3t6dShlTQH0Z0JOuiTuO3aND2rQV5mA/ROUVU7jzb2557stahCLAFr1ODfnn4 R437WizgA8b0uTzEwpdXRE3r+i189adxs+tsyyC++iaRj2W7tO16nrhagOq06VyA /AXkWwGUoxlcODB/Q6XWlJAsKo0ta0GDMEYe0UJge40CavW0vb3jFYydF2UOqhq/ x21PVh8+xgNr4JGn+c11o0NXMJIBF3LCwI254jp2P9XdRlecaphL87e/Nt2cB+NS nqw0bidwgsxnVPM1R85ycmDzPjnjnw+2apcrafpM8NP6UKRmmRIU2HXWUE9PIiI= =2IKG -END PGP SIGNATURE- ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] How to translate (lupdate) ?
you can use any /usr/share/appname location. use qm file with QTranslator and install translator to QGuiApplication qsTr is enough you can use LC_ALL On 03.01.2014 02:26, Franck Routier (perso) wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ok, now I have .ts file, I did translate the strings, and produced the .qm file. So my next questions are: 1) how do I include the qm file in the rpm ? Should I put it in a specific directory, or directly in /usr/share/MyApp ? 2) is there something special I need to do in my app to trigger the magic, or is using qsTr() in the qml files sufficient to to make it happen ? 3) Is there a way I can test if it is working from within the SDK (I did not receive my device yet...) ? Should I ssh into the emulator and play with LC_ALL, or is there another way ? Thanks in advance, Franck Le 02/01/2014 21:02, Andrey Kozhevnikov a écrit : for directly use lupdare/lrelease you need to chroot to target (inside VM): sb2 -t SailfishOS-armv7hl -s sdk-install On 03.01.2014 02:00, Franck Routier (perso) wrote: I finally used the lupdate binary found in the Harmattan SDK somewhere on my hard disk. Also, to make it process qml files, I used this trick (https://developer.nokia.com/Community/Wiki/Lupdate_with_qml_files), which consists in listing the qml files this way in the .pro file: evil_hack_to_fool_lupdate { SOURCES += \ qml/Splash.qml \ qml/Login.qml \ ... } Notice that running lupdate with a ts.list file as Andrey suggested failed with a message telling me the files had a no recognized extension. Ok, this did the trick for now, but I'm still wondering how this is supposed to work from within the SailfishOS SDK... Best regards, Franck Le 02/01/2014 19:11, Andrey Kozhevnikov a écrit : i'm always using self-created ts.list text file with list of paths to files contains strings and my lupdate syntax: lupdate -verbose -ts languages/en_US.ts @ts.list On 02.01.2014 23:44, Franck Routier (perso) wrote: Le 02/01/2014 18:37, Andrey Kozhevnikov a écrit : its inside build machine. qmake will run lupdate/lrelease from internal path. Ok, I understand. So I have to start the MerSDK virtual machine for lupdate to work. Then, shouldn't it generate some .ts file in my project ? (its the first time I use QT Linguist, still learning, thanks for your patience) Regards, Franck ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSxcuOAAoJEGEvoAir78Ro8ucIANB8cgLDVhuh3W2vwGay83iL PLA1N/Js18e6VkGR80XPCarC/vvUGPbrdag5+OhGsWGNPGjX85mUMXVde8tgVTBa FA/2s8E24YJsGAATOHIPBp161uxEU6iPDFmteBa1m/5Ze34DHpc4aeye62/eagy7 9l6sJdDd7C/jAdCUpHwrLBaYjkkDM2DpVgRLdQ3/Q1MksgFSwWxESrwbfsvrplcb XYM5KHpCAGPnq95nAjYshkQk2Ca6/B245ZChq5OfjbMDilGWwHThQzLbcB215icM 3A4RrxWNDoNcGF+wLUutLpyPAR3mzz/y6qHETWpRyXq2tFFunAaUiv7K34C8r3Y= =4sHU -END PGP SIGNATURE- ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list