mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05:00
Python-i18n: trivial example adding _ to python jobs
- add to dummypython - also add to machineid
This commit is contained in:
parent
b922d88b0f
commit
33bc669591
2 changed files with 35 additions and 3 deletions
|
@ -5,6 +5,7 @@
|
|||
#
|
||||
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
||||
# Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||
#
|
||||
# Calamares is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,6 +33,14 @@ import libcalamares
|
|||
import os
|
||||
from time import gmtime, strftime, sleep
|
||||
|
||||
import gettext
|
||||
_ = gettext.translation("python",
|
||||
libcalamares.job.gettext_path,
|
||||
libcalamares.globalstorage.gettext_languages(),
|
||||
fallback=True).gettext
|
||||
|
||||
def pretty_name():
|
||||
return _("Dummy python job.")
|
||||
|
||||
def run():
|
||||
"""Dummy python job."""
|
||||
|
@ -65,11 +74,26 @@ def run():
|
|||
str(libcalamares.globalstorage.value("foo")),
|
||||
str(libcalamares.globalstorage.value("item2")),
|
||||
str(libcalamares.globalstorage.value("item3")))
|
||||
|
||||
libcalamares.job.setprogress(0.1)
|
||||
libcalamares.utils.debug(accumulator)
|
||||
|
||||
libcalamares.utils.debug("Run dummy python")
|
||||
|
||||
sleep(1)
|
||||
|
||||
try:
|
||||
l = list(libcalamares.job.configuration["a_list"])
|
||||
except KeyError:
|
||||
l = ["no list"]
|
||||
|
||||
c = 1
|
||||
for k in l:
|
||||
libcalamares.utils.debug(_("Dummy python step {}").format(str(k)))
|
||||
sleep(1)
|
||||
libcalamares.job.setprogress( c * 1.0 / len(l) )
|
||||
c += 1
|
||||
|
||||
sleep(3)
|
||||
|
||||
# To indicate an error, return a tuple of:
|
||||
# (message, detailed-error-message)
|
||||
return None
|
||||
|
|
|
@ -22,8 +22,16 @@
|
|||
|
||||
import libcalamares
|
||||
import os
|
||||
from libcalamares.utils import check_target_env_call
|
||||
from libcalamares.utils import check_target_env_call, debug
|
||||
|
||||
import gettext
|
||||
_ = gettext.translation("python",
|
||||
libcalamares.job.gettext_path,
|
||||
libcalamares.globalstorage.gettext_languages(),
|
||||
fallback=True).gettext
|
||||
|
||||
def pretty_name():
|
||||
return _("Generate machine-id.")
|
||||
|
||||
def run():
|
||||
"""
|
||||
|
|
Loading…
Add table
Reference in a new issue