From: D. Michael McIntyre <michael.mcintyre@ro...> - 2011-09-26 02:44:50
While working on a translation update, I came across the following:
if (segments.size() == 1)
text = tr("Turn Linked Segment into Real Copies");
text = tr("Turn Linked Segments into Real Copies");
The translation of plurals requires special consideration for the languages
that have more complex number systems, and this code is going to have to be
rewritten, and the translations updated, to get translations done properly in
I hadn't dealt with this issue myself in quite a long time, so I had to
experiment to come up with a solution.
QString text = tr("Turn %n Linked Segment(s) into Real Copies", "",
I haven't found a way to use the %n place marker for plural handling without
having to stick the number in the text somewhere. This is mildly annoying,
but it seems to be a hard limitation of Qt.
This stuff isn't the end of the world or anything, but since we have several
new developers at work around here, I thought it was worth mentioning the
issue for people to keep in mind when writing new strings.
D. Michael McIntyre
From: Ian Gardner <ilgardner@ya...> - 2011-09-26 12:14:23
----- Original Message -----
> From: D. Michael McIntyre <michael.mcintyre@...>
> While working on a translation update, I came across the following:
> if (segments.size() == 1)
> text = tr("Turn Linked Segment into Real Copies");
> text = tr("Turn Linked Segments into Real Copies");
Ah yes, I did wonder about that when I put that in. I used the existing code in the "turn repeats into copies" command as boilerplate code without much extra thought I'm afraid, so the same fault exists in that command too.
Another fault with both repeats-to-copies and links-to-copies is that the segment selection may comprise any collection of segments, be they ordinary segments, copies, links or any mixture, so even if 10 segments are selected and none of them are links or copies, the options to convert to copies are still enabled, and the value of segments.size() will still return 10. I'll try to tidy all that up (that won't affect the strings though).
Thanks for the tip about the (s) method for translatable strings, will endevour to use it in future where appropriate.