本文整理汇总了Python中PyQt.QtCore.QCoreApplication.installTranslator方法的典型用法代码示例。如果您正苦于以下问题:Python QCoreApplication.installTranslator方法的具体用法?Python QCoreApplication.installTranslator怎么用?Python QCoreApplication.installTranslator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt.QtCore.QCoreApplication
的用法示例。
在下文中一共展示了QCoreApplication.installTranslator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt.QtCore.QCoreApplication import installTranslator [as 别名]
def __init__(self, iface):
if not valid:
return
# Save reference to the QGIS interface
self.iface = iface
try:
self.QgisVersion = unicode(QGis.QGIS_VERSION_INT)
except:
self.QgisVersion = unicode(QGis.qgisVersion)[0]
if QGis.QGIS_VERSION[0:3] < "1.5":
# For i18n support
userPluginPath = qgis.utils.home_plugin_path + "/GdalTools"
systemPluginPath = qgis.utils.sys_plugin_path + "/GdalTools"
overrideLocale = QSettings().value("locale/overrideFlag", False, type=bool)
if not overrideLocale:
localeFullName = QLocale.system().name()
else:
localeFullName = QSettings().value("locale/userLocale", "", type=str)
if QFileInfo(userPluginPath).exists():
translationPath = userPluginPath + "/i18n/GdalTools_" + localeFullName + ".qm"
else:
translationPath = systemPluginPath + "/i18n/GdalTools_" + localeFullName + ".qm"
self.localePath = translationPath
if QFileInfo(self.localePath).exists():
self.translator = QTranslator()
self.translator.load(self.localePath)
QCoreApplication.installTranslator(self.translator)
# The list of actions added to menus, so we can remove them when unloading the plugin
self._menuActions = []