diff --git a/Furious/Externals/GenTranslation.py b/Furious/Externals/GenTranslation.py index b8a7e73..3163e1e 100644 --- a/Furious/Externals/GenTranslation.py +++ b/Furious/Externals/GenTranslation.py @@ -2282,5 +2282,37 @@ TRANSLATION = { "RU": "Все журналы", "ZH": "全部日志", "isReviewed": "True" + }, + "Upload Speed": { + "source": [ + "Furious.Window.MainWindow" + ], + "RU": "Скорость отдачи", + "ZH": "上传速度", + "isReviewed": "True" + }, + "Download Speed": { + "source": [ + "Furious.Window.MainWindow" + ], + "RU": "Скорость загрузки", + "ZH": "下载速度", + "isReviewed": "True" + }, + "Upload Traffic Usage": { + "source": [ + "Furious.Window.MainWindow" + ], + "RU": "Объём исходящего трафика", + "ZH": "上传流量", + "isReviewed": "True" + }, + "Download Traffic Usage": { + "source": [ + "Furious.Window.MainWindow" + ], + "RU": "Объём входящего трафика", + "ZH": "下载流量", + "isReviewed": "True" } } diff --git a/Furious/Window/MainWindow.py b/Furious/Window/MainWindow.py index 73f3ddc..5839f55 100644 --- a/Furious/Window/MainWindow.py +++ b/Furious/Window/MainWindow.py @@ -259,7 +259,7 @@ class NetworkStateBadge(Mixins.QTranslatable, Mixins.ThemeAware, QWidget): self.updateStatusText() -class TrafficStatsBadge(Mixins.ThemeAware, QWidget): +class TrafficStatsBadge(Mixins.QTranslatable, Mixins.ThemeAware, QWidget): """Display independently updated traffic speeds and usage.""" UploadIconFileName = 'cloud-upload.svg' @@ -295,12 +295,30 @@ class TrafficStatsBadge(Mixins.ThemeAware, QWidget): self._layout.addWidget(self.downloadUsageLabel) self.setIconByTheme(APP().theme()) + self.updateToolTips() + + def updateToolTips(self): + """Apply translated descriptions to each traffic statistic.""" + uploadSpeed, downloadSpeed, uploadUsage, downloadUsage = ( + _('Upload Speed'), + _('Download Speed'), + _('Upload Traffic Usage'), + _('Download Traffic Usage'), + ) + + self.uploadIconLabel.setToolTip(uploadSpeed) + self.uploadTextLabel.setToolTip(uploadSpeed) + self.uploadUsageLabel.setToolTip(uploadUsage) + self.downloadIconLabel.setToolTip(downloadSpeed) + self.downloadTextLabel.setToolTip(downloadSpeed) + self.downloadUsageLabel.setToolTip(downloadUsage) def setIconByTheme(self, theme: str): """Apply theme-appropriate upload and download icons.""" iconFactory = ( bootstrapIconWhite if theme == AppStyleSheet.Dark else bootstrapIcon ) + self.uploadIconLabel.setPixmap( iconFactory(self.UploadIconFileName).pixmap(self.IconSize) ) @@ -335,6 +353,10 @@ class TrafficStatsBadge(Mixins.ThemeAware, QWidget): """Refresh traffic-direction icons after a theme change.""" self.setIconByTheme(theme) + def retranslate(self): + """Refresh translated traffic-statistic tooltips.""" + self.updateToolTips() + class ConnectionStatusWidget(QWidget): """Compose network state and traffic speed as one permanent status item."""