Skip to content

Commit 01c9432

Browse files
authored
Use sentence case for summary labels (#4617)
str.title() title-cased every label word, which is wrong outside English: it turned the Ukrainian "Ім'я хоста" into "Ім'Я Хоста" and broke acronyms ("NTP" -> "Ntp"). The source strings and their translations are already written with the correct casing. Capitalize only the first letter of each label instead.
1 parent 53158a8 commit 01c9432

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

archinstall/lib/utils/format.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
from _typeshed import DataclassInstance
1010

1111

12+
def _sentence_case(text: str) -> str:
13+
# Only capitalize the first letter of the label. The source strings and
14+
# their translations are already written with the correct casing for each
15+
# language, so title-casing every word is wrong outside English (it turned
16+
# "Ім'я хоста" into "Ім'Я Хоста" and "(NTP)" into "(Ntp)").
17+
return text[:1].upper() + text[1:]
18+
19+
1220
def as_key_value_pair(
1321
entries: dict[str, str | list[str] | bool],
1422
ignore_empty: bool = True,
@@ -33,7 +41,7 @@ def as_key_value_pair(
3341
if isinstance(value, list):
3442
value = '\n '.join(str(val) for val in value)
3543

36-
table.add_row(label.title(), f': {value}')
44+
table.add_row(_sentence_case(label), f': {value}')
3745

3846
return table.stringify()
3947

0 commit comments

Comments
 (0)