From 264724614d2b56e1ea94ca2b543c8d24e0a30ad4 Mon Sep 17 00:00:00 2001 From: alby128 Date: Fri, 13 Oct 2017 15:32:11 +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..db8c07e 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 {} on {}", + "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..a42e241 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 {} on {}", + "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..2717876 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 {} on {}", + "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 8c92ff7..989f17e 100755 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -100,15 +100,15 @@ class AboutDialog(QtWidgets.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 = QtWidgets.QLabel("
Syncplay
") nameLabel.setFont(QtGui.QFont("Helvetica", 20)) linkLabel = QtWidgets.QLabel("
syncplay.pl
") linkLabel.setOpenExternalLinks(True) - versionLabel = QtWidgets.QLabel("
Version v" + version + " release " + release_number + " on " + __binding__ + "
") - licenseLabel = QtWidgets.QLabel("

Copyright © 2017 Syncplay

Licensed under the Apache License, Version 2.0

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

Copyright © 2017 Syncplay

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

") aboutIconPixmap = QtGui.QPixmap(self.resourcespath + u"syncplay.png") aboutIconLabel = QtWidgets.QLabel() aboutIconLabel.setPixmap(aboutIconPixmap.scaled(120, 120, Qt.KeepAspectRatio)) @@ -118,11 +118,11 @@ class AboutDialog(QtWidgets.QDialog): aboutLayout.addWidget(linkLabel, 1, 2, 1, 2) aboutLayout.addWidget(versionLabel, 2, 2, 1, 2) aboutLayout.addWidget(licenseLabel, 3, 2, 1, 2) - licenseButton = QtWidgets.QPushButton("License") + licenseButton = QtWidgets.QPushButton(getMessage("about-dialog-license-button")) licenseButton.setAutoDefault(False) licenseButton.clicked.connect(self.openLicense) aboutLayout.addWidget(licenseButton, 4, 2) - dependenciesButton = QtWidgets.QPushButton("Dependencies") + dependenciesButton = QtWidgets.QPushButton(getMessage("about-dialog-dependencies")) dependenciesButton.setAutoDefault(False) dependenciesButton.clicked.connect(self.openDependencies) aboutLayout.addWidget(dependenciesButton, 4, 3) @@ -1449,7 +1449,7 @@ class MainWindow(QtWidgets.QMainWindow): if not sys.platform.startswith('darwin'): window.helpMenu.addSeparator() window.about = window.helpMenu.addAction(QtGui.QPixmap(self.resourcespath + 'syncplay.png'), - 'About Syncplay') + getMessage("about-menu-label")) else: window.about = window.helpMenu.addAction("&About") window.about.triggered.connect(self.openAbout)