On Tuesday 15 December 2015 17:47:12 Yves Guillemot wrote:
> Le mardi 15 décembre 2015, 06:42:53 D. Michael McIntyre a écrit :
> > On 12/15/2015 05:45 AM, Yves Guillemot wrote:
> > > It's probably a bit more complex, nevertheless it should not be very
> > > difficult to add an "undo last clear" button.
> > 
> > That seems like more trouble than the hypothetical problem is worth.
> 
> It was quite simple: Done in rev. 14409.

In that commit there are a number of calls to tr() in the initialization
of global QStrings, like:

+static const QString clearLabel(QObject::tr("Clear", "Button label"));

That is not going to work, it's going to try and translate the string before
even main() starts, so the choice of language didn't happen yet
and the translations are not loaded.

You need to call tr() from functions, or use the QT_TR_NOOP indirection
(which allows static strings translated later on at runtime, but still
marked for translation so that lupdate picks them up).

In this case a bunch of private method should do the job,
although of course they don't have to just return a QString,
they can set it onto the right button directly, i.e. one method
could do m_reloadButton->setText(tr(...)) + m_reloadButton->setToolTip(tr(...))

Also note that QObject::tr loses the class context, while tr() in a qobject
subclass will use that classname as context.

-- 
David Faure, fa...@kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5


------------------------------------------------------------------------------
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@lists.sourceforge.net - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to