[SailfishDevel] Translate

Oleksii Serdiuk contacts at oleksii.name
Tue Jun 30 14:22:56 UTC 2015


Slightly off-topic, but...

On 28/06/15 22:02, Rudi Timmermans wrote:
> lbWalletDetails.text = qsTr("you have") + "<b> " + wallet.currency + " "
> + wallet.budget + "</b> " + qsTr("per") + " " +
> Util.budgetTypeNoun(wallet.budget_type)

Please, don't mark for translation this way. Firstly, this won't work 
with RTL languages. Secondly, some languages might have different order 
of words (e.g., position of nouns, verbs, etc.).

Use placeholders instead:

 > //: %1 - currency, %2 - amount / value, %3 - budget type
> lbWalletDetails.text = qsTr("you have <b>%1 %2</b> per %3").arg(wallet.currency).arg(wallet.budget).arg(Util.budgetTypeNoun(wallet.budget_type))

"//:" marks a comment that will be displayed to translator in Qt 
Linguist. If it's not obvious from the text, it's good to explain here 
what each placeholder means.

Also, there is a nice page on QML/JS translation in Qt documentation:
http://doc.qt.io/qt-5/qtquick-internationalization.html

But I recommend reading all "Internationalization with Qt" section:
http://doc.qt.io/qt-5/internationalization.html

-- 
With best regards,
Oleksii Serdiuk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4740 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20150630/f3ae336d/attachment.bin>


More information about the Devel mailing list