Removing %n in plural i18n calls

Chusslove Illich caslav.ilic at gmx.net
Sun Feb 11 14:48:24 GMT 2007


For some time I wanted to propose removal of special %n placeholder in 
plural *i18np, *i18ncp calls. Instead, only ordinary numbered placeholders 
are to be used, and the first integer-valued one determines the plural 
form.

I believe %n to be unnecessary, legacy element of i18n API. All-numbered 
placeholders would mean that all strings could be recognized by Gettext as 
qt-format, and we would thus get Gettext's checks working (though 
qt-format in Gettext is a bit out of date, but that is a matter of having 
it patched upstream).

There was also a discussion on kde-i18n-doc some months ago, you can take a 
look for reference: 
http://lists.kde.org/?l=kde-i18n-doc&m=115197256218486&w=2 (note that 
there I proposed %1 to always determine plural, whether now it's first 
integer-valued placeholder).

As another streamlining, I've also decided to disallow gaps in placeholders 
sequence, ie. i18n("Blah %1 blah %3 blah", ...) would no longer be legal. 
I originally kept it by inertia from QString, but QString probably needs 
it only because its single-argument arg() methods operate one after 
another, so each next application doesn't see the previous placeholder.

Taken together, if you now wonder whether this is still legal:

i18np("One file in folder %2", "%1 files in folder %2", nfiles, folder)

yes it is, because the placeholder corresponding to plural argument is 
excepted from sequence rule, it is allowed to be missing in either 
singular or plural.

From technical side, the changes are pretty much ready:

- KLocalizedString implementation changes ready to commit
- the conversion script for already ported KDE4 code ready
- the conversion script for fresh KDE3 sources updated
- KLocalizedString API doc updated
- kdelibs/KDE4PORTING.html updated
- KLocalizedString tests updated
- checked to compile: kdelibs, kdepimlibs, kdebase

(I would convert everything in trunk/KDE, and commit the conversion script 
for any KDE4 code outside.)

Providing that we go with this, when would be the best moment to commit the 
converted trunk/KDE?

-- 
Chusslove Illich (Часлав Илић)
-------------- 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/20070211/1bb1603f/attachment.sig>


More information about the kde-core-devel mailing list