[QtEI] Translation suggestion

Roland qtextended.kossel at web.de
Thu Apr 30 15:26:00 CEST 2009


Hello,

in all the applications I write with Qt I'm using the tr() function. The
advantage is, that it is much shorter to write (and therefore IMHO to read)
and that QtLinguist is automatically showing the right context. QtLinguist
organizes the strings that are translatable by context - typically the class
names. When using tr() this is set automatically, when using
qApp->translate() you have to (but also: can) set the context yourself.
Another consideration is that tr() is only available in classes derived from
QObject - but since normally the strings you want to translate are generated
in Gui-classes this is normally the case.

To sum up: Personally I prefer tr(), but it doesn't really matter what you
use.

Roland

> -----Original Message-----
> From: community-bounces at lists.openmoko.org [mailto:community-
> bounces at lists.openmoko.org] On Behalf Of Fabio Locati
> Sent: Thursday, April 30, 2009 6:41 AM
> To: List for Openmoko community discussion
> Subject: Re: [QtEI] Translation suggestion
> 
> On the doc.trolltech.com, there isn't written that QApp->translate is
> better than tr, if I read correctly.
> 
> http://doc.trolltech.com/4.5/qobject.html#tr
> http://doc.trolltech.com/4.5/qcoreapplication.html#translate
> 
> Then is better leaving the tr() or switching to QApp->translate()?
> 
> On Sun, Apr 26, 2009 at 11:33 PM, Franky Van Liedekerke
> <liedekef at telenet.be> wrote:
> > On Sun, 26 Apr 2009 23:14:05 +0200
> > Fabio Locati <fabiolocati at gmail.com> wrote:
> >
> >> I have looked around and it seems that QtEI should be translated
> with
> >> Qt Linguistic. Is this the best tool?
> >>
> >
> > I don't know the tool, but I do believe there's much work to be done
> > here: many classes still use "<tr>" while I believe every class
> should
> > use "qApp->translate" for translations.
> > Thoughts, suggestions?
> >
> > Franky
> >
> > _______________________________________________
> > Openmoko community mailing list
> > community at lists.openmoko.org
> > http://lists.openmoko.org/mailman/listinfo/community
> >
> 
> 
> 
> --
> Fabio A Locati
> 
> Home: Segrate, Milan, Italy (GMT +1)
> Phone: +39-328-3799681
> MSN/Jabber/E-Mail: fabiolocati at gmail.com
> 
> PGP Key: 9EF6 3C79 F6DF 76CD 770A 43A1 DCCB 415C 9656 3334
> 
> Envolved in: KDE, OpenStreetMap, Ubuntu, Wikimedia
> 
> _______________________________________________
> Openmoko community mailing list
> community at lists.openmoko.org
> http://lists.openmoko.org/mailman/listinfo/community





More information about the community mailing list