[SailfishDevel] How to translate (lupdate) ?

Unai IRIGOYEN u.irigoyen at gmail.com
Sun Jan 12 17:20:41 UTC 2014


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


More information about the Devel mailing list