Properly load translations.

This commit is contained in:
Teo Mrnjavac 2016-12-16 17:00:08 +01:00
parent e89a8aa3b5
commit ec1fc5f74d

View File

@ -67,7 +67,7 @@ class DummyPythonQtViewStep:
btn.connect("clicked(bool)", self.on_btn_clicked) btn.connect("clicked(bool)", self.on_btn_clicked)
def on_btn_clicked(self): def on_btn_clicked(self):
self.main_widget.layout().addWidget(QLabel("A new QLabel.")) self.main_widget.layout().addWidget(QLabel(_("A new QLabel.")))
def prettyName(self): def prettyName(self):
return "Dummy PythonQt ViewStep" return "Dummy PythonQt ViewStep"
@ -91,15 +91,15 @@ class DummyPythonQtViewStep:
return self.main_widget return self.main_widget
def retranslate(self, locale_name): def retranslate(self, locale_name):
calamares.utils.debug("DummyPythonQt retranslation event " calamares.utils.debug("PythonQt retranslation event "
"for locale name: {}".format(locale_name)) "for locale name: {}".format(locale_name))
try: try:
global _ global _
_t = gettext.translation('dummypythonqt', _t = gettext.translation('dummypythonqt',
os.path.join(_path, 'lang'), localedir=os.path.join(_path, 'lang'),
languages=[locale_name]) languages=[locale_name])
_ = _t.lgettext _ = _t.gettext
except OSError as e: except OSError as e:
calamares.utils.debug(e) calamares.utils.debug(e)
pass pass