translation - Qt qsTr() handling plurals -
im developing , applicacion , want translate text, problem when want handle in qml plurals.
in c++, way handle plurals simple as:
int n = messages.count(); showmessage(tr("%n message(s) saved", 0, n));
and translate without problems
source: http://qt-project.org/doc/qt-4.8/i18n-source-translation.html#handling-plurals
when seek same qml doesnt work. after carefull review of literature, , comments found out "solution", it's people reporting bug.
var sec = qstr("%b radios", "0", map.radio).arg(map.radio)
source:https://bugreports.qt-project.org/browse/qtbug-11579
when lupdate, in qtlinguistic appears 2 fields plural , singular form, in application not work.
i tried several modifications such as:
var = map.totalsongs; var first = qstr("%a songs", "0", parseint(a)) var sec = qstr("%b radios", "0", map.radio) var first = qstr("%a songs", "0", parseint(a)).arg(map.totalsongs) var sec = qstr("%b radios", "0", map.radio).arg(map.radio) var first = qstr("%a songs", "0", a) var sec = qstr("%b radios", "0", b)
in qtlinguistic im writting translation:
%b radio - singular %b radios - plural
any modification fails work.
can 1 tell me how utilize qstr() handle plurals?
other question related: lets want have text "%1 songs - %2 radios", in spanish should result in
//as illustration if(%1 = 10 && %2 = 10) => "10 canciones - radios" else if(%1 = 1 && %2 = 10) => "1 cancion - 10 radios" else if(%1 = 10 && %2 = 1) => "10 canciones - 1 radio"
how it? think either qstr() or tr() can not handle situation., want verify guys :d
thanks in advance
i couldnt take not working went little farther , find solution, maybe seems obvious, dont think so.
doesnt work
var = map.totalsongs; var first = qstr("%a songs", "0", a)
works because utilize variable n
var n = map.radio; var first = qstr("%n songs", "0", n)
qt translation qml tr
No comments:
Post a Comment