KIntNumInput::setTemplate(const QString &template)

Nicolas Goutte nicolasg at snafu.de
Fri Sep 1 19:31:15 BST 2006


On Friday 01 September 2006 20:20, David Faure wrote:
> On Friday 01 September 2006 19:56, Nicolas Goutte wrote:
> > On Friday 01 September 2006 10:26, David Faure wrote:
> > > On Sunday 27 August 2006 17:41, Sébastien Laoût wrote:
> > > > Currently, the class KIntNumInput has two methods:
> > > > - setPrefix(const QString &prefix)
> > > > - setSuffix(const QString &suffix)
> > > >
> > > > This generate two problems:
> > > > 1/ No plural for is allowed.
> > > >    Or to be more precise, all numbers are always presented in the
> > > > plural form. 2/ Currency translation is bad.
> > > >    In USA, the program should call setPreffix("$ ").
> > > >    In Europe, the program should call setSuffix(" €")
> > > >    (not sure if € should be postfixed or prefixed, but it's for the
> > > > example: other currencies are placed after the number).
> > > >
> > > > For KDE 4, I propose you remove those methods in profit of that one:
> > > > - KIntNumInput::setTemplate(const QString &template)
> > > >
> > > > The two examples will be transformed to:
> > > > - setTemplate(i18n("%n minute", "%n minutes));
> > >
> > > Doesn't work that way. The syntax is i18n("1 minute", "%n minutes",
> > > number_of_minutes).
> >
> > Thank you for notifing the error but for KDE4 it becomes:
> > i18np("1 minute", "%n minutes", number_of_minutes)
>
> Yes I forgot the p when typing.
>
> > >   setTemplate( ki18np("1 minute", "%n minutes") )
> >
> > I am not 100% sure but I suppose that this will not work either.
>
> I think it will work, since this is what i18np expands to, see also the
> docu in klocalizedstring.h

Ah, yes, you are probably right. I was again thinking in term of QString, as 
it is the title of this thread. But, of course, if QString is not used as 
parameter, this should work.

Have a nice day!




More information about the kde-core-devel mailing list