Removing %n in plural i18n calls

Caslav Ilic caslav.ilic at gmx.net
Mon Feb 12 11:50:21 GMT 2007


> [: Olaf Schmidt :]
> What happens with sentences that have two numbers that can each be
> plural? Are developers asked to reformulate this to two separate
> sentences?

This is indeed one formulation, although rare, still frequent enough to be 
at least worth a sort of "patterned" solution.

I wouldn't ask programmer to split the sentence, because that would be 
adapting the need to the solution, rather than the other way around, which 
I don't like.

I'd propose going against one of the basic i18n tenents: to interpolate 
parts of the sentence, but carefully and explained by context. Eg. this:

msg = i18n("We have %1 ships and %2 planes", n1, n2)

would be reformulated as:

str1 = i18ncp("ctag-shp1: part of ctag-shpc", "a ship", "%1 ships", n1);
str2 = i18ncp("ctag-shp2: part of ctag-shpc", "a plane", "%1 planes", n2);
msg = i18nc("ctag-shpc: %1 translation of ctag-shp1 and %2 of ctag-shp2",
            "We have %1 and %2", str1, str2);

(with context strings possibly being less formal and more verbose :)

This gives translator almost full control, as he is free to take parts of 
main sentence and put into interpolated translations (eg. verb "have" 
above), to achieve correct congruence.

It still wouldn't work if a part of the main sentence would depend on 
*combination* of two numbers, in case of which, well... I'll be working on 
that scripting engine.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070212/95f485d7/attachment.sig>


More information about the kde-core-devel mailing list