From d07b2a4cbb68f4af4fca0c4755d5b13d91137057 Mon Sep 17 00:00:00 2001 From: alby128 Date: Fri, 13 Oct 2017 12:52:51 +0200 Subject: [PATCH] Added multilanguage support in the About dialog --- syncplay/messages_de.py | 8 ++++++++ syncplay/messages_en.py | 8 ++++++++ syncplay/messages_ru.py | 8 ++++++++ syncplay/ui/gui.py | 12 ++++++------ 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/syncplay/messages_de.py b/syncplay/messages_de.py index c35603f..01925b8 100644 --- a/syncplay/messages_de.py +++ b/syncplay/messages_de.py @@ -282,6 +282,14 @@ de = { "help-menu-label" : u"&Hilfe", "userguide-menu-label" : u"&Benutzerhandbuch öffnen", "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", "offsetinfo-msgbox-label" : u"Offset (siehe http://syncplay.pl/guide/ für eine Anleitung [Englisch]):", diff --git a/syncplay/messages_en.py b/syncplay/messages_en.py index 768193a..acb9bea 100644 --- a/syncplay/messages_en.py +++ b/syncplay/messages_en.py @@ -282,6 +282,14 @@ en = { "help-menu-label" : "&Help", "userguide-menu-label" : "Open user &guide", "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", "offsetinfo-msgbox-label" : "Offset (see http://syncplay.pl/guide/ for usage instructions):", diff --git a/syncplay/messages_ru.py b/syncplay/messages_ru.py index 9746c17..6438d20 100644 --- a/syncplay/messages_ru.py +++ b/syncplay/messages_ru.py @@ -284,6 +284,14 @@ ru = { "help-menu-label" : u"&Помощь", "userguide-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"Установить смещение", "offsetinfo-msgbox-label" : u"Смещение (см. инструкцию на странице www.syncplay.pl/guide):", diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index 9e1737a..c6d7fe7 100755 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -97,15 +97,15 @@ class AboutDialog(QtGui.QDialog): if sys.platform.startswith('darwin'): self.setWindowTitle("") else: - self.setWindowTitle("About Syncplay") + self.setWindowTitle(getMessage("about-dialog-title")) if sys.platform.startswith('win'): self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) nameLabel = QtGui.QLabel("
Syncplay
") nameLabel.setFont(QtGui.QFont("Helvetica", 20)) linkLabel = QtGui.QLabel("
syncplay.pl
") linkLabel.setOpenExternalLinks(True) - versionLabel = QtGui.QLabel("
Version v" + version + " release " + release_number + "
") - licenseLabel = QtGui.QLabel("

Copyright © 2017 Syncplay

Licensed under the Apache License, Version 2.0

") + versionLabel = QtGui.QLabel("
" + getMessage("about-dialog-release").format(version, release_number) + "
") + licenseLabel = QtGui.QLabel("

Copyright © 2017 Syncplay

" + getMessage("about-dialog-license-text") + "

") aboutIconPixmap = QtGui.QPixmap(self.resourcespath + u"syncplay.png") aboutIconLabel = QtGui.QLabel() 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(versionLabel, 2, 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.clicked.connect(self.openLicense) aboutLayout.addWidget(licenseButton, 4, 2) - dependenciesButton = QtGui.QPushButton("Dependencies") + dependenciesButton = QtGui.QPushButton(getMessage("about-dialog-dependencies")) dependenciesButton.setAutoDefault(False) dependenciesButton.clicked.connect(self.openDependencies) aboutLayout.addWidget(dependenciesButton, 4, 3) @@ -1424,7 +1424,7 @@ class MainWindow(QtGui.QMainWindow): if not sys.platform.startswith('darwin'): window.helpMenu.addSeparator() window.about = window.helpMenu.addAction(QtGui.QIcon(self.resourcespath + 'syncplay.png'), - 'About Syncplay') + getMessage("about-menu-label")) else: window.about = window.helpMenu.addAction("&About") window.about.triggered.connect(self.openAbout)