New i18n interface for KDE 4, second try

Chusslove Illich caslav.ilic at gmx.net
Sun Oct 30 17:19:00 GMT 2005


> [: Ingo Klöcker :]
> I wonder whether we really need such a complicated solution for multiple
> arguments. I'm a bit concerned about the performance penalty that's 
> caused by this complicated construction.

Performance is really not an issue here, as we're talking about GUI stuff.

Anyway, if you'd really want to know, this particular thing (simple 
message, three placeholders, all QString arguments: the worst case) slow 
current code down about twice, but still delivering over 200,000 messages 
per second on my 1.67 GHz. And if I make all tree arguments ints, than it 
is only factor 1.3 slower. In general, any further complication (like 
plurals, context, future enhancements) will only narrow this gap of few 
indirections.

> Therefore at least for me, in the multiple argument case, something like
>  i18n( const char *text, const QString & a1, const QString & a2, const 
> QString & a3 )
> would suffice because currently for using QString::arg( a1, a2, a3 ) we
> already need to convert numbers to QString ourselves.

But if you don't have to, why not allow for that (performance not being the 
issue)? And I'm not sure that people wouldn't object having to use that 
QString::number() whenever numerical argument comes, even if no special 
formating is needed.

> [...] the additional idea with qarg() [is] superfluous because the
> developer would use
> i18n("Directory %1: %2 MB", dir, QString::number(size, 5)).

I was just aiming at providing already common arg() behaviour, I don't 
insist since it is just for rare formating needs. Can be added later if 
needed, as it is independant of the base system.

-- 
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/20051030/c894b714/attachment.sig>


More information about the kde-core-devel mailing list