[SailfishDevel] QML translations don't work

Yann Georg Buechau nobodyinperson at gmx.de
Fri Mar 9 14:51:15 UTC 2018


Hey Osmo,

Thanks very much for the hint with the context. I was not using 
lupdate/lconvert because I don't like the dependency on QT for the build 
environment. I used xgettext but did not handle the context. I am now 
using qsTranslate, specifying the context explicitly and telling 
xgettext with the option -kqsTranslate:1c,2 to include the context. Now 
everything works. Thank you!!!

Cheers,

Yann

On 08.03.2018 21:50, Osmo Salomaa wrote:
> On Thu, Mar 8, 2018, at 20:21, Yann Büchau wrote:
>> Now my question is, what am I doing wrong so QML stuff won't translate?
>> My QML is just the python-sample with some strings wrapped with qsTr().
> What's your translation call like? Note that the context argument needs to match what is in the translation file. If you happened to copy the Pan Transit style of converting gettext po-files to Qt linguist files, then the context will be empty. I use the following helper function for QML translations: https://github.com/otsaloma/pan-transit/blob/master/qml/pan-transit.qml#L40
>



More information about the Devel mailing list