QApplication 加载Translator
app = QtWidgets.QApplication(sys.argv)
translator = QtCore.QTranslator()
if len(sys.argv) > 1:
locale = sys.argv[1]
else:
locale = QtCore.QLocale.system().name()
translator.load('qt_%s' % locale,
QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath))
# 切换语言,主要针对系统窗口如字体选择
app.installTranslator(translator)
Linguist修改C:\Python34\Lib\site-packages\PyQt5\translations\qt_zh_CN.qm文件
实际效果如下:
转载于:https://www.cnblogs.com/lkpp/p/7400033.html