Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/translationhandler.py
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib/translationhandler.py')
-rw-r--r--archinstall/lib/translationhandler.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/archinstall/lib/translationhandler.py b/archinstall/lib/translationhandler.py
index 0d74f974..3ea4c70e 100644
--- a/archinstall/lib/translationhandler.py
+++ b/archinstall/lib/translationhandler.py
@@ -1,14 +1,14 @@
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
+
+from .output import error, debug
if TYPE_CHECKING:
_: Any
@@ -80,8 +80,8 @@ class TranslationHandler:
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}")
+ except FileNotFoundError as err:
+ raise FileNotFoundError(f"Could not locate language file for '{lang}': {err}")
return languages
@@ -89,12 +89,12 @@ class TranslationHandler:
"""
Set the provided font as the new terminal font
"""
- from .general import SysCommand, log
+ from .general import SysCommand
try:
- log(f'Setting font: {font}', level=logging.DEBUG)
+ debug(f'Setting font: {font}')
SysCommand(f'setfont {font}')
except Exception:
- log(f'Unable to set font {font}', level=logging.ERROR)
+ error(f'Unable to set font {font}')
def _load_language_mappings(self) -> List[Dict[str, Any]]:
"""
@@ -138,7 +138,7 @@ class TranslationHandler:
def get_language_by_abbr(self, abbr: str) -> Language:
"""
- Get a language object by its abbrevation, e.g. en
+ Get a language object by its abbreviation, e.g. en
"""
try:
return next(filter(lambda x: x.abbr == abbr, self._translated_languages))
@@ -168,7 +168,7 @@ class TranslationHandler:
translation_files = []
for filename in filenames:
- if len(filename) == 2 or filename == 'pt_BR':
+ if len(filename) == 2 or filename in ['pt_BR', 'zh-CN', 'zh-TW']:
translation_files.append(filename)
return translation_files
@@ -206,4 +206,4 @@ class DeferredTranslation:
@classmethod
def install(cls):
import builtins
- builtins._ = cls
+ builtins._ = cls # type: ignore