[Kde-perl] Handling primitive type conversion in bindings (QString, QCString, QByteArray etc)

Ashley Winters kde-perl@mail.kde.org
Mon, 2 Dec 2002 11:38:47 -0800 (PST)


--- Adam Treat <manyoso@yahoo.com> wrote:
> On Wednesday 27 November 2002 02:34 pm, Ashley Winters wrote:
> >
> > For backward compatibility, and plain old usability, all those
> classes
> > will have their "" (stringify) operator overloaded so that if you
> use
> > it like a string, it looks like a string.
> 
> Interesting.  You plan on making QString into a bonafied PerlQt class
> and then 
> provide a means for creation with "".

That's not quite where I was going, but it's a brilliant idea
nonetheless. I was just saying a QString, when used *as* a Perl string,
would pretend to be a Perl string. It's also possible to overload the
qq operator (in Perl, "foo" and qq{foo} are 100% identical, except for
the delimiters) to create a QString. Not only that, the qq operator
could be made to call tr() on every string in a module! This has happy
internationalization implications.

$label->setText("F&oo");  # identical to $label->setText(tr("F&oo"))

This would be enabled pragmatically, of course. Something like:

use Qt::translate;

And, in order to grab all the translatable strings in a module, you
could do:

perl -MQt::translate=dump -c Module.pm

It would only go through the compile stage of loading the module, and
it would make the translate module dump out whatever format file the Qt
translation utilities need with all the hard-coded strings in Perl.

Anyone know how translation works? Should I bother the KDE i18n people?

I don't wanna go away for 3 days! I need a laptop.

Ashley Winters

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com