Here's alternative and faster approach to setting LC_ALL. I use QLocale().name() to get current locale code. This creates QLocale instance which equals to QLocale::system() by default, but can be changed by calling QLocale::setDefault().
Then, when I want to test another language, I just put QLocale::setDefault(QLocale(QLocale::Ukrainian, QLocale::Ukraine)); somewhere before language loading code. Works like a charm. On 13/01/14 02:35, Antoine Reversat wrote: > 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.com <mailto:u.irigo...@gmail.com>> wrote: > > 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: > 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 > >>>> _______________________________________________ >>>> SailfishOS.org Devel mailing list >>> >>> _______________________________________________ SailfishOS.org >>> Devel mailing list > _______________________________________________ SailfishOS.org > Devel mailing list > > > > > _______________________________________________ SailfishOS.org > Devel mailing list > -- With best regards, Olekii Serdiuk
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ SailfishOS.org Devel mailing list