Hi devs,
For do the plugin translations I use
1) Linguist from QT52) The command line: 
    Pylupdate4 -noobsolete PluginName.pro (Is there a new version 5??)
3) and the classical code:
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'PluginName_{}.qm'.format(locale))

        if os.path.exists(locale_path):
            self.translator = QTranslator()
            self.translator.load(locale_path)

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)
        def tr(self, message):
            return QCoreApplication.translate(QWaterPlugin.SETTINGS, message)

The problem is that the option to use self.tr('message string') is not working. 
It only works when I use QCoreApplication.translate('Escope', 'message string') 
even if a tr function defined.

It used to work if linguist from QT4.

What  Am I doing wrong? BTW Is there a new better way to translate plugins?
Thanks,
Jorge Almerio

_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to