Skip to content

Commit 87de7ee

Browse files
committed
增加翻译
1 parent 8347ee3 commit 87de7ee

File tree

5 files changed

+59
-15
lines changed

5 files changed

+59
-15
lines changed

Resources/pyqtclient_zh_CN.qm

366 Bytes
Binary file not shown.

Widgets/MainWindow.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from PyQt5 import QtCore
1818
from PyQt5.QtCore import QEvent, Qt, QTimer, pyqtSlot, QUrl, QProcess,\
19-
QProcessEnvironment, QLibraryInfo
19+
QProcessEnvironment, QLibraryInfo, QCoreApplication
2020
from PyQt5.QtGui import QEnterEvent, QIcon
2121

2222
from UiFiles.Ui_MainWindow import Ui_FormMainWindow
@@ -86,7 +86,8 @@ def _initUpdate(self):
8686

8787
def _initCatalog(self):
8888
# 更新目录
89-
self._showNotice('正在更新例子代码')
89+
self._showNotice(QCoreApplication.translate(
90+
'MainWindow', 'Update Example Started'))
9091
CloneThread.start()
9192

9293
@pyqtSlot(str)

Widgets/MainWindowBase.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import os
1313
import webbrowser
1414

15-
from PyQt5.QtCore import pyqtSlot, QUrl, QLocale, QTranslator
15+
from PyQt5.QtCore import pyqtSlot, QUrl, QLocale, QTranslator, QCoreApplication
1616
from PyQt5.QtGui import QColor, QCursor
1717
from PyQt5.QtWebKit import QWebSettings
1818
from PyQt5.QtWebKitWidgets import QWebPage
@@ -86,7 +86,9 @@ def _initSignals(self):
8686
Signals.showReadmed.connect(self.renderReadme)
8787
Signals.urlLoaded.connect(self.onUrlLoaded)
8888
Signals.runExampled.connect(self._runFile)
89-
Signals.cloneFinished.connect(lambda: self._showNotice('更新例子完成'))
89+
Signals.cloneFinished.connect(lambda: self._showNotice(
90+
QCoreApplication.translate(
91+
'MainWindowBase', 'Update Example Finished')))
9092
Signals.cloneFinished.connect(self.treeViewCatalogs.initCatalog)
9193
Signals.cloneFinished.connect(self.renderReadme)
9294
Signals.progressStoped.connect(self.widgetCatalogs.stop)
@@ -101,17 +103,22 @@ def _initLanguage(self):
101103
translator = QTranslator(self)
102104
translator.load('Resources/pyqtclient_zh_CN.qm')
103105
QApplication.instance().installTranslator(translator)
106+
AppLog.info('install local language')
104107

105108
def _initWebView(self):
106109
"""初始化网页"""
107110
# 右键菜单
108-
self._webviewMenu = QMenu(self.tr('Menu'), self.webViewContent)
111+
self._webviewMenu = QMenu(QCoreApplication.translate(
112+
'MainWindowBase', 'Menu'), self.webViewContent)
109113
self._webviewactRun = QAction(
110-
self.tr('Run'), self._webviewMenu, triggered=self._doActRun)
114+
QCoreApplication.translate(
115+
'MainWindowBase', 'Run'), self._webviewMenu, triggered=self._doActRun)
111116
self._webviewactView = QAction(
112-
self.tr('View'), self._webviewMenu, triggered=self._doActView)
117+
QCoreApplication.translate(
118+
'MainWindowBase', 'View'), self._webviewMenu, triggered=self._doActView)
113119
self._webviewactFolder = QAction(
114-
self.tr('Open'), self._webviewMenu, triggered=self._doActOpen)
120+
QCoreApplication.translate(
121+
'MainWindowBase', 'Open'), self._webviewMenu, triggered=self._doActOpen)
115122
self._webviewMenu.addAction(self._webviewactRun)
116123
self._webviewMenu.addAction(self._webviewactView)
117124
self._webviewMenu.addAction(self._webviewactFolder)

pyqtclient_zh_CN.ts

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,37 +186,37 @@
186186
<context>
187187
<name>FormMainWindow</name>
188188
<message>
189-
<location filename="UiFiles/Ui_MainWindow.py" line="161"/>
189+
<location filename="UiFiles/Ui_MainWindow.py" line="162"/>
190190
<source>PyQtClient</source>
191191
<translation>PyQtClient</translation>
192192
</message>
193193
<message>
194-
<location filename="UiFiles/Ui_MainWindow.py" line="162"/>
194+
<location filename="UiFiles/Ui_MainWindow.py" line="163"/>
195195
<source>Project Url</source>
196196
<translation>项目网址</translation>
197197
</message>
198198
<message>
199-
<location filename="UiFiles/Ui_MainWindow.py" line="163"/>
199+
<location filename="UiFiles/Ui_MainWindow.py" line="164"/>
200200
<source>QQ Chat</source>
201201
<translation>QQ聊天</translation>
202202
</message>
203203
<message>
204-
<location filename="UiFiles/Ui_MainWindow.py" line="164"/>
204+
<location filename="UiFiles/Ui_MainWindow.py" line="165"/>
205205
<source>QQ Group</source>
206206
<translation>QQ群聊</translation>
207207
</message>
208208
<message>
209-
<location filename="UiFiles/Ui_MainWindow.py" line="165"/>
209+
<location filename="UiFiles/Ui_MainWindow.py" line="166"/>
210210
<source>Home Page</source>
211211
<translation>主页</translation>
212212
</message>
213213
<message>
214-
<location filename="UiFiles/Ui_MainWindow.py" line="166"/>
214+
<location filename="UiFiles/Ui_MainWindow.py" line="167"/>
215215
<source>Back to Top</source>
216216
<translation>返回顶部</translation>
217217
</message>
218218
<message>
219-
<location filename="UiFiles/MainWindow.ui" line="391"/>
219+
<location filename="UiFiles/MainWindow.ui" line="394"/>
220220
<source>about:blank</source>
221221
<translation></translation>
222222
</message>
@@ -283,6 +283,42 @@
283283
<translation>更新</translation>
284284
</message>
285285
</context>
286+
<context>
287+
<name>MainWindow</name>
288+
<message>
289+
<location filename="Widgets/MainWindow.py" line="89"/>
290+
<source>Update Example Started</source>
291+
<translation>正在更新例子代码文件</translation>
292+
</message>
293+
</context>
294+
<context>
295+
<name>MainWindowBase</name>
296+
<message>
297+
<location filename="Widgets/MainWindowBase.py" line="89"/>
298+
<source>Update Example Finished</source>
299+
<translation>更新例子代码完成</translation>
300+
</message>
301+
<message>
302+
<location filename="Widgets/MainWindowBase.py" line="108"/>
303+
<source>Menu</source>
304+
<translation>菜单</translation>
305+
</message>
306+
<message>
307+
<location filename="Widgets/MainWindowBase.py" line="109"/>
308+
<source>Run</source>
309+
<translation>运行</translation>
310+
</message>
311+
<message>
312+
<location filename="Widgets/MainWindowBase.py" line="111"/>
313+
<source>View</source>
314+
<translation>查看</translation>
315+
</message>
316+
<message>
317+
<location filename="Widgets/MainWindowBase.py" line="113"/>
318+
<source>Open</source>
319+
<translation>打开</translation>
320+
</message>
321+
</context>
286322
<context>
287323
<name>Repository</name>
288324
<message>

translations/pyqtclient_zh_CN.qm

-4.86 KB
Binary file not shown.

0 commit comments

Comments
 (0)