New i18n interface for KDE 4, second try

Ingo Klöcker kloecker at kde.org
Sat Oct 29 00:01:59 BST 2005


On Tuesday 25 October 2005 16:25, Chusslove Illich wrote:
> After some more toying with the code, here is the summary.
>
> Just a reminder: the new interface is needed if we want to capture
> arguments which replace the %NN placeholders in an i18n call, and
> that is needed because we want to employ translator-side scripting of
> some grammar-wise nasty messages.
>
> Basic idea was to make a new class derived from QString, which has
> overridden arg() methods. This was discussed a lot, and while it
> would make least impact on existing i18n practices, almost preserving
> source compatibility, it had a need for some hacks (because QString
> was not designed for inheritance). However, due to its
> non-intrusivity, I feel this still to be an option, so I mention it
> here.
>
> The other feasible idea was to make a new class, say named KTrString,
> but not derived from QString and without any implicit conversions to
> QString, and therefore with a special method to finalize translation,
> i.e. like:
>
> i18n("Blah, blah: %1 %2").arg(foo).arg(bar).toString();

I don't really want to comment on those proposals. Instead I just want 
to point out that sometimes it's important to make several replacements 
at once (like the multi-argument variant of QString::arg()). Why? 
Because sometimes it's impossible to guarantee that a replacement 
string doesn't contain "%1".

So whatever solution you choose please make sure that it's possible to 
make several replacements in one pass. We need this in KMail.

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/20051029/280c9c5e/attachment.sig>


More information about the kde-core-devel mailing list