From cfea0d6d1a6f6b82fd4b65abd2124c8fc0530949 Mon Sep 17 00:00:00 2001 From: Daniel Girtler Date: Mon, 1 Aug 2022 17:44:57 +1000 Subject: Update translations (#1348) * Show translations in own tongue * Fix flake8 * Update * Update * Update * Update * fix mypy * Update * Update Co-authored-by: Daniel Girtler --- archinstall/lib/translationhandler.py | 165 ++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 archinstall/lib/translationhandler.py (limited to 'archinstall/lib/translationhandler.py') diff --git a/archinstall/lib/translationhandler.py b/archinstall/lib/translationhandler.py new file mode 100644 index 00000000..12c8da4a --- /dev/null +++ b/archinstall/lib/translationhandler.py @@ -0,0 +1,165 @@ +from __future__ import annotations + +import json +import logging +import os +import gettext +from dataclasses import dataclass + +from pathlib import Path +from typing import List, Dict, Any, TYPE_CHECKING, Optional +from .exceptions import TranslationError + +if TYPE_CHECKING: + _: Any + + +@dataclass +class Language: + abbr: str + lang: str + translation: gettext.NullTranslations + translation_percent: int + translated_lang: Optional[str] + + @property + def display_name(self) -> str: + if self.translated_lang: + name = self.translated_lang + else: + name = self.lang + return f'{name} ({self.translation_percent}%)' + + def is_match(self, lang_or_translated_lang: str) -> bool: + if self.lang == lang_or_translated_lang: + return True + elif self.translated_lang == lang_or_translated_lang: + return True + return False + + +class TranslationHandler: + _base_pot = 'base.pot' + _languages = 'languages.json' + + def __init__(self): + # to display cyrillic languages correctly + self._set_font('UniCyr_8x16') + + self._total_messages = self._get_total_messages() + self._translated_languages = self._get_translations() + + @property + def translated_languages(self) -> List[Language]: + return self._translated_languages + + def _get_translations(self) -> List[Language]: + mappings = self._load_language_mappings() + defined_languages = self._defined_languages() + + languages = [] + + for short_form in defined_languages: + mapping_entry: Dict[str, Any] = next(filter(lambda x: x['abbr'] == short_form, mappings)) + abbr = mapping_entry['abbr'] + lang = mapping_entry['lang'] + translated_lang = mapping_entry.get('translated_lang', None) + + try: + translation = gettext.translation('base', localedir=self._get_locales_dir(), languages=(abbr, lang)) + + if abbr == 'en': + percent = 100 + else: + num_translations = self._get_catalog_size(translation) + percent = int((num_translations / self._total_messages) * 100) + + language = Language(abbr, lang, translation, percent, translated_lang) + languages.append(language) + except FileNotFoundError as error: + raise TranslationError(f"Could not locate language file for '{lang}': {error}") + + return languages + + def _set_font(self, font: str): + from archinstall import SysCommand, log + try: + log(f'Setting font: {font}', level=logging.DEBUG) + SysCommand(f'setfont {font}') + except Exception: + log(f'Unable to set font {font}', level=logging.ERROR) + + def _load_language_mappings(self) -> List[Dict[str, Any]]: + locales_dir = self._get_locales_dir() + languages = Path.joinpath(locales_dir, self._languages) + + with open(languages, 'r') as fp: + return json.load(fp) + + def _get_catalog_size(self, translation: gettext.NullTranslations) -> int: + # this is a ery naughty way of retrieving the data but + # there's no alternative method exposed unfortunately + catalog = translation._catalog # type: ignore + messages = {k: v for k, v in catalog.items() if k and v} + return len(messages) + + def _get_total_messages(self) -> int: + locales = self._get_locales_dir() + with open(f'{locales}/{self._base_pot}', 'r') as fp: + lines = fp.readlines() + msgid_lines = [line for line in lines if 'msgid' in line] + return len(msgid_lines) - 1 # don't count the first line which contains the metadata + + def get_language(self, abbr: str) -> Language: + try: + return next(filter(lambda x: x.abbr == abbr, self._translated_languages)) + except Exception: + raise ValueError(f'No language with abbreviation "{abbr}" found') + + def activate(self, language: Language): + language.translation.install() + + def _get_locales_dir(self) -> Path: + cur_path = Path(__file__).parent.parent + locales_dir = Path.joinpath(cur_path, 'locales') + return locales_dir + + def _defined_languages(self) -> List[str]: + locales_dir = self._get_locales_dir() + filenames = os.listdir(locales_dir) + return list(filter(lambda x: len(x) == 2 or x == 'pt_BR', filenames)) + + +class DeferredTranslation: + def __init__(self, message: str): + self.message = message + + def __len__(self) -> int: + return len(self.message) + + def __str__(self) -> str: + translate = _ + if translate is DeferredTranslation: + return self.message + return translate(self.message) + + def __lt__(self, other) -> bool: + return self.message < other + + def __gt__(self, other) -> bool: + return self.message > other + + def __add__(self, other) -> DeferredTranslation: + if isinstance(other, str): + other = DeferredTranslation(other) + + concat = self.message + other.message + return DeferredTranslation(concat) + + def format(self, *args) -> str: + return self.message.format(*args) + + @classmethod + def install(cls): + import builtins + builtins._ = cls -- cgit v1.2.3-70-g09d2 From a31bf94fa3727ef2c13e37d33560f6acf1141902 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 9 Aug 2022 14:58:09 +0200 Subject: Adding a .json() call for our JSON serializer for the Language class (#1410) * Adding a .json() call for our JSON serializer * Update translationhandler.py --- archinstall/lib/translationhandler.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'archinstall/lib/translationhandler.py') diff --git a/archinstall/lib/translationhandler.py b/archinstall/lib/translationhandler.py index 12c8da4a..58b7ebd4 100644 --- a/archinstall/lib/translationhandler.py +++ b/archinstall/lib/translationhandler.py @@ -37,6 +37,8 @@ class Language: return True return False + def json(self) -> str: + return self.lang class TranslationHandler: _base_pot = 'base.pot' -- cgit v1.2.3-70-g09d2 From 4dcd5e684f9461145c5b8656b1a91f99ace26b27 Mon Sep 17 00:00:00 2001 From: Daniel Girtler Date: Tue, 6 Sep 2022 16:31:08 +1000 Subject: Move deserialization into init (#1456) Co-authored-by: Daniel Girtler --- archinstall/__init__.py | 15 +- archinstall/lib/menu/global_menu.py | 57 +++----- archinstall/lib/translationhandler.py | 50 ++++++- archinstall/locales/ar/LC_MESSAGES/base.po | 192 ++++++++++++-------------- archinstall/locales/base.pot | 36 +++++ archinstall/locales/cs/LC_MESSAGES/base.po | 26 ++++ archinstall/locales/de/LC_MESSAGES/base.po | 26 ++++ archinstall/locales/el/LC_MESSAGES/base.po | 6 +- archinstall/locales/en/LC_MESSAGES/base.po | 26 ++++ archinstall/locales/es/LC_MESSAGES/base.po | 26 ++++ archinstall/locales/fr/LC_MESSAGES/base.po | 26 ++++ archinstall/locales/it/LC_MESSAGES/base.po | 26 ++++ archinstall/locales/nl/LC_MESSAGES/base.po | 26 ++++ archinstall/locales/pl/LC_MESSAGES/base.po | 26 ++++ archinstall/locales/pt/LC_MESSAGES/base.po | 26 ++++ archinstall/locales/pt_BR/LC_MESSAGES/base.po | 27 +++- archinstall/locales/ru/LC_MESSAGES/base.po | 26 ++++ archinstall/locales/sv/LC_MESSAGES/base.po | 26 ++++ archinstall/locales/ta/LC_MESSAGES/base.po | 6 +- archinstall/locales/tr/LC_MESSAGES/base.po | 26 ++++ archinstall/locales/ur/LC_MESSAGES/base.po | 26 ++++ examples/swiss.py | 2 +- 22 files changed, 581 insertions(+), 148 deletions(-) (limited to 'archinstall/lib/translationhandler.py') diff --git a/archinstall/__init__.py b/archinstall/__init__.py index 184097b1..4e1e6d6d 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -195,40 +195,53 @@ def get_arguments() -> Dict[str, Any]: return config def load_config(): - from .lib.models import NetworkConfiguration """ refine and set some arguments. Formerly at the scripts """ + from .lib.models import NetworkConfiguration + + if (archinstall_lang := arguments.get('archinstall-language', None)) is not None: + arguments['archinstall-language'] = TranslationHandler().get_language_by_name(archinstall_lang) + if arguments.get('harddrives', None) is not None: if type(arguments['harddrives']) is str: arguments['harddrives'] = arguments['harddrives'].split(',') arguments['harddrives'] = [BlockDevice(BlockDev) for BlockDev in arguments['harddrives']] # Temporarily disabling keep_partitions if config file is loaded # Temporary workaround to make Desktop Environments work + if arguments.get('profile', None) is not None: if type(arguments.get('profile', None)) is dict: arguments['profile'] = Profile(None, arguments.get('profile', None)['path']) else: arguments['profile'] = Profile(None, arguments.get('profile', None)) + storage['_desktop_profile'] = arguments.get('desktop-environment', None) + if arguments.get('mirror-region', None) is not None: if type(arguments.get('mirror-region', None)) is dict: arguments['mirror-region'] = arguments.get('mirror-region', None) else: selected_region = arguments.get('mirror-region', None) arguments['mirror-region'] = {selected_region: list_mirrors()[selected_region]} + if arguments.get('sys-language', None) is not None: arguments['sys-language'] = arguments.get('sys-language', 'en_US') + if arguments.get('sys-encoding', None) is not None: arguments['sys-encoding'] = arguments.get('sys-encoding', 'utf-8') + if arguments.get('gfx_driver', None) is not None: storage['gfx_driver_packages'] = AVAILABLE_GFX_DRIVERS.get(arguments.get('gfx_driver', None), None) + if arguments.get('servers', None) is not None: storage['_selected_servers'] = arguments.get('servers', None) + if arguments.get('nic', None) is not None: handler = NetworkConfigurationHandler() handler.parse_arguments(arguments.get('nic')) arguments['nic'] = handler.configuration + if arguments.get('!users', None) is not None or arguments.get('!superusers', None) is not None: users = arguments.get('!users', None) superusers = arguments.get('!superusers', None) diff --git a/archinstall/lib/menu/global_menu.py b/archinstall/lib/menu/global_menu.py index fc7c90bc..d1bec189 100644 --- a/archinstall/lib/menu/global_menu.py +++ b/archinstall/lib/menu/global_menu.py @@ -3,54 +3,41 @@ from __future__ import annotations from typing import Any, List, Optional, Union, Dict, TYPE_CHECKING import archinstall - -from ..menu import Menu -from ..menu.selection_menu import Selector, GeneralMenu +from ..disk import encrypted_partitions from ..general import SysCommand, secret from ..hardware import has_uefi +from ..menu import Menu +from ..menu.selection_menu import Selector, GeneralMenu from ..models import NetworkConfiguration -from ..storage import storage +from ..models.users import User +from ..output import FormattedOutput from ..profiles import is_desktop_profile, Profile -from ..disk import encrypted_partitions - -from ..user_interaction import get_password, ask_for_a_timezone, save_config -from ..user_interaction import ask_ntp -from ..user_interaction import ask_for_swap +from ..storage import storage +from ..user_interaction import add_number_of_parrallel_downloads +from ..user_interaction import ask_additional_packages_to_install +from ..user_interaction import ask_for_additional_users +from ..user_interaction import ask_for_audio_selection from ..user_interaction import ask_for_bootloader +from ..user_interaction import ask_for_swap from ..user_interaction import ask_hostname -from ..user_interaction import ask_for_audio_selection -from ..user_interaction import ask_additional_packages_to_install +from ..user_interaction import ask_ntp from ..user_interaction import ask_to_configure_network -from ..user_interaction import ask_for_additional_users -from ..user_interaction import select_language -from ..user_interaction import select_mirror_regions -from ..user_interaction import select_locale_lang -from ..user_interaction import select_locale_enc +from ..user_interaction import get_password, ask_for_a_timezone, save_config +from ..user_interaction import select_additional_repositories from ..user_interaction import select_disk_layout -from ..user_interaction import select_kernel from ..user_interaction import select_encrypted_partitions from ..user_interaction import select_harddrives +from ..user_interaction import select_kernel +from ..user_interaction import select_language +from ..user_interaction import select_locale_enc +from ..user_interaction import select_locale_lang +from ..user_interaction import select_mirror_regions from ..user_interaction import select_profile -from ..user_interaction import select_additional_repositories -from ..user_interaction import add_number_of_parrallel_downloads -from ..models.users import User from ..user_interaction.partitioning_conf import current_partition_layout -from ..output import FormattedOutput -from ..translationhandler import Language if TYPE_CHECKING: _: Any -def display_language(global_menu, x): - if type(x) == Language: - return x - elif type(x) == str: - translation_handler = global_menu._translation_handler - for language in translation_handler._get_translations(): - if language.lang == x: - return language - else: - raise ValueError(f"Language entry needs to Language() object or string of full language like 'English'.") class GlobalMenu(GeneralMenu): def __init__(self,data_store): @@ -62,9 +49,9 @@ class GlobalMenu(GeneralMenu): self._menu_options['archinstall-language'] = \ Selector( _('Archinstall language'), - lambda x: self._select_archinstall_language(display_language(self, x)), - display_func=lambda x: display_language(self, x).display_name, - default=self.translation_handler.get_language('en')) + lambda x: self._select_archinstall_language(x), + display_func=lambda x: x.display_name, + default=self.translation_handler.get_language_by_abbr('en')) self._menu_options['keyboard-layout'] = \ Selector( _('Keyboard layout'), diff --git a/archinstall/lib/translationhandler.py b/archinstall/lib/translationhandler.py index 58b7ebd4..d6b3ccb6 100644 --- a/archinstall/lib/translationhandler.py +++ b/archinstall/lib/translationhandler.py @@ -40,6 +40,7 @@ class Language: def json(self) -> str: return self.lang + class TranslationHandler: _base_pot = 'base.pot' _languages = 'languages.json' @@ -48,7 +49,7 @@ class TranslationHandler: # to display cyrillic languages correctly self._set_font('UniCyr_8x16') - self._total_messages = self._get_total_messages() + self._total_messages = self._get_total_active_messages() self._translated_languages = self._get_translations() @property @@ -56,6 +57,9 @@ class TranslationHandler: return self._translated_languages def _get_translations(self) -> List[Language]: + """ + Load all translated languages and return a list of such + """ mappings = self._load_language_mappings() defined_languages = self._defined_languages() @@ -68,13 +72,17 @@ class TranslationHandler: translated_lang = mapping_entry.get('translated_lang', None) try: + # get a translation for a specific language translation = gettext.translation('base', localedir=self._get_locales_dir(), languages=(abbr, lang)) + # calculate the percentage of total translated text to total number of messages if abbr == 'en': percent = 100 else: num_translations = self._get_catalog_size(translation) percent = int((num_translations / self._total_messages) * 100) + # prevent cases where the .pot file is out of date and the percentage is above 100 + percent = min(100, percent) language = Language(abbr, lang, translation, percent, translated_lang) languages.append(language) @@ -84,6 +92,9 @@ class TranslationHandler: return languages def _set_font(self, font: str): + """ + Set the provided font as the new terminal font + """ from archinstall import SysCommand, log try: log(f'Setting font: {font}', level=logging.DEBUG) @@ -92,6 +103,9 @@ class TranslationHandler: log(f'Unable to set font {font}', level=logging.ERROR) def _load_language_mappings(self) -> List[Dict[str, Any]]: + """ + Load the mapping table of all known languages + """ locales_dir = self._get_locales_dir() languages = Path.joinpath(locales_dir, self._languages) @@ -99,34 +113,62 @@ class TranslationHandler: return json.load(fp) def _get_catalog_size(self, translation: gettext.NullTranslations) -> int: - # this is a ery naughty way of retrieving the data but + """ + Get the number of translated messages for a translations + """ + # this is a very naughty way of retrieving the data but # there's no alternative method exposed unfortunately catalog = translation._catalog # type: ignore messages = {k: v for k, v in catalog.items() if k and v} return len(messages) - def _get_total_messages(self) -> int: + def _get_total_active_messages(self) -> int: + """ + Get total messages that could be translated + """ locales = self._get_locales_dir() with open(f'{locales}/{self._base_pot}', 'r') as fp: lines = fp.readlines() msgid_lines = [line for line in lines if 'msgid' in line] + return len(msgid_lines) - 1 # don't count the first line which contains the metadata - def get_language(self, abbr: str) -> Language: + def get_language_by_name(self, name: str) -> Language: + """ + Get a language object by it's name, e.g. English + """ + try: + return next(filter(lambda x: x.lang == name, self._translated_languages)) + except Exception: + raise ValueError(f'No language with name found: {name}') + + def get_language_by_abbr(self, abbr: str) -> Language: + """ + Get a language object by its abbrevation, e.g. en + """ try: return next(filter(lambda x: x.abbr == abbr, self._translated_languages)) except Exception: raise ValueError(f'No language with abbreviation "{abbr}" found') def activate(self, language: Language): + """ + Set the provided language as the current translation + """ language.translation.install() def _get_locales_dir(self) -> Path: + """ + Get the locales directory path + """ cur_path = Path(__file__).parent.parent locales_dir = Path.joinpath(cur_path, 'locales') return locales_dir def _defined_languages(self) -> List[str]: + """ + Get a list of all known languages + """ locales_dir = self._get_locales_dir() filenames = os.listdir(locales_dir) return list(filter(lambda x: len(x) == 2 or x == 'pt_BR', filenames)) diff --git a/archinstall/locales/ar/LC_MESSAGES/base.po b/archinstall/locales/ar/LC_MESSAGES/base.po index aad0f928..ac14f102 100644 --- a/archinstall/locales/ar/LC_MESSAGES/base.po +++ b/archinstall/locales/ar/LC_MESSAGES/base.po @@ -3,26 +3,22 @@ # zer0-x, 2022. msgid "" msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Last-Translator: zer0-x\n" -"PO-Revision-Date: 2022-06-16 03:35+0300\n" "Project-Id-Version: \n" +"PO-Revision-Date: 2022-06-16 03:35+0300\n" +"Last-Translator: zer0-x\n" "Language-Team: Arabic\n" "Language: ar\n" "MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" "X-Generator: Lokalize 22.04.2\n" "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n" msgid "[!] A log file has been created here: {} {}" msgstr "[!] مِلَف سِجِل أُنشِأ هُنا: {} {}" -msgid "" -" Please submit this issue (and file) to" -" https://github.com/archlinux/archinstall/issues" -msgstr "" -" يُرجى تسليم تقرير عن هذا الخلل (مع المِلَف) إلى" -" https://github.com/archlinux/archinstall/issues" +msgid " Please submit this issue (and file) to https://github.com/archlinux/archinstall/issues" +msgstr " يُرجى تسليم تقرير عن هذا الخلل (مع المِلَف) إلى https://github.com/archlinux/archinstall/issues" msgid "Do you really want to abort?" msgstr "هل تُريدُ حقًا إجهاضَ العَملِيَّة؟" @@ -57,41 +53,26 @@ msgstr "اختر مُحمّل الإقلاع" msgid "Choose an audio server" msgstr "اختر خادِم صوتيات" -msgid "" -"Only packages such as base, base-devel, linux, linux-firmware, efibootmgr and" -" optional profile packages are installed." -msgstr "" -"فقط الحزم مثل base وbase-devel وlinux وlinux-firmware وefibootmgr و" -" حِزم مِلف اختيارية سوف تُثَبَّت." +msgid "Only packages such as base, base-devel, linux, linux-firmware, efibootmgr and optional profile packages are installed." +msgstr "فقط الحزم مثل base وbase-devel وlinux وlinux-firmware وefibootmgr و حِزم مِلف اختيارية سوف تُثَبَّت." -msgid "" -"If you desire a web browser, such as firefox or chromium, you may specify it" -" in the following prompt." -msgstr "" -"إذا كنت ترغب في متصفح الويب ، مثل Firefox أو chromium، فيمكنك تحديده" -" في موضِع الكتابة التالي." +msgid "If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt." +msgstr "إذا كنت ترغب في متصفح الويب ، مثل Firefox أو chromium، فيمكنك تحديده في موضِع الكتابة التالي." -msgid "" -"Write additional packages to install (space separated, leave blank to skip): " +msgid "Write additional packages to install (space separated, leave blank to skip): " msgstr "اكتب حزمًا إضافية لتثبيتها (تُفصَل بالمسافات، اتركها فارغة للتخطي):" msgid "Copy ISO network configuration to installation" msgstr "انسخ إعداد شبكة الـISO للتثبيت" -msgid "" -"Use NetworkManager (necessary to configure internet graphically in GNOME and" -" KDE)" -msgstr "" -"استخدم مُدير الشبكة (ضروري لإعداد الإنترنت باستخدام واجهة رسومية في جنوم و" -" كيدي)" +msgid "Use NetworkManager (necessary to configure internet graphically in GNOME and KDE)" +msgstr "استخدم مُدير الشبكة (ضروري لإعداد الإنترنت باستخدام واجهة رسومية في جنوم و كيدي)" msgid "Select one network interface to configure" msgstr "حدِّد واجهة شبكة واحدة للإعداد" -msgid "" -"Select which mode to configure for \"{}\" or skip to use default mode \"{}\"" -msgstr "" -"حدد الوضع المراد تهيئته لـ\"{}\" أو تخطى لاستخدام الوضع الافتراضي \"{}\"" +msgid "Select which mode to configure for \"{}\" or skip to use default mode \"{}\"" +msgstr "حدد الوضع المراد تهيئته لـ\"{}\" أو تخطى لاستخدام الوضع الافتراضي \"{}\"" msgid "Enter the IP and subnet for {} (example: 192.168.0.5/24): " msgstr "أدخِل الIP مع تجزئة الشبكة لـ{} (على سبيل المثال: 192.168.0.5/24): " @@ -119,8 +100,7 @@ msgstr "" msgid "Enter the start sector (percentage or block number, default: {}): " msgstr "" -msgid "" -"Enter the end sector of the partition (percentage or block number, ex: {}): " +msgid "Enter the end sector of the partition (percentage or block number, ex: {}): " msgstr "" msgid "{} contains queued partitions, this will remove those, are you sure?" @@ -138,9 +118,7 @@ msgid "" "Select by index which partition to mount where" msgstr "" -msgid "" -" * Partition mount-points are relative to inside the installation, the boot" -" would be /boot as an example." +msgid " * Partition mount-points are relative to inside the installation, the boot would be /boot as an example." msgstr "" msgid "Select where to mount partition (leave blank to remove mountpoint): " @@ -179,16 +157,13 @@ msgstr "" msgid "Wipe all selected drives and use a best-effort default partition layout" msgstr "" -msgid "" -"Select what to do with each individual drive (followed by partition usage)" +msgid "Select what to do with each individual drive (followed by partition usage)" msgstr "" msgid "Select what you wish to do with the selected block devices" msgstr "" -msgid "" -"This is a list of pre-programmed profiles, they might make it easier to" -" install things like desktop environments" +msgid "This is a list of pre-programmed profiles, they might make it easier to install things like desktop environments" msgstr "" msgid "Select keyboard layout" @@ -200,19 +175,13 @@ msgstr "" msgid "Select one or more hard drives to use and configure" msgstr "" -msgid "" -"For the best compatibility with your AMD hardware, you may want to use either" -" the all open-source or AMD / ATI options." +msgid "For the best compatibility with your AMD hardware, you may want to use either the all open-source or AMD / ATI options." msgstr "" -msgid "" -"For the best compatibility with your Intel hardware, you may want to use" -" either the all open-source or Intel options.\n" +msgid "For the best compatibility with your Intel hardware, you may want to use either the all open-source or Intel options.\n" msgstr "" -msgid "" -"For the best compatibility with your Nvidia hardware, you may want to use the" -" Nvidia proprietary driver.\n" +msgid "For the best compatibility with your Nvidia hardware, you may want to use the Nvidia proprietary driver.\n" msgstr "" msgid "" @@ -242,9 +211,7 @@ msgstr "" msgid "Adding partition...." msgstr "" -msgid "" -"You need to enter a valid fs-type in order to continue. See `man parted` for" -" valid fs-type's." +msgid "You need to enter a valid fs-type in order to continue. See `man parted` for valid fs-type's." msgstr "" msgid "Error: Listing profiles on URL \"{}\" resulted in:" @@ -388,18 +355,14 @@ msgstr "" msgid "Password for user \"{}\": " msgstr "" -msgid "" -"Verifying that additional packages exist (this might take a few seconds)" +msgid "Verifying that additional packages exist (this might take a few seconds)" msgstr "" -msgid "" -"Would you like to use automatic time synchronization (NTP) with the default" -" time servers?\n" +msgid "Would you like to use automatic time synchronization (NTP) with the default time servers?\n" msgstr "" msgid "" -"Hardware time and other post-configuration steps might be required in order" -" for NTP to work.\n" +"Hardware time and other post-configuration steps might be required in order for NTP to work.\n" "For more information, please check the Arch wiki" msgstr "" @@ -411,8 +374,7 @@ msgstr "" msgid "" "\n" -" Choose an object from the list, and select one of the available actions for" -" it to execute" +" Choose an object from the list, and select one of the available actions for it to execute" msgstr "" msgid "Cancel" @@ -433,8 +395,9 @@ msgstr "" msgid "Delete" msgstr "" -msgid "Select an action for < {} >" -msgstr "" +#, fuzzy +msgid "Select an action for '{}'" +msgstr "حدِّد منطقة زمنية" msgid "Copy to new key:" msgstr "" @@ -447,13 +410,10 @@ msgid "" "This is your chosen configuration:" msgstr "" -msgid "" -"Pacman is already running, waiting maximum 10 minutes for it to terminate." +msgid "Pacman is already running, waiting maximum 10 minutes for it to terminate." msgstr "" -msgid "" -"Pre-existing pacman lock never exited. Please clean up any existing pacman" -" sessions before using archinstall." +msgid "Pre-existing pacman lock never exited. Please clean up any existing pacman sessions before using archinstall." msgstr "" msgid "Choose which optional additional repositories to enable" @@ -598,9 +558,7 @@ msgstr "" msgid "Would you like to create a separate partition for /home?" msgstr "" -msgid "" -"The selected drives do not have the minimum capacity required for an" -" automatic suggestion\n" +msgid "The selected drives do not have the minimum capacity required for an automatic suggestion\n" msgstr "" msgid "Minimum capacity for /home partition: {}GB\n" @@ -648,31 +606,22 @@ msgstr "" msgid "Mark/Unmark a partition as compressed (btrfs only)" msgstr "" -msgid "" -"The password you are using seems to be weak, are you sure you want to use it?" +msgid "The password you are using seems to be weak, are you sure you want to use it?" msgstr "" -msgid "" -"Provides a selection of desktop environments and tiling window managers, e.g." -" gnome, kde, sway" +msgid "Provides a selection of desktop environments and tiling window managers, e.g. gnome, kde, sway" msgstr "" msgid "Select your desired desktop environment" msgstr "" -msgid "" -"A very basic installation that allows you to customize Arch Linux as you see" -" fit." +msgid "A very basic installation that allows you to customize Arch Linux as you see fit." msgstr "" -msgid "" -"Provides a selection of various server packages to install and enable, e.g." -" httpd, nginx, mariadb" +msgid "Provides a selection of various server packages to install and enable, e.g. httpd, nginx, mariadb" msgstr "" -msgid "" -"Choose which servers to install, if none then a minimal installation wil be" -" done" +msgid "Choose which servers to install, if none then a minimal installation will be done" msgstr "" msgid "Installs a minimal system as well as xorg and graphics drivers." @@ -681,9 +630,7 @@ msgstr "" msgid "Press Enter to continue." msgstr "" -msgid "" -"Would you like to chroot into the newly created installation and perform" -" post-installation configuration?" +msgid "Would you like to chroot into the newly created installation and perform post-installation configuration?" msgstr "" msgid "Are you sure you want to reset this setting?" @@ -695,9 +642,7 @@ msgstr "" msgid "Any modifications to the existing setting will reset the disk layout!" msgstr "" -msgid "" -"If you reset the harddrive selection this will also reset the current disk" -" layout. Are you sure?" +msgid "If you reset the harddrive selection this will also reset the current disk layout. Are you sure?" msgstr "" msgid "Save and exit" @@ -740,9 +685,7 @@ msgstr "" msgid "Value: " msgstr "" -msgid "" -"You can skip selecting a drive and partitioning and use whatever drive-setup" -" is mounted at /mnt (experimental)" +msgid "You can skip selecting a drive and partitioning and use whatever drive-setup is mounted at /mnt (experimental)" msgstr "" msgid "Select one of the disks or skip and use /mnt as default" @@ -766,8 +709,7 @@ msgstr "" msgid "Bus-type" msgstr "" -msgid "" -"Either root-password or at least 1 user with sudo privileges must be specified" +msgid "Either root-password or at least 1 user with sudo privileges must be specified" msgstr "" msgid "Enter username (leave blank to skip): " @@ -781,3 +723,53 @@ msgstr "" msgid "Select which partitions to encrypt:" msgstr "" + +msgid "very weak" +msgstr "" + +msgid "weak" +msgstr "" + +msgid "moderate" +msgstr "" + +msgid "strong" +msgstr "" + +msgid "Add subvolume" +msgstr "" + +msgid "Edit subvolume" +msgstr "" + +msgid "Delete subvolume" +msgstr "" + +msgid "Configured {} interfaces" +msgstr "" + +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" diff --git a/archinstall/locales/base.pot b/archinstall/locales/base.pot index 7a259336..b2be65f8 100644 --- a/archinstall/locales/base.pot +++ b/archinstall/locales/base.pot @@ -787,3 +787,39 @@ msgstr "" msgid "Configured {} interfaces" msgstr "" + +msgid "" +"This option enables the number of parallel downloads that can occur during " +"installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid "" +" - Maximum value : {max_downloads} ( Allows {max_downloads} parallel " +"downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid "" +" - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a " +"time )" +msgstr "" + +msgid "" +" - Disable/Default : 0 ( Disables parallel downloading, allows only 1 " +"download at a time )" +msgstr "" + +#, python-brace-format +msgid "" +"Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to " +"disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" diff --git a/archinstall/locales/cs/LC_MESSAGES/base.po b/archinstall/locales/cs/LC_MESSAGES/base.po index 7a2a197f..194bbf78 100644 --- a/archinstall/locales/cs/LC_MESSAGES/base.po +++ b/archinstall/locales/cs/LC_MESSAGES/base.po @@ -792,3 +792,29 @@ msgstr "Smazat uživatele" msgid "Configured {} interfaces" msgstr "" + +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" diff --git a/archinstall/locales/de/LC_MESSAGES/base.po b/archinstall/locales/de/LC_MESSAGES/base.po index a601326e..11fc821d 100644 --- a/archinstall/locales/de/LC_MESSAGES/base.po +++ b/archinstall/locales/de/LC_MESSAGES/base.po @@ -808,6 +808,32 @@ msgstr "Benutzerkonto löschen" msgid "Configured {} interfaces" msgstr "" +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" + #~ msgid "Select disk layout" #~ msgstr "Laufwerke-layout auswählen" diff --git a/archinstall/locales/el/LC_MESSAGES/base.po b/archinstall/locales/el/LC_MESSAGES/base.po index 2561c9f2..9b342ac9 100644 --- a/archinstall/locales/el/LC_MESSAGES/base.po +++ b/archinstall/locales/el/LC_MESSAGES/base.po @@ -787,6 +787,9 @@ msgstr "Επεξεργασία υποόγκου" msgid "Delete subvolume" msgstr "Διαγραφή υποόγκου" +msgid "Configured {} interfaces" +msgstr "Διαμορφωμένες {} διεπαφές" + msgid "This option enables the number of parallel downloads that can occur during installation" msgstr "Αυτή η επιλογή θέτει τον αριθμό των παράλληλων λήψεων που μπορούν να συμβούν κατά την εγκατάσταση" @@ -815,6 +818,3 @@ msgstr "Μη έγκυρη είσοδος! Προσπαθήστε ξανά με msgid "Parallel Downloads" msgstr "Παράλληλες Λήψεις" - -msgid "Configured {} interfaces" -msgstr "Διαμορφωμένες {} διεπαφές" diff --git a/archinstall/locales/en/LC_MESSAGES/base.po b/archinstall/locales/en/LC_MESSAGES/base.po index 1825d501..01d4414f 100644 --- a/archinstall/locales/en/LC_MESSAGES/base.po +++ b/archinstall/locales/en/LC_MESSAGES/base.po @@ -743,3 +743,29 @@ msgstr "" msgid "Configured {} interfaces" msgstr "" + +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" diff --git a/archinstall/locales/es/LC_MESSAGES/base.po b/archinstall/locales/es/LC_MESSAGES/base.po index 47a64b0a..6186b6d8 100644 --- a/archinstall/locales/es/LC_MESSAGES/base.po +++ b/archinstall/locales/es/LC_MESSAGES/base.po @@ -791,6 +791,32 @@ msgstr "Eliminar usuario" msgid "Configured {} interfaces" msgstr "" +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" + #~ msgid "Select disk layout" #~ msgstr "Seleccione el diseño del disco" diff --git a/archinstall/locales/fr/LC_MESSAGES/base.po b/archinstall/locales/fr/LC_MESSAGES/base.po index 877b793f..2d7de615 100644 --- a/archinstall/locales/fr/LC_MESSAGES/base.po +++ b/archinstall/locales/fr/LC_MESSAGES/base.po @@ -797,6 +797,32 @@ msgstr "Supprimer l'utilisateur" msgid "Configured {} interfaces" msgstr "" +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" + #~ msgid "Select disk layout" #~ msgstr "Sélectionner la disposition du disque" diff --git a/archinstall/locales/it/LC_MESSAGES/base.po b/archinstall/locales/it/LC_MESSAGES/base.po index baf55a28..893fe292 100644 --- a/archinstall/locales/it/LC_MESSAGES/base.po +++ b/archinstall/locales/it/LC_MESSAGES/base.po @@ -799,3 +799,29 @@ msgstr "Elimina utente" msgid "Configured {} interfaces" msgstr "" + +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" diff --git a/archinstall/locales/nl/LC_MESSAGES/base.po b/archinstall/locales/nl/LC_MESSAGES/base.po index 8553595e..aa7754d2 100644 --- a/archinstall/locales/nl/LC_MESSAGES/base.po +++ b/archinstall/locales/nl/LC_MESSAGES/base.po @@ -823,6 +823,32 @@ msgstr "Gebruiker verwijderen" msgid "Configured {} interfaces" msgstr "" +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" + #~ msgid "Select disk layout" #~ msgstr "Kies een schijfindeling" diff --git a/archinstall/locales/pl/LC_MESSAGES/base.po b/archinstall/locales/pl/LC_MESSAGES/base.po index 1bd4b47e..c65126ea 100644 --- a/archinstall/locales/pl/LC_MESSAGES/base.po +++ b/archinstall/locales/pl/LC_MESSAGES/base.po @@ -805,6 +805,32 @@ msgstr "Usuń użytkownika" msgid "Configured {} interfaces" msgstr "" +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" + #~ msgid "Select disk layout" #~ msgstr "Wybierz układ dysku" diff --git a/archinstall/locales/pt/LC_MESSAGES/base.po b/archinstall/locales/pt/LC_MESSAGES/base.po index 2e9b461c..98d261a9 100644 --- a/archinstall/locales/pt/LC_MESSAGES/base.po +++ b/archinstall/locales/pt/LC_MESSAGES/base.po @@ -843,6 +843,32 @@ msgstr "Eliminar Utilizador" msgid "Configured {} interfaces" msgstr "" +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" + #~ msgid "Select disk layout" #~ msgstr "Seleciona o esquema de disco" diff --git a/archinstall/locales/pt_BR/LC_MESSAGES/base.po b/archinstall/locales/pt_BR/LC_MESSAGES/base.po index 69f8c902..3acbdb95 100644 --- a/archinstall/locales/pt_BR/LC_MESSAGES/base.po +++ b/archinstall/locales/pt_BR/LC_MESSAGES/base.po @@ -1,7 +1,6 @@ # Translators: # @Cain-dev (cain-dev.github.io) # Rafael Fontenelle - msgid "" msgstr "" "Last-Translator: Rafael Fontenelle \n" @@ -788,3 +787,29 @@ msgstr "Deletar subvolume" msgid "Configured {} interfaces" msgstr "{} interfaces configuradas" + +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" diff --git a/archinstall/locales/ru/LC_MESSAGES/base.po b/archinstall/locales/ru/LC_MESSAGES/base.po index a88c58a1..8aeb57ff 100644 --- a/archinstall/locales/ru/LC_MESSAGES/base.po +++ b/archinstall/locales/ru/LC_MESSAGES/base.po @@ -791,6 +791,32 @@ msgstr "Удалить подтом" msgid "Configured {} interfaces" msgstr "Настроено интерфейсов: {}" +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" + #, python-brace-format #~ msgid "Edit {origkey} :" #~ msgstr "Редактировать {origkey}:" diff --git a/archinstall/locales/sv/LC_MESSAGES/base.po b/archinstall/locales/sv/LC_MESSAGES/base.po index b3712972..590929c6 100644 --- a/archinstall/locales/sv/LC_MESSAGES/base.po +++ b/archinstall/locales/sv/LC_MESSAGES/base.po @@ -804,5 +804,31 @@ msgstr "Ta bort användare" msgid "Configured {} interfaces" msgstr "" +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" + #~ msgid "Select disk layout" #~ msgstr "Välj hårddisk-layout" diff --git a/archinstall/locales/ta/LC_MESSAGES/base.po b/archinstall/locales/ta/LC_MESSAGES/base.po index 9cf261f2..3c1cd848 100644 --- a/archinstall/locales/ta/LC_MESSAGES/base.po +++ b/archinstall/locales/ta/LC_MESSAGES/base.po @@ -790,9 +790,6 @@ msgstr "துணைத்தொகுதியை நீக்கவும்" msgid "Configured {} interfaces" msgstr "கட்டமைக்கப்பட்ட {} இடைமுகங்கள்" -msgid "Parallel Downloads" -msgstr "இணையான பதிவிறக்கங்கள்" - msgid "This option enables the number of parallel downloads that can occur during installation" msgstr "இந்த விருப்பம் நிறுவலின் போது நிகழக்கூடிய இணையான பதிவிறக்கங்களின் எண்ணிக்கையை செயல்படுத்துகிறது" @@ -818,3 +815,6 @@ msgstr " - முடக்கு/இயல்புநிலை: 0 (இணை #, python-brace-format msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" msgstr "தவறான உள்ளீடு! சரியான உள்ளீட்டில் [1 முதல் {max_downloads} வரை அல்லது முடக்க 0 வரை] மீண்டும் முயற்சிக்கவும்" + +msgid "Parallel Downloads" +msgstr "இணையான பதிவிறக்கங்கள்" diff --git a/archinstall/locales/tr/LC_MESSAGES/base.po b/archinstall/locales/tr/LC_MESSAGES/base.po index 4d978ee0..63f9dee0 100644 --- a/archinstall/locales/tr/LC_MESSAGES/base.po +++ b/archinstall/locales/tr/LC_MESSAGES/base.po @@ -803,3 +803,29 @@ msgstr "Kullanıcı Sil" msgid "Configured {} interfaces" msgstr "" + +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" diff --git a/archinstall/locales/ur/LC_MESSAGES/base.po b/archinstall/locales/ur/LC_MESSAGES/base.po index 2927c3ea..6494ae28 100644 --- a/archinstall/locales/ur/LC_MESSAGES/base.po +++ b/archinstall/locales/ur/LC_MESSAGES/base.po @@ -825,6 +825,32 @@ msgstr "صارف کو حذف کریں" msgid "Configured {} interfaces" msgstr "" +msgid "This option enables the number of parallel downloads that can occur during installation" +msgstr "" + +#, python-brace-format +msgid "" +"Enter the number of parallel downloads to be enabled.\n" +" (Enter a value between 1 to {max_downloads})\n" +"Note:" +msgstr "" + +msgid " - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )" +msgstr "" + +msgid " - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )" +msgstr "" + +msgid " - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )" +msgstr "" + +#, python-brace-format +msgid "Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]" +msgstr "" + +msgid "Parallel Downloads" +msgstr "" + #~ msgid "Select disk layout" #~ msgstr "ڈسک لے آؤٹ کو منتخب کریں" diff --git a/examples/swiss.py b/examples/swiss.py index 5d40dc68..da45cd18 100644 --- a/examples/swiss.py +++ b/examples/swiss.py @@ -164,7 +164,7 @@ class SetupMenu(archinstall.GeneralMenu): _('Archinstall language'), lambda x: self._select_archinstall_language(x), display_func=lambda x: x.display_name, - default=self.translation_handler.get_language('en'), + default=self.translation_handler.get_language_by_abbr('en'), enabled=True ) ) -- cgit v1.2.3-70-g09d2 From a2adeca5eba17afc36d964879ce30e88a0e6a3ba Mon Sep 17 00:00:00 2001 From: Daniel Girtler Date: Wed, 7 Sep 2022 23:48:14 +1000 Subject: Fix translation fonts (#1461) Co-authored-by: Daniel Girtler --- archinstall/lib/translationhandler.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'archinstall/lib/translationhandler.py') diff --git a/archinstall/lib/translationhandler.py b/archinstall/lib/translationhandler.py index d6b3ccb6..08deb3e7 100644 --- a/archinstall/lib/translationhandler.py +++ b/archinstall/lib/translationhandler.py @@ -46,8 +46,8 @@ class TranslationHandler: _languages = 'languages.json' def __init__(self): - # to display cyrillic languages correctly - self._set_font('UniCyr_8x16') + # to display latin, greek, cyrillic characters + self._set_font('LatGrkCyr-8x16') self._total_messages = self._get_total_active_messages() self._translated_languages = self._get_translations() @@ -61,7 +61,7 @@ class TranslationHandler: Load all translated languages and return a list of such """ mappings = self._load_language_mappings() - defined_languages = self._defined_languages() + defined_languages = self._provided_translations() languages = [] @@ -165,13 +165,20 @@ class TranslationHandler: locales_dir = Path.joinpath(cur_path, 'locales') return locales_dir - def _defined_languages(self) -> List[str]: + def _provided_translations(self) -> List[str]: """ Get a list of all known languages """ locales_dir = self._get_locales_dir() filenames = os.listdir(locales_dir) - return list(filter(lambda x: len(x) == 2 or x == 'pt_BR', filenames)) + + translation_files = [] + for filename in filenames: + if len(filename) == 2 or filename == 'pt_BR': + if filename not in ['ur', 'ta']: + translation_files.append(filename) + + return translation_files class DeferredTranslation: -- cgit v1.2.3-70-g09d2 From 94df913e0f2e68178ad64d385bbc453416b7e4b0 Mon Sep 17 00:00:00 2001 From: Daniel Girtler Date: Mon, 12 Sep 2022 05:23:21 +1000 Subject: Update handling of unsupported translations (#1467) * Handle unsupported fonts * Update archinstall/locales/README.md Co-authored-by: codefiles <11915375+codefiles@users.noreply.github.com> Co-authored-by: Daniel Girtler Co-authored-by: codefiles <11915375+codefiles@users.noreply.github.com> --- archinstall/lib/menu/menu.py | 18 +++++++--- archinstall/lib/translationhandler.py | 42 ++++++++++++++++-------- archinstall/lib/user_interaction/general_conf.py | 26 ++++++++++++--- archinstall/locales/README.md | 22 +++++++++++-- archinstall/locales/languages.json | 4 +-- 5 files changed, 85 insertions(+), 27 deletions(-) (limited to 'archinstall/lib/translationhandler.py') diff --git a/archinstall/lib/menu/menu.py b/archinstall/lib/menu/menu.py index 16153e2c..112bc0ae 100644 --- a/archinstall/lib/menu/menu.py +++ b/archinstall/lib/menu/menu.py @@ -1,7 +1,7 @@ from dataclasses import dataclass from enum import Enum, auto from os import system -from typing import Dict, List, Union, Any, TYPE_CHECKING, Optional +from typing import Dict, List, Union, Any, TYPE_CHECKING, Optional, Callable from archinstall.lib.menu.simple_menu import TerminalMenu @@ -52,9 +52,9 @@ class Menu(TerminalMenu): sort :bool = True, preset_values :Union[str, List[str]] = None, cursor_index : Optional[int] = None, - preview_command=None, - preview_size=0.75, - preview_title='Info', + preview_command: Optional[Callable] = None, + preview_size: float = 0.75, + preview_title: str = 'Info', header :Union[List[str],str] = None, raise_error_on_interrupt :bool = False, raise_error_warning_msg :str = '', @@ -152,6 +152,7 @@ class Menu(TerminalMenu): self._multi = multi self._raise_error_on_interrupt = raise_error_on_interrupt self._raise_error_warning_msg = raise_error_warning_msg + self._preview_command = preview_command menu_title = f'\n{title}\n\n' @@ -198,7 +199,7 @@ class Menu(TerminalMenu): # show_search_hint=True, preselected_entries=self.preset_values, cursor_index=self.cursor_index, - preview_command=preview_command, + preview_command=lambda x: self._preview_wrapper(preview_command, x), preview_size=preview_size, preview_title=preview_title, raise_error_on_interrupt=self._raise_error_on_interrupt, @@ -235,6 +236,13 @@ class Menu(TerminalMenu): else: return MenuSelection(type_=MenuSelectionType.Esc) + def _preview_wrapper(self, preview_command: Optional[Callable], current_selection: str) -> Optional[str]: + if preview_command: + if self._default_option is not None and f'{self._default_option} {self._default_str}' == current_selection: + current_selection = self._default_option + return preview_command(current_selection) + return None + def run(self) -> MenuSelection: ret = self._show() diff --git a/archinstall/lib/translationhandler.py b/archinstall/lib/translationhandler.py index 08deb3e7..ef33b8ec 100644 --- a/archinstall/lib/translationhandler.py +++ b/archinstall/lib/translationhandler.py @@ -17,41 +17,55 @@ if TYPE_CHECKING: @dataclass class Language: abbr: str - lang: str + name_en: str translation: gettext.NullTranslations translation_percent: int translated_lang: Optional[str] + external_dep: Optional[str] @property def display_name(self) -> str: - if self.translated_lang: + if not self.external_dep and self.translated_lang: name = self.translated_lang else: - name = self.lang + name = self.name_en + return f'{name} ({self.translation_percent}%)' def is_match(self, lang_or_translated_lang: str) -> bool: - if self.lang == lang_or_translated_lang: + if self.name_en == lang_or_translated_lang: return True elif self.translated_lang == lang_or_translated_lang: return True return False def json(self) -> str: - return self.lang + return self.name_en class TranslationHandler: - _base_pot = 'base.pot' - _languages = 'languages.json' - def __init__(self): - # to display latin, greek, cyrillic characters - self._set_font('LatGrkCyr-8x16') + self._base_pot = 'base.pot' + self._languages = 'languages.json' + + # check if a custom font was provided, otherwise we'll + # use one that can display latin, greek, cyrillic characters + if self.is_custom_font_enabled(): + self._set_font(self.custom_font_path().name) + else: + self._set_font('LatGrkCyr-8x16') self._total_messages = self._get_total_active_messages() self._translated_languages = self._get_translations() + @classmethod + def custom_font_path(cls) -> Path: + return Path('/usr/share/kbd/consolefonts/archinstall_font.psfu.gz') + + @classmethod + def is_custom_font_enabled(cls) -> bool: + return cls.custom_font_path().exists() + @property def translated_languages(self) -> List[Language]: return self._translated_languages @@ -70,6 +84,7 @@ class TranslationHandler: abbr = mapping_entry['abbr'] lang = mapping_entry['lang'] translated_lang = mapping_entry.get('translated_lang', None) + external_dep = mapping_entry.get('external_dep', False) try: # get a translation for a specific language @@ -84,7 +99,7 @@ class TranslationHandler: # prevent cases where the .pot file is out of date and the percentage is above 100 percent = min(100, percent) - language = Language(abbr, lang, translation, percent, translated_lang) + language = Language(abbr, lang, translation, percent, translated_lang, external_dep) languages.append(language) except FileNotFoundError as error: raise TranslationError(f"Could not locate language file for '{lang}': {error}") @@ -138,7 +153,7 @@ class TranslationHandler: Get a language object by it's name, e.g. English """ try: - return next(filter(lambda x: x.lang == name, self._translated_languages)) + return next(filter(lambda x: x.name_en == name, self._translated_languages)) except Exception: raise ValueError(f'No language with name found: {name}') @@ -175,8 +190,7 @@ class TranslationHandler: translation_files = [] for filename in filenames: if len(filename) == 2 or filename == 'pt_BR': - if filename not in ['ur', 'ta']: - translation_files.append(filename) + translation_files.append(filename) return translation_files diff --git a/archinstall/lib/user_interaction/general_conf.py b/archinstall/lib/user_interaction/general_conf.py index 34c80c21..6365014d 100644 --- a/archinstall/lib/user_interaction/general_conf.py +++ b/archinstall/lib/user_interaction/general_conf.py @@ -13,7 +13,7 @@ from ..output import log from ..profiles import Profile, list_profiles from ..mirrors import list_mirrors -from ..translationhandler import Language +from ..translationhandler import Language, TranslationHandler from ..packages.packages import validate_package_list from ..storage import storage @@ -125,16 +125,34 @@ def select_archinstall_language(languages: List[Language], preset_value: Languag # name of the language in its own language options = {lang.display_name: lang for lang in languages} + def dependency_preview(current_selection: str) -> Optional[str]: + current_lang = options[current_selection] + + if current_lang.external_dep and not TranslationHandler.is_custom_font_enabled(): + font_file = TranslationHandler.custom_font_path() + text = str(_('To be able to use this translation, please install a font manually that supports the language.')) + '\n' + text += str(_('The font should be stored as {}')).format(font_file) + return text + return None + choice = Menu( _('Archinstall language'), list(options.keys()), - default_option=preset_value.display_name + default_option=preset_value.display_name, + preview_command=lambda x: dependency_preview(x), + preview_size=0.5 ).run() match choice.type_: - case MenuSelectionType.Esc: return preset_value + case MenuSelectionType.Esc: + return preset_value case MenuSelectionType.Selection: - return options[choice.value] + language: Language = options[choice.value] + # we have to make sure that the proper AUR dependency is + # present to be able to use this language + if not language.external_dep or TranslationHandler.is_custom_font_enabled(): + return language + return select_archinstall_language(languages, preset_value) def select_profile(preset) -> Optional[Profile]: diff --git a/archinstall/locales/README.md b/archinstall/locales/README.md index 51662702..37dc32e3 100644 --- a/archinstall/locales/README.md +++ b/archinstall/locales/README.md @@ -1,8 +1,26 @@ # Nationalization -Archinstall supports multiple languages, which depend on translations coming from the community :) +Archinstall supports multiple languages, which depend on translations coming from the community :) -New languages can be added simply by creating a new folder with the proper language abbrevation (see list `languages.json` if unsure). +## Important Note +Before starting a new language translation be aware that a font for that language may not be +available on the ISO. We are using the pre-installed font `/usr/share/kbd/consolefonts/LatGrkCyr-8x16.psfu.gz` in archinstall +which should cover a fair amount of different languages but unfortunately not all of them. + +We have the option to provide a custom font in case the above is not covering a specific language, which can +be achieved by installing the font yourself on the ISO and saving it to `/usr/share/kbd/consolefonts/archinstall_font.psfu.gz`. +If this font is present it will be automatically loaded and all languages which are not supported by the default font will +be enabled (but only some might actually work). + +Please make sure that the provided language works with the default font on the ISO, and if not mark it in the `languages.json` +that it needs an external dependency +``` +{"abbr": "ur", "lang": "Urdu", "translated_lang": "اردو", "external_dep": true}, +``` + +## Adding new languages + +New languages can be added simply by creating a new folder with the proper language abbreviation (see list `languages.json` if unsure). Run the following command to create a new template for a language ``` mkdir -p /LC_MESSAGES/ && touch /LC_MESSAGES/base.po diff --git a/archinstall/locales/languages.json b/archinstall/locales/languages.json index 55ddf57e..344d3d51 100644 --- a/archinstall/locales/languages.json +++ b/archinstall/locales/languages.json @@ -155,7 +155,7 @@ {"abbr": "sw", "lang": "Swahili (macrolanguage)"}, {"abbr": "sv", "lang": "Swedish", "translated_lang": "Svenska"}, {"abbr": "ty", "lang": "Tahitian"}, - {"abbr": "ta", "lang": "Tamil", "translated_lang": "தமிழ்"}, + {"abbr": "ta", "lang": "Tamil", "translated_lang": "தமிழ்", "external_dep": true}, {"abbr": "tt", "lang": "Tatar"}, {"abbr": "te", "lang": "Telugu"}, {"abbr": "tg", "lang": "Tajik"}, @@ -170,7 +170,7 @@ {"abbr": "tw", "lang": "Twi"}, {"abbr": "ug", "lang": "Uighur"}, {"abbr": "uk", "lang": "Ukrainian"}, - {"abbr": "ur", "lang": "Urdu", "translated_lang": "اردو"}, + {"abbr": "ur", "lang": "Urdu", "translated_lang": "اردو", "external_dep": true}, {"abbr": "uz", "lang": "Uzbek"}, {"abbr": "ve", "lang": "Venda"}, {"abbr": "vi", "lang": "Vietnamese"}, -- cgit v1.2.3-70-g09d2