New i18n interface for KDE 4, second try
Nicolas Goutte
nicolasg at snafu.de
Sun Oct 30 19:19:38 GMT 2005
On Sunday 30 October 2005 18:19, Chusslove Illich wrote:
> > [: 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.
Well, we have complex dialogs too for example. They should avoid to need
seconds more to load on a not-so-fast computer.
(Also performance can be important if the computer is a server handling
thin-clients.)
>
> 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.
Keeping the interface simple means that you can have less surprises. Let
QString do what it can do well and put in the special class only what is
needed for a correct translation.
Especially that I suppose that numbers do not need really a special handling
for scripting. (Somebody wanting to replace (European) Arabic digits by
Indian-Arabic digits would probably want to convert all occurences of
numbers, be they in strings, 32 bit ints, 64 bit ints, floats, doubles, long
doubles or whatever variable type that can hold a number.)
(...)
Have a nice day!
More information about the kde-core-devel
mailing list