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:Python34Libsite-packagesPyQt5 ranslationsqt_zh_CN.qm文件
实际效果如下: