diff --git a/src/modules/grubcfg/main.py b/src/modules/grubcfg/main.py index b19ebf588..83441a736 100644 --- a/src/modules/grubcfg/main.py +++ b/src/modules/grubcfg/main.py @@ -6,7 +6,7 @@ # Copyright 2014-2015, Philip Müller # Copyright 2015-2017, Teo Mrnjavac # Copyright 2017, Alf Gaida -# Copyright 2017, Adriaan de Groot +# Copyright 2017, 2019, Adriaan de Groot # Copyright 2017-2018, Gabriel Craciunescu # # Calamares is free software: you can redistribute it and/or modify @@ -26,6 +26,16 @@ import libcalamares import os 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): """ diff --git a/src/modules/initcpio/main.py b/src/modules/initcpio/main.py index 62277f0c4..20d841de5 100644 --- a/src/modules/initcpio/main.py +++ b/src/modules/initcpio/main.py @@ -4,6 +4,7 @@ # === This file is part of Calamares - === # # Copyright 2014, Philip Müller +# Copyright 2019, Adriaan de Groot # # Calamares is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,6 +22,16 @@ import libcalamares 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(): """ Runs mkinitcpio with given kernel profile """ diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index b990893ed..2207816d9 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -6,6 +6,7 @@ # Copyright 2014, Rohan Garg # Copyright 2015, Philip Müller # Copyright 2017, Alf Gaida +# Copyright 2019, Adriaan de Groot # # Calamares is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,6 +25,16 @@ import libcalamares import os 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(): """ diff --git a/src/modules/initramfs/main.py b/src/modules/initramfs/main.py index 5738b63c6..7741c95d5 100644 --- a/src/modules/initramfs/main.py +++ b/src/modules/initramfs/main.py @@ -5,6 +5,7 @@ # # Copyright 2014, Philip Müller # Copyright 2017, Alf Gaida +# Copyright 2019, Adriaan de Groot # # Calamares is free software: you can redistribute it and/or modify # 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 # along with Calamares. If not, see . +import libcalamares 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(): """ Generate an initramfs image. @@ -31,7 +44,8 @@ def run(): "-t"]) if return_code != 0: + libcalamares.utils.debug("update-initramfs returned {}".format(return_code) return ( - "Failed to run update-initramfs on the target", - "The exit code was {}".format(return_code) + _("Failed to run update-initramfs on the target"), + _("The exit code was {}").format(return_code) ) diff --git a/src/modules/initramfscfg/main.py b/src/modules/initramfscfg/main.py index ba4aa762d..b62e4e5f7 100644 --- a/src/modules/initramfscfg/main.py +++ b/src/modules/initramfscfg/main.py @@ -8,7 +8,7 @@ # Copyright 2016, David McKinney # Copyright 2016, Kevin Kofler # Copyright 2017, Alf Gaida -# Copyright 2017, Adriaan de Groot +# Copyright 2017, 2019, Adriaan de Groot # # Calamares is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -30,6 +30,17 @@ import os 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): """ Copies initramfs hooks so they are picked up by update-initramfs diff --git a/src/modules/localecfg/main.py b/src/modules/localecfg/main.py index 713b1e321..5a9938774 100644 --- a/src/modules/localecfg/main.py +++ b/src/modules/localecfg/main.py @@ -7,7 +7,7 @@ # Copyright 2015, Philip Müller # Copyright 2016, Teo Mrnjavac # Copyright 2018, AlmAck -# Copyright 2018, Adriaan de Groot +# Copyright 2018-2019, Adriaan de Groot # # Calamares is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,6 +26,17 @@ import os import re 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("^ *#") def is_comment(line): """ diff --git a/src/modules/luksbootkeyfile/main.py b/src/modules/luksbootkeyfile/main.py index 74e742080..0c025ca31 100644 --- a/src/modules/luksbootkeyfile/main.py +++ b/src/modules/luksbootkeyfile/main.py @@ -5,7 +5,7 @@ # # Copyright 2016, Teo Mrnjavac # Copyright 2017, Alf Gaida -# Copyright 2017, Adriaan de Groot +# Copyright 2017, 2019, Adriaan de Groot # # Calamares is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,10 +21,20 @@ # along with Calamares. If not, see . import libcalamares - 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(): """ This module sets up a file crypto_keyfile.bin on the rootfs, assuming the @@ -54,10 +64,10 @@ def run(): return None if not luks_root_passphrase: + libcalamares.utils.debug("No LUKS passphrase, root {!s}".format(luks_root_device)) return ( - "Encrypted rootfs setup error", - "Rootfs partition {!s} is LUKS but no passphrase found." - .format(luks_root_device)) + _("Encrypted rootfs setup error"), + _("Rootfs partition {!s} is LUKS but no passphrase found.").format(luks_root_device)) # Generate random keyfile check_target_env_call(["dd", diff --git a/src/modules/luksopenswaphookcfg/main.py b/src/modules/luksopenswaphookcfg/main.py index 20dcb1e70..e32fbbbfd 100644 --- a/src/modules/luksopenswaphookcfg/main.py +++ b/src/modules/luksopenswaphookcfg/main.py @@ -5,6 +5,7 @@ # # Copyright 2016, Teo Mrnjavac # Copyright 2017, Alf Gaida +# Copyright 2019, Adriaan de Groot # # Calamares is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,6 +24,17 @@ import libcalamares 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): swap_outer_uuid = "" swap_mapper_name = "" @@ -80,6 +92,4 @@ def run(): openswap_conf_path = openswap_conf_path.lstrip('/') - return write_openswap_conf( - partitions, root_mount_point, openswap_conf_path - ) + return write_openswap_conf(partitions, root_mount_point, openswap_conf_path)