Handling plurals with no numbers inthe text?
-
I set the group-box title for singular/plural using an appropriate tr() invocation:
ui->dropFiles->setTitle(tr("Add %n file(s) as", "IDC_DROPFILESTEXT", static_cast<int>(fileCount)));
But the radio buttons being plural is a bit tacky....
Is it possible to do this:
lightFrames->setText(QCoreApplication::translate("DropFilesDlg", "Light Frames", "IDC_LIGHTFRAMES", static_cast<int>(fileCount)));
and set the singular form to "A Light Frame" and the plural form to "Light Frames"?
Clearly I'll need to move the translation stuff into my code rather than having it in the ui header.
-
Simply add a function and eithter set the text for one or for more items (and hopefully don't have to translate to languages which has more translations)
-
@Perdrix said in Handling plurals with no numbers inthe text?:
Yes Polish is a bear to translate plurals.
Purely OoI, given this topic is solved, why is that? I know no Polish!
@JonB In Polish, there isn't just singular and plural, there are three forms:
Singular: n = 1 Paucal: n = 2--4, 22--24, 32--34, 42--44, ... Plural: n = 0, 5--21, 25--31, 35--41, ...
Luckily Qt understands that and offers three forms for Polish translation.
D. -
@JonB In Polish, there isn't just singular and plural, there are three forms:
Singular: n = 1 Paucal: n = 2--4, 22--24, 32--34, 42--44, ... Plural: n = 0, 5--21, 25--31, 35--41, ...
Luckily Qt understands that and offers three forms for Polish translation.
D. -
Deadly serious! Dom is Polish for house.
0 dom贸w
1 dom
2 domy
5 dom贸w
21 dom贸w
22 domyetc..
D.
-
-
@jsulm
OMG. But this is not practical! If I want to ask you about the cows in the field, and I want to speak very correct Polish, I have to first count to check whether there are 21 or 22 or 25 of them....! -
@Perdrix
What? Are you serious?? You have to count how many in ranges to decide how "plural" they are??? Surely you can't have a different word-plural for if it's between 2 and 4 in each ten.....@JonB said in Handling plurals with no numbers inthe text?:
@Perdrix
What? Are you serious?? You have to count how many in ranges to decide how "plural" they are??? Surely you can't have a different word-plural for if it's between 2 and 4 in each ten.....Somewhat similar in English are the endings of ordinal numbers. 1st, 2nd, 3rd, 4th, ...11th, 12th, 13th,... 21st, 22nd, 23rd, 24th,..., etc.
-
@JonB said in Handling plurals with no numbers inthe text?:
@Perdrix
What? Are you serious?? You have to count how many in ranges to decide how "plural" they are??? Surely you can't have a different word-plural for if it's between 2 and 4 in each ten.....Somewhat similar in English are the endings of ordinal numbers. 1st, 2nd, 3rd, 4th, ...11th, 12th, 13th,... 21st, 22nd, 23rd, 24th,..., etc.
-
This got a little side tracked. But, I think I have another solution to offer.
In the original code you could actually write
tr("%nLight Frames", fileCount)
. Then you would also need an English translation. The English translation file also just needs the translations for where you are using these plurals because everywhere else it will fall back to the language in the source code (which happens to be English 馃槉). Any translation would certainly drop the%n
, but could use it to differentiate the plurals.