Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2022-11-11 19:11:41 +1100
committerGitHub <noreply@github.com>2022-11-11 09:11:41 +0100
commitdee79265897f67689e626d5c85f5b48b8e623a4a (patch)
treee23b103903e3f97bc174e93449bb494a98f726a3 /archinstall
parent9db6a25a08cf9a28bd848a416b105495ad9a5b0d (diff)
Remove custom font setting (#1552)
* Remove custom font setting * flake8 * Remove default preview Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/menu/menu.py2
-rw-r--r--archinstall/lib/translationhandler.py25
-rw-r--r--archinstall/lib/user_interaction/general_conf.py35
-rw-r--r--archinstall/locales/README.md23
-rw-r--r--archinstall/locales/languages.json4
5 files changed, 20 insertions, 69 deletions
diff --git a/archinstall/lib/menu/menu.py b/archinstall/lib/menu/menu.py
index 13ce8c0e..773ff1de 100644
--- a/archinstall/lib/menu/menu.py
+++ b/archinstall/lib/menu/menu.py
@@ -53,7 +53,7 @@ class Menu(TerminalMenu):
preset_values :Union[str, List[str]] = None,
cursor_index : Optional[int] = None,
preview_command: Optional[Callable] = None,
- preview_size: float = 0.75,
+ preview_size: float = 0.0,
preview_title: str = 'Info',
header :Union[List[str],str] = None,
raise_error_on_interrupt :bool = False,
diff --git a/archinstall/lib/translationhandler.py b/archinstall/lib/translationhandler.py
index 1a3ed85f..0d74f974 100644
--- a/archinstall/lib/translationhandler.py
+++ b/archinstall/lib/translationhandler.py
@@ -21,15 +21,10 @@ class Language:
translation: gettext.NullTranslations
translation_percent: int
translated_lang: Optional[str]
- external_dep: Optional[str]
@property
def display_name(self) -> str:
- if not self.external_dep and self.translated_lang:
- name = self.translated_lang
- else:
- name = self.name_en
-
+ name = self.name_en
return f'{name} ({self.translation_percent}%)'
def is_match(self, lang_or_translated_lang: str) -> bool:
@@ -48,24 +43,9 @@ class TranslationHandler:
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
@@ -84,7 +64,6 @@ 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
@@ -99,7 +78,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, external_dep)
+ 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}")
diff --git a/archinstall/lib/user_interaction/general_conf.py b/archinstall/lib/user_interaction/general_conf.py
index 6365014d..efd746a4 100644
--- a/archinstall/lib/user_interaction/general_conf.py
+++ b/archinstall/lib/user_interaction/general_conf.py
@@ -4,19 +4,16 @@ import logging
import pathlib
from typing import List, Any, Optional, Dict, TYPE_CHECKING
-from ..menu.menu import MenuSelectionType
-from ..menu.text_input import TextInput
-
from ..locale_helpers import list_keyboard_languages, list_timezones
from ..menu import Menu
-from ..output import log
-from ..profiles import Profile, list_profiles
+from ..menu.menu import MenuSelectionType
+from ..menu.text_input import TextInput
from ..mirrors import list_mirrors
-
-from ..translationhandler import Language, TranslationHandler
+from ..output import log
from ..packages.packages import validate_package_list
-
+from ..profiles import Profile, list_profiles
from ..storage import storage
+from ..translationhandler import Language
if TYPE_CHECKING:
_: Any
@@ -125,21 +122,14 @@ 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
+ title = 'NOTE: If a language can not displayed properly, a proper font must be set manually in the console.\n'
+ title += 'All available fonts can be found in "/usr/share/kbd/consolefonts"\n'
+ title += 'e.g. setfont LatGrkCyr-8x16 (to display latin/greek/cyrillic characters)\n'
choice = Menu(
- _('Archinstall language'),
+ title,
list(options.keys()),
default_option=preset_value.display_name,
- preview_command=lambda x: dependency_preview(x),
preview_size=0.5
).run()
@@ -147,12 +137,7 @@ def select_archinstall_language(languages: List[Language], preset_value: Languag
case MenuSelectionType.Esc:
return preset_value
case MenuSelectionType.Selection:
- 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)
+ return options[choice.value]
def select_profile(preset) -> Optional[Profile]:
diff --git a/archinstall/locales/README.md b/archinstall/locales/README.md
index cd7d794a..e1266209 100644
--- a/archinstall/locales/README.md
+++ b/archinstall/locales/README.md
@@ -4,19 +4,13 @@ Archinstall supports multiple languages, which depend on translations coming fro
## 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.
+available on the ISO.
-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).
+Fonts that are using a different character set than Latin will not be displayed correctly. If those languages
+want to be selected than a proper font has to be set manually in the console.
-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},
-```
+All available console fonts can be found in `/usr/share/kbd/consolefonts` and they
+can be set with `setfont LatGrkCyr-8x16`
## Adding new languages
@@ -49,10 +43,3 @@ msgstr "Wollen sie wirklich abbrechen?"
After the translations have been written, run the script once more `./locales_generator.sh` and it will auto-generate the `base.mo` file with the included translations.
After that you're all ready to go and enjoy Archinstall in the new language :)
-
-To display the language inside Archinstall in your own tongue, please edit the file `languages.json` and
-add a `translated_lang` entry to the respective language, e.g.
-
-```
- {"abbr": "pl", "lang": "Polish", "translated_lang": "Polski"}
-```
diff --git a/archinstall/locales/languages.json b/archinstall/locales/languages.json
index 2a7fab2e..12228b47 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": "தமிழ்", "external_dep": true},
+ {"abbr": "ta", "lang": "Tamil", "translated_lang": "தமிழ்"},
{"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": "اردو", "external_dep": true},
+ {"abbr": "ur", "lang": "Urdu", "translated_lang": "اردو"},
{"abbr": "uz", "lang": "Uzbek"},
{"abbr": "ve", "lang": "Venda"},
{"abbr": "vi", "lang": "Vietnamese"},