Added multilanguage support in the About dialog

This commit is contained in:
alby128 2017-10-13 12:52:51 +02:00
parent b14edac862
commit d07b2a4cbb
4 changed files with 30 additions and 6 deletions

View File

@ -282,6 +282,14 @@ de = {
"help-menu-label" : u"&Hilfe", "help-menu-label" : u"&Hilfe",
"userguide-menu-label" : u"&Benutzerhandbuch öffnen", "userguide-menu-label" : u"&Benutzerhandbuch öffnen",
"update-menu-label" : u"auf &Aktualisierung prüfen", "update-menu-label" : u"auf &Aktualisierung prüfen",
#About dialog - TODO: Translate
"about-menu-label": u"&About Syncplay",
"about-dialog-title": u"About Syncplay",
"about-dialog-release": u"Version {} release {}",
"about-dialog-license-text" : u"Licensed under the Apache License, Version 2.0",
"about-dialog-license-button": u"License",
"about-dialog-dependencies": u"Dependencies",
"setoffset-msgbox-label" : u"Offset einstellen", "setoffset-msgbox-label" : u"Offset einstellen",
"offsetinfo-msgbox-label" : u"Offset (siehe http://syncplay.pl/guide/ für eine Anleitung [Englisch]):", "offsetinfo-msgbox-label" : u"Offset (siehe http://syncplay.pl/guide/ für eine Anleitung [Englisch]):",

View File

@ -282,6 +282,14 @@ en = {
"help-menu-label" : "&Help", "help-menu-label" : "&Help",
"userguide-menu-label" : "Open user &guide", "userguide-menu-label" : "Open user &guide",
"update-menu-label" : "Check for &update", "update-menu-label" : "Check for &update",
#About dialog
"about-menu-label": u"&About Syncplay",
"about-dialog-title": u"About Syncplay",
"about-dialog-release": u"Version {} release {}",
"about-dialog-license-text" : u"Licensed under the Apache License, Version 2.0",
"about-dialog-license-button": u"License",
"about-dialog-dependencies": u"Dependencies",
"setoffset-msgbox-label" : "Set offset", "setoffset-msgbox-label" : "Set offset",
"offsetinfo-msgbox-label" : "Offset (see http://syncplay.pl/guide/ for usage instructions):", "offsetinfo-msgbox-label" : "Offset (see http://syncplay.pl/guide/ for usage instructions):",

View File

@ -284,6 +284,14 @@ ru = {
"help-menu-label" : u"&Помощь", "help-menu-label" : u"&Помощь",
"userguide-menu-label" : u"&Руководство пользователя", "userguide-menu-label" : u"&Руководство пользователя",
"update-menu-label" : u"Проверить &обновления", "update-menu-label" : u"Проверить &обновления",
#About dialog - TODO: Translate
"about-menu-label": u"&About Syncplay",
"about-dialog-title": u"About Syncplay",
"about-dialog-release": u"Version {} release {}",
"about-dialog-license-text" : u"Licensed under the Apache License, Version 2.0",
"about-dialog-license-button": u"License",
"about-dialog-dependencies": u"Dependencies",
"setoffset-msgbox-label" : u"Установить смещение", "setoffset-msgbox-label" : u"Установить смещение",
"offsetinfo-msgbox-label" : u"Смещение (см. инструкцию на странице www.syncplay.pl/guide):", "offsetinfo-msgbox-label" : u"Смещение (см. инструкцию на странице www.syncplay.pl/guide):",

View File

@ -97,15 +97,15 @@ class AboutDialog(QtGui.QDialog):
if sys.platform.startswith('darwin'): if sys.platform.startswith('darwin'):
self.setWindowTitle("") self.setWindowTitle("")
else: else:
self.setWindowTitle("About Syncplay") self.setWindowTitle(getMessage("about-dialog-title"))
if sys.platform.startswith('win'): if sys.platform.startswith('win'):
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
nameLabel = QtGui.QLabel("<center><strong>Syncplay</strong></center>") nameLabel = QtGui.QLabel("<center><strong>Syncplay</strong></center>")
nameLabel.setFont(QtGui.QFont("Helvetica", 20)) nameLabel.setFont(QtGui.QFont("Helvetica", 20))
linkLabel = QtGui.QLabel("<center><a href=\"http://syncplay.pl\">syncplay.pl</a></center>") linkLabel = QtGui.QLabel("<center><a href=\"http://syncplay.pl\">syncplay.pl</a></center>")
linkLabel.setOpenExternalLinks(True) linkLabel.setOpenExternalLinks(True)
versionLabel = QtGui.QLabel("<center>Version v" + version + " release " + release_number + "</center>") versionLabel = QtGui.QLabel("<center>" + getMessage("about-dialog-release").format(version, release_number) + "</center>")
licenseLabel = QtGui.QLabel("<center><p>Copyright &copy; 2017 Syncplay</p><p>Licensed under the Apache&nbsp;License,&nbsp;Version 2.0</p></center>") licenseLabel = QtGui.QLabel("<center><p>Copyright &copy; 2017 Syncplay</p><p>" + getMessage("about-dialog-license-text") + "</p></center>")
aboutIconPixmap = QtGui.QPixmap(self.resourcespath + u"syncplay.png") aboutIconPixmap = QtGui.QPixmap(self.resourcespath + u"syncplay.png")
aboutIconLabel = QtGui.QLabel() aboutIconLabel = QtGui.QLabel()
aboutIconLabel.setPixmap(aboutIconPixmap.scaled(120, 120, Qt.KeepAspectRatio)) aboutIconLabel.setPixmap(aboutIconPixmap.scaled(120, 120, Qt.KeepAspectRatio))
@ -115,11 +115,11 @@ class AboutDialog(QtGui.QDialog):
aboutLayout.addWidget(linkLabel, 1, 2, 1, 2) aboutLayout.addWidget(linkLabel, 1, 2, 1, 2)
aboutLayout.addWidget(versionLabel, 2, 2, 1, 2) aboutLayout.addWidget(versionLabel, 2, 2, 1, 2)
aboutLayout.addWidget(licenseLabel, 3, 2, 1, 2) aboutLayout.addWidget(licenseLabel, 3, 2, 1, 2)
licenseButton = QtGui.QPushButton("License") licenseButton = QtGui.QPushButton(getMessage("about-dialog-license-button"))
licenseButton.setAutoDefault(False) licenseButton.setAutoDefault(False)
licenseButton.clicked.connect(self.openLicense) licenseButton.clicked.connect(self.openLicense)
aboutLayout.addWidget(licenseButton, 4, 2) aboutLayout.addWidget(licenseButton, 4, 2)
dependenciesButton = QtGui.QPushButton("Dependencies") dependenciesButton = QtGui.QPushButton(getMessage("about-dialog-dependencies"))
dependenciesButton.setAutoDefault(False) dependenciesButton.setAutoDefault(False)
dependenciesButton.clicked.connect(self.openDependencies) dependenciesButton.clicked.connect(self.openDependencies)
aboutLayout.addWidget(dependenciesButton, 4, 3) aboutLayout.addWidget(dependenciesButton, 4, 3)
@ -1424,7 +1424,7 @@ class MainWindow(QtGui.QMainWindow):
if not sys.platform.startswith('darwin'): if not sys.platform.startswith('darwin'):
window.helpMenu.addSeparator() window.helpMenu.addSeparator()
window.about = window.helpMenu.addAction(QtGui.QIcon(self.resourcespath + 'syncplay.png'), window.about = window.helpMenu.addAction(QtGui.QIcon(self.resourcespath + 'syncplay.png'),
'About Syncplay') getMessage("about-menu-label"))
else: else:
window.about = window.helpMenu.addAction("&About") window.about = window.helpMenu.addAction("&About")
window.about.triggered.connect(self.openAbout) window.about.triggered.connect(self.openAbout)