[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: New i18n interface for KDE 4, second try
From:       Ingo =?iso-8859-15?q?Kl=F6cker?= <kloecker () kde ! org>
Date:       2005-10-30 14:37:50
Message-ID: 200510301537.54341 () erwin ! ingo-kloecker ! de
[Download RAW message or body]


On Sunday 30 October 2005 14:40, Chusslove Illich wrote:
> Taking this multiple argument problem into account as a new element,
> we can define the templates not as I have originally suggested (eg.
> for 3 arguments):
>
> template <typename A1, typename A2, typename A3>
> friend i18n (const char *text, const A1 &a1, const A2 &a2, const A3
> &a3) { KTurtleString(text).arg(a1).arg(a2).arg(a3).toString();
> }
>
> but like this instead:
>
> template <typename A1, typename A2, typename A3>
> friend i18n (const char *text, const A1 &a1, const A2 &a2, const A3
> &a3) { KTurtleString(text).args(QString(%1).arg(a1),
>                            QString(%1).arg(a2),
>                            QString(%1).arg(a3)).toString();
> }

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.

The multiple argument variant of QString::arg() only exists for multiple 
QStrings so using something like
  QString("(x,y)=(%1,%2)").arg(3, 5)
is not possible. 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. I don't think 
that's too much a problem for developers. This would also make the 
additional idea with qarg() superfluous because the developer would use
  i18n("Directory %1: %2 MB", dir, QString::number(size, 5)).

But that's all just IMO and based on what we have to do today.

Regards,
Ingo

[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic