Merge branch 'add-python-translations'

FIXES #991
This commit is contained in:
Adriaan de Groot 2019-04-20 11:23:41 +02:00
commit 217eade255
15 changed files with 191 additions and 27 deletions

View File

@ -11,7 +11,7 @@
# Copyright 2015-2018, Philip Mueller <philm@manjaro.org> # Copyright 2015-2018, Philip Mueller <philm@manjaro.org>
# Copyright 2016-2017, Teo Mrnjavac <teo@kde.org> # Copyright 2016-2017, Teo Mrnjavac <teo@kde.org>
# Copyright 2017, Alf Gaida <agaida@siduction.org> # Copyright 2017, Alf Gaida <agaida@siduction.org>
# Copyright 2017-2018, Adriaan de Groot <groot@kde.org> # Copyright 2017-2019, Adriaan de Groot <groot@kde.org>
# Copyright 2017, Gabriel Craciunescu <crazy@frugalware.org> # Copyright 2017, Gabriel Craciunescu <crazy@frugalware.org>
# Copyright 2017, Ben Green <Bezzy1999@hotmail.com> # Copyright 2017, Ben Green <Bezzy1999@hotmail.com>
# #
@ -37,6 +37,17 @@ 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 _("Install bootloader.")
def get_uuid(): def get_uuid():
""" """
Checks and passes 'uuid' to other routine. Checks and passes 'uuid' to other routine.
@ -424,21 +435,16 @@ def run():
fw_type = libcalamares.globalstorage.value("firmwareType") fw_type = libcalamares.globalstorage.value("firmwareType")
if (libcalamares.globalstorage.value("bootLoader") is None if (libcalamares.globalstorage.value("bootLoader") is None and fw_type != "efi"):
and fw_type != "efi"): libcalamares.utils.warning( "Non-EFI system, and no bootloader is set." )
return None return None
partitions = libcalamares.globalstorage.value("partitions") partitions = libcalamares.globalstorage.value("partitions")
if fw_type == "efi": if fw_type == "efi":
esp_found = False efi_system_partition = libcalamares.globalstorage.value("efiSystemPartition")
esp_found = [ p for p in partitions if p["mountPoint"] == efi_system_partition ]
for partition in partitions:
if (partition["mountPoint"] ==
libcalamares.globalstorage.value("efiSystemPartition")):
esp_found = True
if not esp_found: if not esp_found:
libcalamares.utils.warning( "EFI system, but nothing mounted on {!s}".format(efi_system_partition) )
return None return None
prepare_bootloader(fw_type) prepare_bootloader(fw_type)

View File

@ -6,6 +6,7 @@
# Copyright 2014-2015, Philip Müller <philm@manjaro.org> # Copyright 2014-2015, Philip Müller <philm@manjaro.org>
# Copyright 2014, Teo Mrnjavac <teo@kde.org> # Copyright 2014, Teo Mrnjavac <teo@kde.org>
# Copyright 2017, Alf Gaida <agaid@siduction.org> # Copyright 2017, Alf Gaida <agaid@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
@ -24,6 +25,17 @@ 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 with dracut.")
def run_dracut(): def run_dracut():
""" """
Creates initramfs, even when initramfs already exists. Creates initramfs, even when initramfs already exists.
@ -43,5 +55,5 @@ def run():
return_code = run_dracut() return_code = run_dracut()
if return_code != 0: if return_code != 0:
return ("Failed to run dracut on the target", return ( _("Failed to run dracut on the target"),
"The exit code was {}".format(return_code)) _("The exit code was {}").format(return_code) )

View File

@ -6,6 +6,7 @@
# Copyright 2014, Aurélien Gâteau <agateau@kde.org> # Copyright 2014, Aurélien Gâteau <agateau@kde.org>
# 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
@ -26,6 +27,16 @@ import subprocess
import libcalamares import libcalamares
import gettext
_ = gettext.translation("calamares-python",
localedir=libcalamares.utils.gettext_path(),
languages=libcalamares.utils.gettext_languages(),
fallback=True).gettext
def pretty_name():
return _("Writing fstab.")
FSTAB_HEADER = """# /etc/fstab: static file system information. FSTAB_HEADER = """# /etc/fstab: static file system information.
# #

View File

@ -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):
""" """

View File

@ -7,6 +7,7 @@
# Copyright 2014, Teo Mrnjavac <teo@kde.org> # Copyright 2014, Teo Mrnjavac <teo@kde.org>
# Copyright 2017, Alf Gaida <agaida@siduction.org> # Copyright 2017, Alf Gaida <agaida@siduction.org>
# Copyright 2017-2018, Gabriel Craciunescu <crazy@frugalware.org> # Copyright 2017-2018, Gabriel Craciunescu <crazy@frugalware.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 libcalamares
import gettext
_ = gettext.translation("calamares-python",
localedir=libcalamares.utils.gettext_path(),
languages=libcalamares.utils.gettext_languages(),
fallback=True).gettext
def pretty_name():
return _("Setting hardware clock.")
def run(): def run():
""" """
Set hardware clock. Set hardware clock.

View File

@ -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 """

View File

@ -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():
""" """

View File

@ -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)
) )

View File

@ -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

View File

@ -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):
""" """

View File

@ -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",

View File

@ -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
)

View File

@ -5,6 +5,7 @@
# #
# Copyright 2014, Aurélien Gâteau <agateau@kde.org> # Copyright 2014, Aurélien Gâteau <agateau@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
@ -24,6 +25,16 @@ import subprocess
import libcalamares import libcalamares
import gettext
_ = gettext.translation("calamares-python",
localedir=libcalamares.utils.gettext_path(),
languages=libcalamares.utils.gettext_languages(),
fallback=True).gettext
def pretty_name():
return _("Mounting partitions.")
def mount_partitions(root_mount_point, partitions): def mount_partitions(root_mount_point, partitions):
""" """

View File

@ -6,6 +6,7 @@
# Copyright 2014, Philip Müller <philm@manjaro.org> # Copyright 2014, Philip Müller <philm@manjaro.org>
# Copyright 2014, Teo Mrnjavac <teo@kde.org> # Copyright 2014, 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
@ -25,6 +26,16 @@ import shutil
import libcalamares import libcalamares
import gettext
_ = gettext.translation("calamares-python",
localedir=libcalamares.utils.gettext_path(),
languages=libcalamares.utils.gettext_languages(),
fallback=True).gettext
def pretty_name():
return _("Saving network configuration.")
def run(): def run():
""" """

View File

@ -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 2017, Ghiunhan Mamut <venerix@redcorelinux.org> # Copyright 2017, Ghiunhan Mamut <venerix@redcorelinux.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
@ -18,9 +19,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
import os.path import os.path
import libcalamares
import gettext
_ = gettext.translation("calamares-python",
localedir=libcalamares.utils.gettext_path(),
languages=libcalamares.utils.gettext_languages(),
fallback=True).gettext
def pretty_name():
return _("Configuring OpenRC dmcrypt service.")
def write_dmcrypt_conf(partitions, root_mount_point, dmcrypt_conf_path): def write_dmcrypt_conf(partitions, root_mount_point, dmcrypt_conf_path):
crypto_target = "" crypto_target = ""
crypto_source = "" crypto_source = ""