New i18n interface for KDE 4, second try

Nicolas Goutte nicolasg at
Sat Oct 29 13:55:40 BST 2005

On Saturday 29 October 2005 12:51, Chusslove Illich wrote:
> > [...] sometimes the string has % in it and it should not be replaced.
> > (That is why there are the QString::arg with multiple QString to avoid
> > that a %2 in the first argument is replaced by the second argument.)
> This is one of the special circumstances where ki18n would be needed. One
> could use simply:
> ki18n("Blah, blah: %1 %2").arg(foo, bar).toString();
> Throughout base KDE packages, I've encountered 130 i18n calls with .arg()
> methods with more than one argument (and hence, they are not converted to
> template i18n(...) form, but to ki18n(...)...toString() form).

What I meant is that there is code having % in it. It must even be assumed for 
every string that is not controlled by code, for example strings entered by 
the user.

As Qt had not that QString::arg with multiple argument, there is code *not* 
using it. (Often you can recognise such code at string like "%3 %1 %2" where 
the numbers are not in sequence but the user-given string is the last 

> >> [: Chusslove Illich :]
> >> For example, when giving context, if they forget to specify correct
> >> call name:
> >>
> >> i18n("This is entry in menu Session", "New");
> >>
> >> the result would be that in runtime it shows "This is entry in menu
> >> Session" instead of "New" :) And a warning message about too many
> >> parameters would appear in the shell output.
> >
> > [: Nicolas Goutte :]
> > Yes, but it is not as good...
> > [...]
> > ...especially for plural form, as the singular is a valid value.
> Ugh, that is nasty. Anybody has a way around (robust check), or back to the
> drawing board? :)

I really think that long names are the way to go:


As context are sometimes long (and used/abused as comments), perhaps an 
alternate name could be *added*, like the i18nc that you have proposed. (But 
I think it must be documented as alternative, for example as recommend for 
code supposed to fit in 80 characters' width.)

By the way, it would be nice, if you could find a way to have a 

(Of course, somebody could argue that KDE is using Modula2-like identifiers 
and not ugly-C-names-with-an-underscore.)

Have a nice day!

More information about the kde-core-devel mailing list