def __init__(self, iface):
        self.iface = iface
        self.settings = None

        overrideLocale = QgsSettings().value("locale/overrideFlag", False, bool)
        if not overrideLocale:
            locale = QLocale.system().name()[:2]
        else:
            locale = QgsSettings().value("locale/userLocale", "")

        QgsMessageLog.logMessage("Locale: {}".format(locale), "VoGis", Qgis.Info)
        qmPath = "{}/i18n/vogisprofiltoolmain_{}.qm".format(pluginPath, locale)

        if locale != 'de' and not os.path.exists(qmPath):
            qmPath = "{}/i18n/vogisprofiltoolmain_en.qm".format(pluginPath)

        if os.path.exists(qmPath):
            self.translator = QTranslator()
            self.translator.load(qmPath)
            QApplication.installTranslator(self.translator)
예제 #2
0
    def __init__(self, iface):
        self.iface = iface
        self.settings = None

        QgsSettings().setValue("vogisprofiltoolmain/isopen", False)

        overrideLocale = QgsSettings().value("locale/overrideFlag", False,
                                             bool)
        if not overrideLocale:
            locale = QLocale.system().name()[:2]
        else:
            locale = QgsSettings().value("locale/userLocale", "")

        QgsMessageLog.logMessage("Locale: {}".format(locale), "VoGis",
                                 Qgis.Info)
        qmPath = "{}/i18n/vogisprofiltoolmain_{}.qm".format(pluginPath, locale)

        if locale != 'de' and not os.path.exists(qmPath):
            qmPath = "{}/i18n/vogisprofiltoolmain_en.qm".format(pluginPath)

        if os.path.exists(qmPath):
            self.translator = QTranslator()
            self.translator.load(qmPath)
            QApplication.installTranslator(self.translator)