Get new locale name in retranslate function.
This commit is contained in:
parent
b1c67f429f
commit
27328a720b
@ -32,12 +32,9 @@ import PythonQt.calamares as calamares
|
|||||||
import gettext
|
import gettext
|
||||||
import inspect
|
import inspect
|
||||||
import os
|
import os
|
||||||
filename = inspect.getframeinfo(inspect.currentframe()).filename
|
_filename = inspect.getframeinfo(inspect.currentframe()).filename
|
||||||
path = os.path.dirname(os.path.abspath(filename))
|
_path = os.path.dirname(os.path.abspath(_filename))
|
||||||
# t = gettext.translation('dummypythonqt',
|
|
||||||
# os.path.join(path, 'lang'),
|
|
||||||
# languages=['en'])
|
|
||||||
#_ = t.lgettext
|
|
||||||
_ = gettext.gettext
|
_ = gettext.gettext
|
||||||
|
|
||||||
# Example Python ViewModule.
|
# Example Python ViewModule.
|
||||||
@ -51,7 +48,7 @@ _ = gettext.gettext
|
|||||||
# isAtBeginning/isAtEnd. The whole UI, including all the pages, must be
|
# isAtBeginning/isAtEnd. The whole UI, including all the pages, must be
|
||||||
# exposed as a single QWidget, returned by the widget function.
|
# exposed as a single QWidget, returned by the widget function.
|
||||||
@calamares_module
|
@calamares_module
|
||||||
class DummyPythonQtViewStep():
|
class DummyPythonQtViewStep:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.main_widget = QFrame()
|
self.main_widget = QFrame()
|
||||||
|
|
||||||
@ -93,10 +90,14 @@ class DummyPythonQtViewStep():
|
|||||||
def widget(self):
|
def widget(self):
|
||||||
return self.main_widget
|
return self.main_widget
|
||||||
|
|
||||||
def retranslate(self):
|
def retranslate(self, localeName):
|
||||||
global _
|
global _
|
||||||
_ = gettext.gettext
|
_t = gettext.translation('dummypythonqt',
|
||||||
calamares.utils.debug("DummyPythonQt retranslation event.")
|
os.path.join(_path, 'lang'),
|
||||||
|
languages=[localeName])
|
||||||
|
_ = _t.lgettext
|
||||||
|
calamares.utils.debug("DummyPythonQt retranslation event "
|
||||||
|
"for locale name: {}".format(localeName))
|
||||||
|
|
||||||
|
|
||||||
class DummyPQJob:
|
class DummyPQJob:
|
||||||
|
Loading…
Reference in New Issue
Block a user