New i18n interface for KDE 4, second try

Ingo Klöcker kloecker at kde.org
Sun Oct 30 14:37:50 GMT 2005


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
-------------- 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/6d92c85c/attachment.sig>


More information about the kde-core-devel mailing list