Le vendredi 6 janvier 2017, 14:23:23 Ted Felix a écrit : > If a class no longer derives from QObject, is it OK to change all the > tr() calls to QObject::tr() calls? Or would it be better to retain the > derivation from QObject (ugly as that may be)? > > (My limited understanding from scanning the mailing lists is that > there is something called a "translation context" and going from tr() to > QObject::tr() changes that. Or something. So perhaps this causes > headaches for translators? Deriving from QObject causes headaches for > me, but I can manage.) >
Insofar as I correctly understand http://doc.qt.io/qt-5/i18n-source-translation.html tr() should be used inside a subclass of a QObject and the class name is the translation context. Outside a QObject, QCoreApplication::translate() should be used and it's first argument is the translation context. This translation context may be the class name or any other string. The translation context helps the translator to know from where in the code (and in the GUI) the string needing a translation is coming. The about 1800 strings coming from the .rc files have the same "QObject" translation context. Only them are the cause of translators'headaches:) Yves ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Rosegarden-devel mailing list Rosegarden-devel@lists.sourceforge.net - use the link below to unsubscribe https://lists.sourceforge.net/lists/listinfo/rosegarden-devel