summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2018-12-30 13:36:30 +0100
committerPapoteur <papoteur@mageia.org>2019-01-01 12:10:10 +0100
commit8178afe08202fed9ccff38b2b2dd23f8ff3dc5e7 (patch)
tree9fbdf9737776725bcc15a26900144eab7bc0e940
parent895876c3e2ae4c60e16b7cd2d1fc27a41a5b48b3 (diff)
downloadmageiawelcome-8178afe08202fed9ccff38b2b2dd23f8ff3dc5e7.tar
mageiawelcome-8178afe08202fed9ccff38b2b2dd23f8ff3dc5e7.tar.gz
mageiawelcome-8178afe08202fed9ccff38b2b2dd23f8ff3dc5e7.tar.bz2
mageiawelcome-8178afe08202fed9ccff38b2b2dd23f8ff3dc5e7.tar.xz
mageiawelcome-8178afe08202fed9ccff38b2b2dd23f8ff3dc5e7.zip
Use explicit context for translation in python part
-rw-r--r--qml/mageiawelcome.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/qml/mageiawelcome.py b/qml/mageiawelcome.py
index 48e8eb4..9ace3ec 100644
--- a/qml/mageiawelcome.py
+++ b/qml/mageiawelcome.py
@@ -3,7 +3,7 @@
from PyQt5.QtGui import QGuiApplication, QIcon
from PyQt5.QtQuick import QQuickView
from PyQt5.QtCore import QUrl, QLocale, QTranslator, QLibraryInfo, QVariant, QAbstractListModel, \
- QModelIndex, Qt, QObject, pyqtSlot
+ QModelIndex, Qt, QObject, pyqtSlot, QCoreApplication
from PyQt5.QtNetwork import QNetworkConfigurationManager, QNetworkConfiguration
import sys
import os
@@ -13,6 +13,8 @@ import pwd
# Workaround for opengl lib selection
from OpenGL import GL
+translate = QCoreApplication.translate
+
class ConfList(QAbstractListModel):
NameRole = Qt.UserRole + 1
def __init__(self, parent=None):
@@ -55,16 +57,16 @@ class ConfList(QAbstractListModel):
netconfs += ", " + conf.name()
self.configuration = [
- {'name': self.tr("<b>Congratulations!</b><BR />You have completed the installation of {}").format(release)},
- {'name': self.tr("You are using linux kernel: {}").format(kernel)},
- {'name': self.tr("Your system architecture is: {}").format(arch)},
- {'name': self.tr("You are now using the Desktop: {}").format(desktop)},
- {'name': self.tr("Your user id is: {}").format(os.getuid())},
+ {'name': translate('ConfList',"<b>Congratulations!</b><BR />You have completed the installation of {}").format(release)},
+ {'name': translate('ConfList',"You are using linux kernel: {}").format(kernel)},
+ {'name': translate('ConfList',"Your system architecture is: {}").format(arch)},
+ {'name': translate('ConfList',"You are now using the Desktop: {}").format(desktop)},
+ {'name': translate('ConfList',"Your user id is: {}").format(os.getuid())},
]
if net.isOnline():
- self.configuration.append({'name': self.tr("You are connected to a network through {}").format(netconfs)})
+ self.configuration.append({'name': translate('ConfList',"You are connected to a network through {}").format(netconfs)})
else:
- self.configuration.append({'name': self.tr("You have no network connection")})
+ self.configuration.append({'name': translate('ConfList',"You have no network connection")})
def data(self, index, role=Qt.DisplayRole):
@@ -147,7 +149,7 @@ if __name__ == '__main__':
app.installTranslator(appTranslator)
view = QQuickView()
view.setResizeMode(QQuickView.SizeRootObjectToView)
- view.setTitle(app.tr("Welcome to Mageia"))
+ view.setTitle(app.translate('app',"Welcome to Mageia"))
app.setWindowIcon(QIcon("icons/32x32/apps/mageiawelcome.png"))
cb = Callbrowser()
la = Launcher()