[SailfishDevel] translations and internationalisations

Matthias Fehring buschmann at huessenbergnetz.de
Fri Mar 20 13:13:26 UTC 2015


Hey Stefan,

the ts file without language code extension is like a template file for 
further languages. That is the reason why it is not compiled into a qm file. 
It would only contain strings that already exist in your source code. So if 
you use qsTr with English as source language there is no need to translate 
this into english again.

English translations are needed if you want to have plural forms displayed 
correctly, but then there only the plurals have to be translated.

It would be different if you use qsTrId, because then there is no real source 
string inside the code. So in that case you would also need english 
translation files. But ts files without lang code would still be templates.

lupdate is, as you aspected, used for extracting translatable strings form the 
source code.

lrelease compiles ts text files into binary qm files that are used by 
QTranslator. [0]

If you want to have your app translated you need to install a translator as 
described in [0].

Best greetings
Buschmann

[0] http://doc.qt.io/qt-5/qtranslator.html

Am Freitag, 20. März 2015, 13:18:51 schrieb stol at bredband.net:
> Hi
> 
> I created a new project, myapp, wich contain the following
> "translations" files
> 
> harbour-myapp-de.ts
> 
>  About
> 
> 
> About
> 
> harbour-myapp.ts
> 
>  About
> 
>  About
> 
> About.qml pages looks like this
> 
> 
> Page {
> ......
> ......
> 
>  title: qsTr("About")
>  }
> 
> When I compile the
> project Qt have only "built" the de file, in
> ../build-harbour-myApp-MerSDK_SailfishOS_i486-Debug/translations/
> 
> 
> harbour-lapis-de.qm
> harbour-lapis-de.ts
> 
> Should it not have built
> the other one as well, that is harbour-myapp.ts ?
> 
> If I change the file
> harbour-myapp.ts (which i assume is the default one) into
> 
> 
> harbour-myapp.ts
> 
>  About
> 
>  About
>  HELLO THERE
> 
> Nothing happens on the
> screen, title: qsTr("About"), still writes "About" and not "HELLO THERE"
> as expected.
> 
> According to Qt homepage there are some tools, lupdate
> and lrelease mention but they are not installed in the Qt
> distribution
> and entering those at the command prompt gives error
> message.
> However lupdate/lrelease seems to be used for backward
> engineering text, lupdate extracts from the source code texts
> and
> create the .ts files, which is only useful when trying to
> internationalise an finished application.
> 
> Is not qsTr using it's
> argument to look up in the .ts (.qm) files what text it should use in
> runtime?
> 
> /Stefan

-- 
Das Gesetz hat zum Schneckengang verdorben, was Adlerflug geworden wäre.
(Friedrich Schiller - Die Räuber)

Und der Buschfunk spielt gerade "Generation Nokia" von "Pascow".

www.buschmann23.de
GPG-Key: 0x614C3258
GPG Fingerprint: B770 E0D0 69CF BFC1 5FE1 D78E 3A70 A936 614C 3258
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20150320/8df032a3/attachment.pgp>


More information about the Devel mailing list