We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
The parallel downloads page is shown half in English, half in another language if a language other than English is selected
I checked every language that has this page translated and it happens on every single one.
### Example:
![French-example](https://user-images.githubusercontent.com/126529524/232617481-5f4f06ac-7359-4f61-96f2-6e7cdbeda770.png)

### Another one:
![Russian-example](https://user-images.githubusercontent.com/126529524/232617561-9463fc23-3223-4814-af8c-586dc1638ab3.png)



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `archinstall/lib/interactions/general_conf.py`
Content:
```
1 from __future__ import annotations
2 
3 import pathlib
4 from typing import List, Any, Optional, TYPE_CHECKING
5 
6 from ..locale import list_timezones, list_keyboard_languages
7 from ..menu import MenuSelectionType, Menu, TextInput
8 from ..output import warn
9 from ..packages.packages import validate_package_list
10 from ..storage import storage
11 from ..translationhandler import Language
12 
13 if TYPE_CHECKING:
14 	_: Any
15 
16 
17 def ask_ntp(preset: bool = True) -> bool:
18 	prompt = str(_('Would you like to use automatic time synchronization (NTP) with the default time servers?\n'))
19 	prompt += str(_('Hardware time and other post-configuration steps might be required in order for NTP to work.\nFor more information, please check the Arch wiki'))
20 	if preset:
21 		preset_val = Menu.yes()
22 	else:
23 		preset_val = Menu.no()
24 	choice = Menu(prompt, Menu.yes_no(), skip=False, preset_values=preset_val, default_option=Menu.yes()).run()
25 
26 	return False if choice.value == Menu.no() else True
27 
28 
29 def ask_hostname(preset: str = '') -> str:
30 	while True:
31 		hostname = TextInput(
32 			str(_('Desired hostname for the installation: ')),
33 			preset
34 		).run().strip()
35 
36 		if hostname:
37 			return hostname
38 
39 
40 def ask_for_a_timezone(preset: Optional[str] = None) -> Optional[str]:
41 	timezones = list_timezones()
42 	default = 'UTC'
43 
44 	choice = Menu(
45 		_('Select a timezone'),
46 		list(timezones),
47 		preset_values=preset,
48 		default_option=default
49 	).run()
50 
51 	match choice.type_:
52 		case MenuSelectionType.Skip: return preset
53 		case MenuSelectionType.Selection: return choice.single_value
54 
55 	return None
56 
57 
58 def ask_for_audio_selection(desktop: bool = True, preset: Optional[str] = None) -> Optional[str]:
59 	no_audio = str(_('No audio server'))
60 	choices = ['pipewire', 'pulseaudio'] if desktop else ['pipewire', 'pulseaudio', no_audio]
61 	default = 'pipewire' if desktop else no_audio
62 
63 	choice = Menu(_('Choose an audio server'), choices, preset_values=preset, default_option=default).run()
64 
65 	match choice.type_:
66 		case MenuSelectionType.Skip: return preset
67 		case MenuSelectionType.Selection: return choice.single_value
68 
69 	return None
70 
71 
72 def select_language(preset: Optional[str] = None) -> Optional[str]:
73 	"""
74 	Asks the user to select a language
75 	Usually this is combined with :ref:`archinstall.list_keyboard_languages`.
76 
77 	:return: The language/dictionary key of the selected language
78 	:rtype: str
79 	"""
80 	kb_lang = list_keyboard_languages()
81 	# sort alphabetically and then by length
82 	sorted_kb_lang = sorted(sorted(list(kb_lang)), key=len)
83 
84 	choice = Menu(
85 		_('Select keyboard layout'),
86 		sorted_kb_lang,
87 		preset_values=preset,
88 		sort=False
89 	).run()
90 
91 	match choice.type_:
92 		case MenuSelectionType.Skip: return preset
93 		case MenuSelectionType.Selection: return choice.single_value
94 
95 	return None
96 
97 
98 def select_archinstall_language(languages: List[Language], preset: Language) -> Language:
99 	# these are the displayed language names which can either be
100 	# the english name of a language or, if present, the
101 	# name of the language in its own language
102 	options = {lang.display_name: lang for lang in languages}
103 
104 	title = 'NOTE: If a language can not displayed properly, a proper font must be set manually in the console.\n'
105 	title += 'All available fonts can be found in "/usr/share/kbd/consolefonts"\n'
106 	title += 'e.g. setfont LatGrkCyr-8x16 (to display latin/greek/cyrillic characters)\n'
107 
108 	choice = Menu(
109 		title,
110 		list(options.keys()),
111 		default_option=preset.display_name,
112 		preview_size=0.5
113 	).run()
114 
115 	match choice.type_:
116 		case MenuSelectionType.Skip: return preset
117 		case MenuSelectionType.Selection: return options[choice.single_value]
118 
119 	raise ValueError('Language selection not handled')
120 
121 
122 def ask_additional_packages_to_install(preset: List[str] = []) -> List[str]:
123 	# Additional packages (with some light weight error handling for invalid package names)
124 	print(_('Only packages such as base, base-devel, linux, linux-firmware, efibootmgr and optional profile packages are installed.'))
125 	print(_('If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.'))
126 
127 	def read_packages(p: List = []) -> list:
128 		display = ' '.join(p)
129 		input_packages = TextInput(_('Write additional packages to install (space separated, leave blank to skip): '), display).run().strip()
130 		return input_packages.split() if input_packages else []
131 
132 	preset = preset if preset else []
133 	packages = read_packages(preset)
134 
135 	if not storage['arguments']['offline'] and not storage['arguments']['no_pkg_lookups']:
136 		while True:
137 			if len(packages):
138 				# Verify packages that were given
139 				print(_("Verifying that additional packages exist (this might take a few seconds)"))
140 				valid, invalid = validate_package_list(packages)
141 
142 				if invalid:
143 					warn(f"Some packages could not be found in the repository: {invalid}")
144 					packages = read_packages(valid)
145 					continue
146 			break
147 
148 	return packages
149 
150 
151 def add_number_of_parrallel_downloads(input_number :Optional[int] = None) -> Optional[int]:
152 	max_downloads = 5
153 	print(_(f"This option enables the number of parallel downloads that can occur during installation"))
154 	print(_(f"Enter the number of parallel downloads to be enabled.\n (Enter a value between 1 to {max_downloads})\nNote:"))
155 	print(_(f" - Maximum value   : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )"))
156 	print(_(f" - Minimum value   : 1 ( Allows 1 parallel download, allows 2 downloads at a time )"))
157 	print(_(f" - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )"))
158 
159 	while True:
160 		try:
161 			input_number = int(TextInput(_("[Default value: 0] > ")).run().strip() or 0)
162 			if input_number <= 0:
163 				input_number = 0
164 			elif input_number > max_downloads:
165 				input_number = max_downloads
166 			break
167 		except:
168 			print(_(f"Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]"))
169 
170 	pacman_conf_path = pathlib.Path("/etc/pacman.conf")
171 	with pacman_conf_path.open() as f:
172 		pacman_conf = f.read().split("\n")
173 
174 	with pacman_conf_path.open("w") as fwrite:
175 		for line in pacman_conf:
176 			if "ParallelDownloads" in line:
177 				fwrite.write(f"ParallelDownloads = {input_number+1}\n") if not input_number == 0 else fwrite.write("#ParallelDownloads = 0\n")
178 			else:
179 				fwrite.write(f"{line}\n")
180 
181 	return input_number
182 
183 
184 def select_additional_repositories(preset: List[str]) -> List[str]:
185 	"""
186 	Allows the user to select additional repositories (multilib, and testing) if desired.
187 
188 	:return: The string as a selected repository
189 	:rtype: string
190 	"""
191 
192 	repositories = ["multilib", "testing"]
193 
194 	choice = Menu(
195 		_('Choose which optional additional repositories to enable'),
196 		repositories,
197 		sort=False,
198 		multi=True,
199 		preset_values=preset,
200 		allow_reset=True
201 	).run()
202 
203 	match choice.type_:
204 		case MenuSelectionType.Skip: return preset
205 		case MenuSelectionType.Reset: return []
206 		case MenuSelectionType.Selection: return choice.single_value
207 
208 	return []
209
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/archinstall/lib/interactions/general_conf.py b/archinstall/lib/interactions/general_conf.py
--- a/archinstall/lib/interactions/general_conf.py
+++ b/archinstall/lib/interactions/general_conf.py
@@ -151,10 +151,10 @@
 def add_number_of_parrallel_downloads(input_number :Optional[int] = None) -> Optional[int]:
 	max_downloads = 5
 	print(_(f"This option enables the number of parallel downloads that can occur during installation"))
-	print(_(f"Enter the number of parallel downloads to be enabled.\n (Enter a value between 1 to {max_downloads})\nNote:"))
-	print(_(f" - Maximum value   : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )"))
-	print(_(f" - Minimum value   : 1 ( Allows 1 parallel download, allows 2 downloads at a time )"))
-	print(_(f" - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )"))
+	print(str(_("Enter the number of parallel downloads to be enabled.\n (Enter a value between 1 to {})\nNote:")).format(max_downloads))
+	print(str(_(" - Maximum value   : {} ( Allows {} parallel downloads, allows {} downloads at a time )")).format(max_downloads, max_downloads, max_downloads + 1))
+	print(_(" - Minimum value   : 1 ( Allows 1 parallel download, allows 2 downloads at a time )"))
+	print(_(" - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )"))
 
 	while True:
 		try:
@@ -165,7 +165,7 @@
 				input_number = max_downloads
 			break
 		except:
-			print(_(f"Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]"))
+			print(str(_("Invalid input! Try again with a valid input [1 to {}, or 0 to disable]")).format(max_downloads))
 
 	pacman_conf_path = pathlib.Path("/etc/pacman.conf")
 	with pacman_conf_path.open() as f:

{"golden_diff": "diff --git a/archinstall/lib/interactions/general_conf.py b/archinstall/lib/interactions/general_conf.py\n--- a/archinstall/lib/interactions/general_conf.py\n+++ b/archinstall/lib/interactions/general_conf.py\n@@ -151,10 +151,10 @@\n def add_number_of_parrallel_downloads(input_number :Optional[int] = None) -> Optional[int]:\n \tmax_downloads = 5\n \tprint(_(f\"This option enables the number of parallel downloads that can occur during installation\"))\n-\tprint(_(f\"Enter the number of parallel downloads to be enabled.\\n (Enter a value between 1 to {max_downloads})\\nNote:\"))\n-\tprint(_(f\" - Maximum value   : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )\"))\n-\tprint(_(f\" - Minimum value   : 1 ( Allows 1 parallel download, allows 2 downloads at a time )\"))\n-\tprint(_(f\" - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )\"))\n+\tprint(str(_(\"Enter the number of parallel downloads to be enabled.\\n (Enter a value between 1 to {})\\nNote:\")).format(max_downloads))\n+\tprint(str(_(\" - Maximum value   : {} ( Allows {} parallel downloads, allows {} downloads at a time )\")).format(max_downloads, max_downloads, max_downloads + 1))\n+\tprint(_(\" - Minimum value   : 1 ( Allows 1 parallel download, allows 2 downloads at a time )\"))\n+\tprint(_(\" - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )\"))\n \n \twhile True:\n \t\ttry:\n@@ -165,7 +165,7 @@\n \t\t\t\tinput_number = max_downloads\n \t\t\tbreak\n \t\texcept:\n-\t\t\tprint(_(f\"Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]\"))\n+\t\t\tprint(str(_(\"Invalid input! Try again with a valid input [1 to {}, or 0 to disable]\")).format(max_downloads))\n \n \tpacman_conf_path = pathlib.Path(\"/etc/pacman.conf\")\n \twith pacman_conf_path.open() as f:\n", "issue": "The parallel downloads page is shown half in English, half in another language if a language other than English is selected\nI checked every language that has this page translated and it happens on every single one.\r\n### Example:\r\n![French-example](https://user-images.githubusercontent.com/126529524/232617481-5f4f06ac-7359-4f61-96f2-6e7cdbeda770.png)\r\n\r\n### Another one:\r\n![Russian-example](https://user-images.githubusercontent.com/126529524/232617561-9463fc23-3223-4814-af8c-586dc1638ab3.png)\r\n\r\n\n", "before_files": [{"content": "from __future__ import annotations\n\nimport pathlib\nfrom typing import List, Any, Optional, TYPE_CHECKING\n\nfrom ..locale import list_timezones, list_keyboard_languages\nfrom ..menu import MenuSelectionType, Menu, TextInput\nfrom ..output import warn\nfrom ..packages.packages import validate_package_list\nfrom ..storage import storage\nfrom ..translationhandler import Language\n\nif TYPE_CHECKING:\n\t_: Any\n\n\ndef ask_ntp(preset: bool = True) -> bool:\n\tprompt = str(_('Would you like to use automatic time synchronization (NTP) with the default time servers?\\n'))\n\tprompt += str(_('Hardware time and other post-configuration steps might be required in order for NTP to work.\\nFor more information, please check the Arch wiki'))\n\tif preset:\n\t\tpreset_val = Menu.yes()\n\telse:\n\t\tpreset_val = Menu.no()\n\tchoice = Menu(prompt, Menu.yes_no(), skip=False, preset_values=preset_val, default_option=Menu.yes()).run()\n\n\treturn False if choice.value == Menu.no() else True\n\n\ndef ask_hostname(preset: str = '') -> str:\n\twhile True:\n\t\thostname = TextInput(\n\t\t\tstr(_('Desired hostname for the installation: ')),\n\t\t\tpreset\n\t\t).run().strip()\n\n\t\tif hostname:\n\t\t\treturn hostname\n\n\ndef ask_for_a_timezone(preset: Optional[str] = None) -> Optional[str]:\n\ttimezones = list_timezones()\n\tdefault = 'UTC'\n\n\tchoice = Menu(\n\t\t_('Select a timezone'),\n\t\tlist(timezones),\n\t\tpreset_values=preset,\n\t\tdefault_option=default\n\t).run()\n\n\tmatch choice.type_:\n\t\tcase MenuSelectionType.Skip: return preset\n\t\tcase MenuSelectionType.Selection: return choice.single_value\n\n\treturn None\n\n\ndef ask_for_audio_selection(desktop: bool = True, preset: Optional[str] = None) -> Optional[str]:\n\tno_audio = str(_('No audio server'))\n\tchoices = ['pipewire', 'pulseaudio'] if desktop else ['pipewire', 'pulseaudio', no_audio]\n\tdefault = 'pipewire' if desktop else no_audio\n\n\tchoice = Menu(_('Choose an audio server'), choices, preset_values=preset, default_option=default).run()\n\n\tmatch choice.type_:\n\t\tcase MenuSelectionType.Skip: return preset\n\t\tcase MenuSelectionType.Selection: return choice.single_value\n\n\treturn None\n\n\ndef select_language(preset: Optional[str] = None) -> Optional[str]:\n\t\"\"\"\n\tAsks the user to select a language\n\tUsually this is combined with :ref:`archinstall.list_keyboard_languages`.\n\n\t:return: The language/dictionary key of the selected language\n\t:rtype: str\n\t\"\"\"\n\tkb_lang = list_keyboard_languages()\n\t# sort alphabetically and then by length\n\tsorted_kb_lang = sorted(sorted(list(kb_lang)), key=len)\n\n\tchoice = Menu(\n\t\t_('Select keyboard layout'),\n\t\tsorted_kb_lang,\n\t\tpreset_values=preset,\n\t\tsort=False\n\t).run()\n\n\tmatch choice.type_:\n\t\tcase MenuSelectionType.Skip: return preset\n\t\tcase MenuSelectionType.Selection: return choice.single_value\n\n\treturn None\n\n\ndef select_archinstall_language(languages: List[Language], preset: Language) -> Language:\n\t# these are the displayed language names which can either be\n\t# the english name of a language or, if present, the\n\t# name of the language in its own language\n\toptions = {lang.display_name: lang for lang in languages}\n\n\ttitle = 'NOTE: If a language can not displayed properly, a proper font must be set manually in the console.\\n'\n\ttitle += 'All available fonts can be found in \"/usr/share/kbd/consolefonts\"\\n'\n\ttitle += 'e.g. setfont LatGrkCyr-8x16 (to display latin/greek/cyrillic characters)\\n'\n\n\tchoice = Menu(\n\t\ttitle,\n\t\tlist(options.keys()),\n\t\tdefault_option=preset.display_name,\n\t\tpreview_size=0.5\n\t).run()\n\n\tmatch choice.type_:\n\t\tcase MenuSelectionType.Skip: return preset\n\t\tcase MenuSelectionType.Selection: return options[choice.single_value]\n\n\traise ValueError('Language selection not handled')\n\n\ndef ask_additional_packages_to_install(preset: List[str] = []) -> List[str]:\n\t# Additional packages (with some light weight error handling for invalid package names)\n\tprint(_('Only packages such as base, base-devel, linux, linux-firmware, efibootmgr and optional profile packages are installed.'))\n\tprint(_('If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.'))\n\n\tdef read_packages(p: List = []) -> list:\n\t\tdisplay = ' '.join(p)\n\t\tinput_packages = TextInput(_('Write additional packages to install (space separated, leave blank to skip): '), display).run().strip()\n\t\treturn input_packages.split() if input_packages else []\n\n\tpreset = preset if preset else []\n\tpackages = read_packages(preset)\n\n\tif not storage['arguments']['offline'] and not storage['arguments']['no_pkg_lookups']:\n\t\twhile True:\n\t\t\tif len(packages):\n\t\t\t\t# Verify packages that were given\n\t\t\t\tprint(_(\"Verifying that additional packages exist (this might take a few seconds)\"))\n\t\t\t\tvalid, invalid = validate_package_list(packages)\n\n\t\t\t\tif invalid:\n\t\t\t\t\twarn(f\"Some packages could not be found in the repository: {invalid}\")\n\t\t\t\t\tpackages = read_packages(valid)\n\t\t\t\t\tcontinue\n\t\t\tbreak\n\n\treturn packages\n\n\ndef add_number_of_parrallel_downloads(input_number :Optional[int] = None) -> Optional[int]:\n\tmax_downloads = 5\n\tprint(_(f\"This option enables the number of parallel downloads that can occur during installation\"))\n\tprint(_(f\"Enter the number of parallel downloads to be enabled.\\n (Enter a value between 1 to {max_downloads})\\nNote:\"))\n\tprint(_(f\" - Maximum value   : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )\"))\n\tprint(_(f\" - Minimum value   : 1 ( Allows 1 parallel download, allows 2 downloads at a time )\"))\n\tprint(_(f\" - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )\"))\n\n\twhile True:\n\t\ttry:\n\t\t\tinput_number = int(TextInput(_(\"[Default value: 0] > \")).run().strip() or 0)\n\t\t\tif input_number <= 0:\n\t\t\t\tinput_number = 0\n\t\t\telif input_number > max_downloads:\n\t\t\t\tinput_number = max_downloads\n\t\t\tbreak\n\t\texcept:\n\t\t\tprint(_(f\"Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]\"))\n\n\tpacman_conf_path = pathlib.Path(\"/etc/pacman.conf\")\n\twith pacman_conf_path.open() as f:\n\t\tpacman_conf = f.read().split(\"\\n\")\n\n\twith pacman_conf_path.open(\"w\") as fwrite:\n\t\tfor line in pacman_conf:\n\t\t\tif \"ParallelDownloads\" in line:\n\t\t\t\tfwrite.write(f\"ParallelDownloads = {input_number+1}\\n\") if not input_number == 0 else fwrite.write(\"#ParallelDownloads = 0\\n\")\n\t\t\telse:\n\t\t\t\tfwrite.write(f\"{line}\\n\")\n\n\treturn input_number\n\n\ndef select_additional_repositories(preset: List[str]) -> List[str]:\n\t\"\"\"\n\tAllows the user to select additional repositories (multilib, and testing) if desired.\n\n\t:return: The string as a selected repository\n\t:rtype: string\n\t\"\"\"\n\n\trepositories = [\"multilib\", \"testing\"]\n\n\tchoice = Menu(\n\t\t_('Choose which optional additional repositories to enable'),\n\t\trepositories,\n\t\tsort=False,\n\t\tmulti=True,\n\t\tpreset_values=preset,\n\t\tallow_reset=True\n\t).run()\n\n\tmatch choice.type_:\n\t\tcase MenuSelectionType.Skip: return preset\n\t\tcase MenuSelectionType.Reset: return []\n\t\tcase MenuSelectionType.Selection: return choice.single_value\n\n\treturn []\n", "path": "archinstall/lib/interactions/general_conf.py"}], "after_files": [{"content": "from __future__ import annotations\n\nimport pathlib\nfrom typing import List, Any, Optional, TYPE_CHECKING\n\nfrom ..locale import list_timezones, list_keyboard_languages\nfrom ..menu import MenuSelectionType, Menu, TextInput\nfrom ..output import warn\nfrom ..packages.packages import validate_package_list\nfrom ..storage import storage\nfrom ..translationhandler import Language\n\nif TYPE_CHECKING:\n\t_: Any\n\n\ndef ask_ntp(preset: bool = True) -> bool:\n\tprompt = str(_('Would you like to use automatic time synchronization (NTP) with the default time servers?\\n'))\n\tprompt += str(_('Hardware time and other post-configuration steps might be required in order for NTP to work.\\nFor more information, please check the Arch wiki'))\n\tif preset:\n\t\tpreset_val = Menu.yes()\n\telse:\n\t\tpreset_val = Menu.no()\n\tchoice = Menu(prompt, Menu.yes_no(), skip=False, preset_values=preset_val, default_option=Menu.yes()).run()\n\n\treturn False if choice.value == Menu.no() else True\n\n\ndef ask_hostname(preset: str = '') -> str:\n\twhile True:\n\t\thostname = TextInput(\n\t\t\tstr(_('Desired hostname for the installation: ')),\n\t\t\tpreset\n\t\t).run().strip()\n\n\t\tif hostname:\n\t\t\treturn hostname\n\n\ndef ask_for_a_timezone(preset: Optional[str] = None) -> Optional[str]:\n\ttimezones = list_timezones()\n\tdefault = 'UTC'\n\n\tchoice = Menu(\n\t\t_('Select a timezone'),\n\t\tlist(timezones),\n\t\tpreset_values=preset,\n\t\tdefault_option=default\n\t).run()\n\n\tmatch choice.type_:\n\t\tcase MenuSelectionType.Skip: return preset\n\t\tcase MenuSelectionType.Selection: return choice.single_value\n\n\treturn None\n\n\ndef ask_for_audio_selection(desktop: bool = True, preset: Optional[str] = None) -> Optional[str]:\n\tno_audio = str(_('No audio server'))\n\tchoices = ['pipewire', 'pulseaudio'] if desktop else ['pipewire', 'pulseaudio', no_audio]\n\tdefault = 'pipewire' if desktop else no_audio\n\n\tchoice = Menu(_('Choose an audio server'), choices, preset_values=preset, default_option=default).run()\n\n\tmatch choice.type_:\n\t\tcase MenuSelectionType.Skip: return preset\n\t\tcase MenuSelectionType.Selection: return choice.single_value\n\n\treturn None\n\n\ndef select_language(preset: Optional[str] = None) -> Optional[str]:\n\t\"\"\"\n\tAsks the user to select a language\n\tUsually this is combined with :ref:`archinstall.list_keyboard_languages`.\n\n\t:return: The language/dictionary key of the selected language\n\t:rtype: str\n\t\"\"\"\n\tkb_lang = list_keyboard_languages()\n\t# sort alphabetically and then by length\n\tsorted_kb_lang = sorted(sorted(list(kb_lang)), key=len)\n\n\tchoice = Menu(\n\t\t_('Select keyboard layout'),\n\t\tsorted_kb_lang,\n\t\tpreset_values=preset,\n\t\tsort=False\n\t).run()\n\n\tmatch choice.type_:\n\t\tcase MenuSelectionType.Skip: return preset\n\t\tcase MenuSelectionType.Selection: return choice.single_value\n\n\treturn None\n\n\ndef select_archinstall_language(languages: List[Language], preset: Language) -> Language:\n\t# these are the displayed language names which can either be\n\t# the english name of a language or, if present, the\n\t# name of the language in its own language\n\toptions = {lang.display_name: lang for lang in languages}\n\n\ttitle = 'NOTE: If a language can not displayed properly, a proper font must be set manually in the console.\\n'\n\ttitle += 'All available fonts can be found in \"/usr/share/kbd/consolefonts\"\\n'\n\ttitle += 'e.g. setfont LatGrkCyr-8x16 (to display latin/greek/cyrillic characters)\\n'\n\n\tchoice = Menu(\n\t\ttitle,\n\t\tlist(options.keys()),\n\t\tdefault_option=preset.display_name,\n\t\tpreview_size=0.5\n\t).run()\n\n\tmatch choice.type_:\n\t\tcase MenuSelectionType.Skip: return preset\n\t\tcase MenuSelectionType.Selection: return options[choice.single_value]\n\n\traise ValueError('Language selection not handled')\n\n\ndef ask_additional_packages_to_install(preset: List[str] = []) -> List[str]:\n\t# Additional packages (with some light weight error handling for invalid package names)\n\tprint(_('Only packages such as base, base-devel, linux, linux-firmware, efibootmgr and optional profile packages are installed.'))\n\tprint(_('If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.'))\n\n\tdef read_packages(p: List = []) -> list:\n\t\tdisplay = ' '.join(p)\n\t\tinput_packages = TextInput(_('Write additional packages to install (space separated, leave blank to skip): '), display).run().strip()\n\t\treturn input_packages.split() if input_packages else []\n\n\tpreset = preset if preset else []\n\tpackages = read_packages(preset)\n\n\tif not storage['arguments']['offline'] and not storage['arguments']['no_pkg_lookups']:\n\t\twhile True:\n\t\t\tif len(packages):\n\t\t\t\t# Verify packages that were given\n\t\t\t\tprint(_(\"Verifying that additional packages exist (this might take a few seconds)\"))\n\t\t\t\tvalid, invalid = validate_package_list(packages)\n\n\t\t\t\tif invalid:\n\t\t\t\t\twarn(f\"Some packages could not be found in the repository: {invalid}\")\n\t\t\t\t\tpackages = read_packages(valid)\n\t\t\t\t\tcontinue\n\t\t\tbreak\n\n\treturn packages\n\n\ndef add_number_of_parrallel_downloads(input_number :Optional[int] = None) -> Optional[int]:\n\tmax_downloads = 5\n\tprint(_(f\"This option enables the number of parallel downloads that can occur during installation\"))\n\tprint(str(_(\"Enter the number of parallel downloads to be enabled.\\n (Enter a value between 1 to {})\\nNote:\")).format(max_downloads))\n\tprint(str(_(\" - Maximum value   : {} ( Allows {} parallel downloads, allows {} downloads at a time )\")).format(max_downloads, max_downloads, max_downloads + 1))\n\tprint(_(\" - Minimum value   : 1 ( Allows 1 parallel download, allows 2 downloads at a time )\"))\n\tprint(_(\" - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )\"))\n\n\twhile True:\n\t\ttry:\n\t\t\tinput_number = int(TextInput(_(\"[Default value: 0] > \")).run().strip() or 0)\n\t\t\tif input_number <= 0:\n\t\t\t\tinput_number = 0\n\t\t\telif input_number > max_downloads:\n\t\t\t\tinput_number = max_downloads\n\t\t\tbreak\n\t\texcept:\n\t\t\tprint(str(_(\"Invalid input! Try again with a valid input [1 to {}, or 0 to disable]\")).format(max_downloads))\n\n\tpacman_conf_path = pathlib.Path(\"/etc/pacman.conf\")\n\twith pacman_conf_path.open() as f:\n\t\tpacman_conf = f.read().split(\"\\n\")\n\n\twith pacman_conf_path.open(\"w\") as fwrite:\n\t\tfor line in pacman_conf:\n\t\t\tif \"ParallelDownloads\" in line:\n\t\t\t\tfwrite.write(f\"ParallelDownloads = {input_number+1}\\n\") if not input_number == 0 else fwrite.write(\"#ParallelDownloads = 0\\n\")\n\t\t\telse:\n\t\t\t\tfwrite.write(f\"{line}\\n\")\n\n\treturn input_number\n\n\ndef select_additional_repositories(preset: List[str]) -> List[str]:\n\t\"\"\"\n\tAllows the user to select additional repositories (multilib, and testing) if desired.\n\n\t:return: The string as a selected repository\n\t:rtype: string\n\t\"\"\"\n\n\trepositories = [\"multilib\", \"testing\"]\n\n\tchoice = Menu(\n\t\t_('Choose which optional additional repositories to enable'),\n\t\trepositories,\n\t\tsort=False,\n\t\tmulti=True,\n\t\tpreset_values=preset,\n\t\tallow_reset=True\n\t).run()\n\n\tmatch choice.type_:\n\t\tcase MenuSelectionType.Skip: return preset\n\t\tcase MenuSelectionType.Reset: return []\n\t\tcase MenuSelectionType.Selection: return choice.single_value\n\n\treturn []\n", "path": "archinstall/lib/interactions/general_conf.py"}]}