2016-03-07 20:16 GMT+01:00 Jason H <jh...@gmx.com>: >> > Ok I'm getting there, but how do I specify this string (a) or that string >> > (b)? >> > What's the qsTr() line look like? >> > qsTr( ? ) >> >> http://doc.qt.io/qt-5/i18n-plural-rules.html >> >> and >> >> http://doc.qt.io/qt-5/i18n-source-translation.html >> >> -> chapter Handling Plurals > > Yeao, read them both before posting. > > Please provide the tr line as even after re-reading I don't think it (is/are > selection) can be done, and please reference where the docs cover that syntax. > > To put it in s more documentation example way: > Example: tr("%n message(s) saved", "", n) ) > What I want: tr("%n messages(s) [were|was] saved)", "", n) <- what do I need > to modify here to get was/were resolving correctly? > > The page on http://doc.qt.io/qt-5/i18n-plural-rules.html does not seem to be > of help. It only tells me the rules Qt uses internally for determining > pluralization. I do not see how I can supply a plural and non-plural string, > or a string that works in both contexts and included is/are or was/were, > respectively.
I'm under the impression that you believe tr is responsible for selecting the correct singular/plural form based on what string you give to it in the source code. As silly as it sound and just to strike that possibility out, tr is not, by itself, deducing by some clever rules the singular or plural form of the string given as argument. The string itself is used as a key to look up the correct string to display in a translation file (aka ts file). The string given to tr doesn't have to be related in any way to the final displayed string although it helps the translator greatly if they do :-). That's why every sample code out there might mislead you into believing that tr is doing all the work. In fact, the translator is doing the work (using linguist). If for instance I write tr("%n whatever rubbish I type here", "", n) and the translator decides to translate "%n whatever rubbish I insert here" with "One message was saved" for singular and "%n messages were saved" for plural, then, the user will see those last two strings. The user will never see the original "%n whatever rubbish I insert here" string from the source code. Now, you were told to use an en_US translation file because it is in that file that you'll tell tr what the correct singular and plural messages are. The translation file is not exclusively used to translate your application. It can be used to translate from bad/technical English into proper English or, as in your case, to provide decent singular and plural strings. Frederic _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest