New i18n interface for KDE 4, second try

Chusslove Illich caslav.ilic at gmx.net
Mon Oct 31 21:36:43 GMT 2005


> I meant that if QString::number does the job, we do not need a wrapper
> around it. (What the proposed qarg are, even if the shown code used an
> indirect way, instead of calling QString::number directly.)

QString::number() has only one extra argument for the base, whereas arg() 
methods have also "field width" argument, which might be important in 
formatted output. But again, they are not important at all and were just a 
side remark.

One more substantial thingy occurred to me as well. In Qt4, there is an 
option to use proper localized number formats, by "%Lxx" placeholder 
notation. This however would require programmer/translator to always use 
it for number arguments in their strings, which is, well... :) On the 
other hand, presence of standalone argf functions (which would also be 
used in i18n templates), would allow to automatically force "%Lxx" only 
for numerical arguments.

> On the other side, I am just remembering that one of the original
> arguments for translation scriptings were phrases with multiple
> plurals, so that is perhaps a problem indeed, as the multiple counts
> must be given.

Not only that, there is one much more frequent case. Where programmer would 
use eg. "Do you want to delete this file?" and "Do you want to delete 
these %n files?", in my language I'd have to use singular with %n, because 
some numbers other than 1 need same form. So for 1 I'd get "Do you want to 
delete this 1 file?", which is in my language as awkward as in English.

I've just implemented (in 3.5) the last discussed template solution (the 
"complicated" one), and I'm rebuilding everything *yet again* :) But I'm 
really beginning to like it: no dangerous arg() concatenations, no 
ambiguities with placeholder substitutions, perhaps those localized number 
formats, and script which will roam through code for misnamed i18n calls 
will produce positive side effect that messages won't have their arguments 
ripped out (ie. substituted outside of i18n call, after it becomes just a 
QString).

-- 
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/20051031/1a84e1fd/attachment.sig>


More information about the kde-core-devel mailing list