We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
locale language only en_US
archlinux-2023.09.01-x86_64.iso

--- 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/locale/locale.py`
Content:
```
1 from typing import Iterator, List
2 
3 from ..exceptions import ServiceException, SysCallError
4 from ..general import SysCommand
5 from ..output import error
6 
7 
8 def list_keyboard_languages() -> Iterator[str]:
9 	for line in SysCommand("localectl --no-pager list-keymaps", environment_vars={'SYSTEMD_COLORS': '0'}):
10 		yield line.decode('UTF-8').strip()
11 
12 
13 def list_locales() -> List[str]:
14 	with open('/etc/locale.gen', 'r') as fp:
15 		locales = []
16 		# before the list of locales begins there's an empty line with a '#' in front
17 		# so we'll collect the localels from bottom up and halt when we're donw
18 		entries = fp.readlines()
19 		entries.reverse()
20 
21 		for entry in entries:
22 			text = entry.replace('#', '').strip()
23 			if text == '':
24 				break
25 			locales.append(text)
26 
27 		locales.reverse()
28 		return locales
29 
30 
31 def list_x11_keyboard_languages() -> Iterator[str]:
32 	for line in SysCommand("localectl --no-pager list-x11-keymap-layouts", environment_vars={'SYSTEMD_COLORS': '0'}):
33 		yield line.decode('UTF-8').strip()
34 
35 
36 def verify_keyboard_layout(layout :str) -> bool:
37 	for language in list_keyboard_languages():
38 		if layout.lower() == language.lower():
39 			return True
40 	return False
41 
42 
43 def verify_x11_keyboard_layout(layout :str) -> bool:
44 	for language in list_x11_keyboard_languages():
45 		if layout.lower() == language.lower():
46 			return True
47 	return False
48 
49 
50 def set_kb_layout(locale :str) -> bool:
51 	if len(locale.strip()):
52 		if not verify_keyboard_layout(locale):
53 			error(f"Invalid keyboard locale specified: {locale}")
54 			return False
55 
56 		try:
57 			SysCommand(f'localectl set-keymap {locale}')
58 		except SysCallError as err:
59 			raise ServiceException(f"Unable to set locale '{locale}' for console: {err}")
60 
61 		return True
62 
63 	return False
64 
65 
66 def list_timezones() -> Iterator[str]:
67 	for line in SysCommand("timedatectl --no-pager list-timezones", environment_vars={'SYSTEMD_COLORS': '0'}):
68 		yield line.decode('UTF-8').strip()
69
```
--- 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/locale/locale.py b/archinstall/lib/locale/locale.py
--- a/archinstall/lib/locale/locale.py
+++ b/archinstall/lib/locale/locale.py
@@ -11,21 +11,14 @@
 
 
 def list_locales() -> List[str]:
-	with open('/etc/locale.gen', 'r') as fp:
-		locales = []
-		# before the list of locales begins there's an empty line with a '#' in front
-		# so we'll collect the localels from bottom up and halt when we're donw
-		entries = fp.readlines()
-		entries.reverse()
-
-		for entry in entries:
-			text = entry.replace('#', '').strip()
-			if text == '':
-				break
-			locales.append(text)
-
-		locales.reverse()
-		return locales
+	locales = []
+
+	with open('/usr/share/i18n/SUPPORTED') as file:
+		for line in file:
+			if line != 'C.UTF-8 UTF-8\n':
+				locales.append(line.rstrip())
+
+	return locales
 
 
 def list_x11_keyboard_languages() -> Iterator[str]:

{"golden_diff": "diff --git a/archinstall/lib/locale/locale.py b/archinstall/lib/locale/locale.py\n--- a/archinstall/lib/locale/locale.py\n+++ b/archinstall/lib/locale/locale.py\n@@ -11,21 +11,14 @@\n \n \n def list_locales() -> List[str]:\n-\twith open('/etc/locale.gen', 'r') as fp:\n-\t\tlocales = []\n-\t\t# before the list of locales begins there's an empty line with a '#' in front\n-\t\t# so we'll collect the localels from bottom up and halt when we're donw\n-\t\tentries = fp.readlines()\n-\t\tentries.reverse()\n-\n-\t\tfor entry in entries:\n-\t\t\ttext = entry.replace('#', '').strip()\n-\t\t\tif text == '':\n-\t\t\t\tbreak\n-\t\t\tlocales.append(text)\n-\n-\t\tlocales.reverse()\n-\t\treturn locales\n+\tlocales = []\n+\n+\twith open('/usr/share/i18n/SUPPORTED') as file:\n+\t\tfor line in file:\n+\t\t\tif line != 'C.UTF-8 UTF-8\\n':\n+\t\t\t\tlocales.append(line.rstrip())\n+\n+\treturn locales\n \n \n def list_x11_keyboard_languages() -> Iterator[str]:\n", "issue": "locale language only en_US\narchlinux-2023.09.01-x86_64.iso\n", "before_files": [{"content": "from typing import Iterator, List\n\nfrom ..exceptions import ServiceException, SysCallError\nfrom ..general import SysCommand\nfrom ..output import error\n\n\ndef list_keyboard_languages() -> Iterator[str]:\n\tfor line in SysCommand(\"localectl --no-pager list-keymaps\", environment_vars={'SYSTEMD_COLORS': '0'}):\n\t\tyield line.decode('UTF-8').strip()\n\n\ndef list_locales() -> List[str]:\n\twith open('/etc/locale.gen', 'r') as fp:\n\t\tlocales = []\n\t\t# before the list of locales begins there's an empty line with a '#' in front\n\t\t# so we'll collect the localels from bottom up and halt when we're donw\n\t\tentries = fp.readlines()\n\t\tentries.reverse()\n\n\t\tfor entry in entries:\n\t\t\ttext = entry.replace('#', '').strip()\n\t\t\tif text == '':\n\t\t\t\tbreak\n\t\t\tlocales.append(text)\n\n\t\tlocales.reverse()\n\t\treturn locales\n\n\ndef list_x11_keyboard_languages() -> Iterator[str]:\n\tfor line in SysCommand(\"localectl --no-pager list-x11-keymap-layouts\", environment_vars={'SYSTEMD_COLORS': '0'}):\n\t\tyield line.decode('UTF-8').strip()\n\n\ndef verify_keyboard_layout(layout :str) -> bool:\n\tfor language in list_keyboard_languages():\n\t\tif layout.lower() == language.lower():\n\t\t\treturn True\n\treturn False\n\n\ndef verify_x11_keyboard_layout(layout :str) -> bool:\n\tfor language in list_x11_keyboard_languages():\n\t\tif layout.lower() == language.lower():\n\t\t\treturn True\n\treturn False\n\n\ndef set_kb_layout(locale :str) -> bool:\n\tif len(locale.strip()):\n\t\tif not verify_keyboard_layout(locale):\n\t\t\terror(f\"Invalid keyboard locale specified: {locale}\")\n\t\t\treturn False\n\n\t\ttry:\n\t\t\tSysCommand(f'localectl set-keymap {locale}')\n\t\texcept SysCallError as err:\n\t\t\traise ServiceException(f\"Unable to set locale '{locale}' for console: {err}\")\n\n\t\treturn True\n\n\treturn False\n\n\ndef list_timezones() -> Iterator[str]:\n\tfor line in SysCommand(\"timedatectl --no-pager list-timezones\", environment_vars={'SYSTEMD_COLORS': '0'}):\n\t\tyield line.decode('UTF-8').strip()\n", "path": "archinstall/lib/locale/locale.py"}], "after_files": [{"content": "from typing import Iterator, List\n\nfrom ..exceptions import ServiceException, SysCallError\nfrom ..general import SysCommand\nfrom ..output import error\n\n\ndef list_keyboard_languages() -> Iterator[str]:\n\tfor line in SysCommand(\"localectl --no-pager list-keymaps\", environment_vars={'SYSTEMD_COLORS': '0'}):\n\t\tyield line.decode('UTF-8').strip()\n\n\ndef list_locales() -> List[str]:\n\tlocales = []\n\n\twith open('/usr/share/i18n/SUPPORTED') as file:\n\t\tfor line in file:\n\t\t\tif line != 'C.UTF-8 UTF-8\\n':\n\t\t\t\tlocales.append(line.rstrip())\n\n\treturn locales\n\n\ndef list_x11_keyboard_languages() -> Iterator[str]:\n\tfor line in SysCommand(\"localectl --no-pager list-x11-keymap-layouts\", environment_vars={'SYSTEMD_COLORS': '0'}):\n\t\tyield line.decode('UTF-8').strip()\n\n\ndef verify_keyboard_layout(layout :str) -> bool:\n\tfor language in list_keyboard_languages():\n\t\tif layout.lower() == language.lower():\n\t\t\treturn True\n\treturn False\n\n\ndef verify_x11_keyboard_layout(layout :str) -> bool:\n\tfor language in list_x11_keyboard_languages():\n\t\tif layout.lower() == language.lower():\n\t\t\treturn True\n\treturn False\n\n\ndef set_kb_layout(locale :str) -> bool:\n\tif len(locale.strip()):\n\t\tif not verify_keyboard_layout(locale):\n\t\t\terror(f\"Invalid keyboard locale specified: {locale}\")\n\t\t\treturn False\n\n\t\ttry:\n\t\t\tSysCommand(f'localectl set-keymap {locale}')\n\t\texcept SysCallError as err:\n\t\t\traise ServiceException(f\"Unable to set locale '{locale}' for console: {err}\")\n\n\t\treturn True\n\n\treturn False\n\n\ndef list_timezones() -> Iterator[str]:\n\tfor line in SysCommand(\"timedatectl --no-pager list-timezones\", environment_vars={'SYSTEMD_COLORS': '0'}):\n\t\tyield line.decode('UTF-8').strip()\n", "path": "archinstall/lib/locale/locale.py"}]}