Enable translation in Python modules
- covers all the remaining Python modules - most only get a translatable pretty name, some also return error messages
This commit is contained in:
parent
c364e4fc38
commit
e326b658ef
@ -6,7 +6,7 @@
|
|||||||
# Copyright 2014-2015, Philip Müller <philm@manjaro.org>
|
# Copyright 2014-2015, Philip Müller <philm@manjaro.org>
|
||||||
# Copyright 2015-2017, Teo Mrnjavac <teo@kde.org>
|
# Copyright 2015-2017, Teo Mrnjavac <teo@kde.org>
|
||||||
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
||||||
# Copyright 2017, Adriaan de Groot <groot@kde.org>
|
# Copyright 2017, 2019, Adriaan de Groot <groot@kde.org>
|
||||||
# Copyright 2017-2018, Gabriel Craciunescu <crazy@frugalware.org>
|
# Copyright 2017-2018, Gabriel Craciunescu <crazy@frugalware.org>
|
||||||
#
|
#
|
||||||
# Calamares is free software: you can redistribute it and/or modify
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
@ -26,6 +26,16 @@ import libcalamares
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
_ = gettext.translation("calamares-python",
|
||||||
|
localedir=libcalamares.utils.gettext_path(),
|
||||||
|
languages=libcalamares.utils.gettext_languages(),
|
||||||
|
fallback=True).gettext
|
||||||
|
|
||||||
|
|
||||||
|
def pretty_name():
|
||||||
|
return _("Configure GRUB.")
|
||||||
|
|
||||||
|
|
||||||
def modify_grub_default(partitions, root_mount_point, distributor):
|
def modify_grub_default(partitions, root_mount_point, distributor):
|
||||||
"""
|
"""
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
# === This file is part of Calamares - <https://github.com/calamares> ===
|
# === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
||||||
|
# Copyright 2019, Adriaan de Groot <groot@kde.org>
|
||||||
#
|
#
|
||||||
# Calamares is free software: you can redistribute it and/or modify
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -21,6 +22,16 @@
|
|||||||
import libcalamares
|
import libcalamares
|
||||||
from libcalamares.utils import check_target_env_call
|
from libcalamares.utils import check_target_env_call
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
_ = gettext.translation("calamares-python",
|
||||||
|
localedir=libcalamares.utils.gettext_path(),
|
||||||
|
languages=libcalamares.utils.gettext_languages(),
|
||||||
|
fallback=True).gettext
|
||||||
|
|
||||||
|
|
||||||
|
def pretty_name():
|
||||||
|
return _("Creating initramfs with mkinitcpio.")
|
||||||
|
|
||||||
|
|
||||||
def run_mkinitcpio():
|
def run_mkinitcpio():
|
||||||
""" Runs mkinitcpio with given kernel profile """
|
""" Runs mkinitcpio with given kernel profile """
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
# Copyright 2014, Rohan Garg <rohan@kde.org>
|
# Copyright 2014, Rohan Garg <rohan@kde.org>
|
||||||
# Copyright 2015, Philip Müller <philm@manjaro.org>
|
# Copyright 2015, Philip Müller <philm@manjaro.org>
|
||||||
# Copyright 2017, Alf Gaida <agaida@sidution.org>
|
# Copyright 2017, Alf Gaida <agaida@sidution.org>
|
||||||
|
# Copyright 2019, Adriaan de Groot <groot@kde.org>
|
||||||
#
|
#
|
||||||
# Calamares is free software: you can redistribute it and/or modify
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -24,6 +25,16 @@ import libcalamares
|
|||||||
import os
|
import os
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
_ = gettext.translation("calamares-python",
|
||||||
|
localedir=libcalamares.utils.gettext_path(),
|
||||||
|
languages=libcalamares.utils.gettext_languages(),
|
||||||
|
fallback=True).gettext
|
||||||
|
|
||||||
|
|
||||||
|
def pretty_name():
|
||||||
|
return _("Configuring mkinitcpio.")
|
||||||
|
|
||||||
|
|
||||||
def cpuinfo():
|
def cpuinfo():
|
||||||
"""
|
"""
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
||||||
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
||||||
|
# Copyright 2019, Adriaan de Groot <groot@kde.org>
|
||||||
#
|
#
|
||||||
# Calamares is free software: you can redistribute it and/or modify
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -19,9 +20,21 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import libcalamares
|
||||||
from libcalamares.utils import target_env_call
|
from libcalamares.utils import target_env_call
|
||||||
|
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
_ = gettext.translation("calamares-python",
|
||||||
|
localedir=libcalamares.utils.gettext_path(),
|
||||||
|
languages=libcalamares.utils.gettext_languages(),
|
||||||
|
fallback=True).gettext
|
||||||
|
|
||||||
|
|
||||||
|
def pretty_name():
|
||||||
|
return _("Creating initramfs.")
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
""" Generate an initramfs image.
|
""" Generate an initramfs image.
|
||||||
|
|
||||||
@ -31,7 +44,8 @@ def run():
|
|||||||
"-t"])
|
"-t"])
|
||||||
|
|
||||||
if return_code != 0:
|
if return_code != 0:
|
||||||
|
libcalamares.utils.debug("update-initramfs returned {}".format(return_code)
|
||||||
return (
|
return (
|
||||||
"Failed to run update-initramfs on the target",
|
_("Failed to run update-initramfs on the target"),
|
||||||
"The exit code was {}".format(return_code)
|
_("The exit code was {}").format(return_code)
|
||||||
)
|
)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
# Copyright 2016, David McKinney <mckinney@subgraph.com>
|
# Copyright 2016, David McKinney <mckinney@subgraph.com>
|
||||||
# Copyright 2016, Kevin Kofler <kevin.kofler@chello.at>
|
# Copyright 2016, Kevin Kofler <kevin.kofler@chello.at>
|
||||||
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
||||||
# Copyright 2017, Adriaan de Groot <groot@kde.org>
|
# Copyright 2017, 2019, Adriaan de Groot <groot@kde.org>
|
||||||
#
|
#
|
||||||
# Calamares is free software: you can redistribute it and/or modify
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -30,6 +30,17 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
_ = gettext.translation("calamares-python",
|
||||||
|
localedir=libcalamares.utils.gettext_path(),
|
||||||
|
languages=libcalamares.utils.gettext_languages(),
|
||||||
|
fallback=True).gettext
|
||||||
|
|
||||||
|
|
||||||
|
def pretty_name():
|
||||||
|
return _("Configuring initramfs.")
|
||||||
|
|
||||||
|
|
||||||
def copy_initramfs_hooks(partitions, root_mount_point):
|
def copy_initramfs_hooks(partitions, root_mount_point):
|
||||||
"""
|
"""
|
||||||
Copies initramfs hooks so they are picked up by update-initramfs
|
Copies initramfs hooks so they are picked up by update-initramfs
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
# Copyright 2015, Philip Müller <philm@manjaro.org>
|
# Copyright 2015, Philip Müller <philm@manjaro.org>
|
||||||
# Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
# Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
||||||
# Copyright 2018, AlmAck <gluca86@gmail.com>
|
# Copyright 2018, AlmAck <gluca86@gmail.com>
|
||||||
# Copyright 2018, Adriaan de Groot <groot@kde.org>
|
# Copyright 2018-2019, Adriaan de Groot <groot@kde.org>
|
||||||
#
|
#
|
||||||
# Calamares is free software: you can redistribute it and/or modify
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -26,6 +26,17 @@ import os
|
|||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
_ = gettext.translation("calamares-python",
|
||||||
|
localedir=libcalamares.utils.gettext_path(),
|
||||||
|
languages=libcalamares.utils.gettext_languages(),
|
||||||
|
fallback=True).gettext
|
||||||
|
|
||||||
|
|
||||||
|
def pretty_name():
|
||||||
|
return _("Configuring locales.")
|
||||||
|
|
||||||
|
|
||||||
RE_IS_COMMENT = re.compile("^ *#")
|
RE_IS_COMMENT = re.compile("^ *#")
|
||||||
def is_comment(line):
|
def is_comment(line):
|
||||||
"""
|
"""
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
# Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
||||||
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
||||||
# Copyright 2017, Adriaan de Groot <groot@kde.org>
|
# Copyright 2017, 2019, Adriaan de Groot <groot@kde.org>
|
||||||
#
|
#
|
||||||
# Calamares is free software: you can redistribute it and/or modify
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -21,10 +21,20 @@
|
|||||||
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import libcalamares
|
import libcalamares
|
||||||
|
|
||||||
from libcalamares.utils import check_target_env_call
|
from libcalamares.utils import check_target_env_call
|
||||||
|
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
_ = gettext.translation("calamares-python",
|
||||||
|
localedir=libcalamares.utils.gettext_path(),
|
||||||
|
languages=libcalamares.utils.gettext_languages(),
|
||||||
|
fallback=True).gettext
|
||||||
|
|
||||||
|
|
||||||
|
def pretty_name():
|
||||||
|
return _("Configuring LUKS key file.")
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
"""
|
"""
|
||||||
This module sets up a file crypto_keyfile.bin on the rootfs, assuming the
|
This module sets up a file crypto_keyfile.bin on the rootfs, assuming the
|
||||||
@ -54,10 +64,10 @@ def run():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
if not luks_root_passphrase:
|
if not luks_root_passphrase:
|
||||||
|
libcalamares.utils.debug("No LUKS passphrase, root {!s}".format(luks_root_device))
|
||||||
return (
|
return (
|
||||||
"Encrypted rootfs setup error",
|
_("Encrypted rootfs setup error"),
|
||||||
"Rootfs partition {!s} is LUKS but no passphrase found."
|
_("Rootfs partition {!s} is LUKS but no passphrase found.").format(luks_root_device))
|
||||||
.format(luks_root_device))
|
|
||||||
|
|
||||||
# Generate random keyfile
|
# Generate random keyfile
|
||||||
check_target_env_call(["dd",
|
check_target_env_call(["dd",
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
# Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
||||||
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
||||||
|
# Copyright 2019, Adriaan de Groot <groot@kde.org>
|
||||||
#
|
#
|
||||||
# Calamares is free software: you can redistribute it and/or modify
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -23,6 +24,17 @@ import libcalamares
|
|||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
_ = gettext.translation("calamares-python",
|
||||||
|
localedir=libcalamares.utils.gettext_path(),
|
||||||
|
languages=libcalamares.utils.gettext_languages(),
|
||||||
|
fallback=True).gettext
|
||||||
|
|
||||||
|
|
||||||
|
def pretty_name():
|
||||||
|
return _("Configuring encrypted swap.")
|
||||||
|
|
||||||
|
|
||||||
def write_openswap_conf(partitions, root_mount_point, openswap_conf_path):
|
def write_openswap_conf(partitions, root_mount_point, openswap_conf_path):
|
||||||
swap_outer_uuid = ""
|
swap_outer_uuid = ""
|
||||||
swap_mapper_name = ""
|
swap_mapper_name = ""
|
||||||
@ -80,6 +92,4 @@ def run():
|
|||||||
|
|
||||||
openswap_conf_path = openswap_conf_path.lstrip('/')
|
openswap_conf_path = openswap_conf_path.lstrip('/')
|
||||||
|
|
||||||
return write_openswap_conf(
|
return write_openswap_conf(partitions, root_mount_point, openswap_conf_path)
|
||||||
partitions, root_mount_point, openswap_conf_path
|
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user