Skip to content

Commit

Permalink
Simplify translation call in f-string
Browse files Browse the repository at this point in the history
  • Loading branch information
svartkanin committed Nov 16, 2024
1 parent a71fe41 commit 03f4ed7
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion archinstall/lib/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def write_debug(self) -> None:
debug(self.user_config_to_json())

def confirm_config(self) -> bool:
header = f'{str(_("The specified configuration will be applied"))}. '
header = f'{_("The specified configuration will be applied")}. '
header += str(_('Would you like to continue?')) + '\n'

with Tui():
Expand Down
6 changes: 3 additions & 3 deletions archinstall/lib/disk/encryption_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def _prev_type(self) -> Optional[str]:

if enc_type:
enc_text = EncryptionType.type_to_text(enc_type)
return f'{str(_("Encryption type"))}: {enc_text}'
return f'{_("Encryption type")}: {enc_text}'

return None

Expand All @@ -176,7 +176,7 @@ def _prev_password(self) -> Optional[str]:

if enc_pwd:
pwd_text = '*' * len(enc_pwd)
return f'{str(_("Encryption password"))}: {pwd_text}'
return f'{_("Encryption password")}: {pwd_text}'

return None

Expand Down Expand Up @@ -208,7 +208,7 @@ def _prev_hsm(self) -> Optional[str]:

output = str(fido_device.path)
output += f' ({fido_device.manufacturer}, {fido_device.product})'
return f'{str(_("HSM device"))}: {output}'
return f'{_("HSM device")}: {output}'


def select_encryption_type(disk_config: DiskLayoutConfiguration, preset: EncryptionType) -> Optional[EncryptionType]:
Expand Down
20 changes: 10 additions & 10 deletions archinstall/lib/global_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,17 +318,17 @@ def _prev_additional_pkgs(self, item: MenuItem) -> Optional[str]:
def _prev_additional_repos(self, item: MenuItem) -> Optional[str]:
if item.value:
repos = ', '.join(item.value)
return f'{str(_("Additional repositories"))}: {repos}'
return f'{_("Additional repositories")}: {repos}'
return None

def _prev_tz(self, item: MenuItem) -> Optional[str]:
if item.value:
return f'{str(_("Timezone"))}: {item.value}'
return f'{_("Timezone")}: {item.value}'
return None

def _prev_ntp(self, item: MenuItem) -> Optional[str]:
if item.value is not None:
output = f'{str(_("NTP"))}: '
output = f'{_("NTP")}: '
output += str(_('Enabled')) if item.value else str(_('Disabled'))
return output
return None
Expand All @@ -351,7 +351,7 @@ def _prev_disk_config(self, item: MenuItem) -> Optional[str]:

def _prev_swap(self, item: MenuItem) -> Optional[str]:
if item.value is not None:
output = f'{str(_("Swap on zram"))}: '
output = f'{_("Swap on zram")}: '
output += str(_('Enabled')) if item.value else str(_('Disabled'))
return output
return None
Expand All @@ -365,34 +365,34 @@ def _prev_uki(self, item: MenuItem) -> Optional[str]:

def _prev_hostname(self, item: MenuItem) -> Optional[str]:
if item.value is not None:
return f'{str(_("Hostname"))}: {item.value}'
return f'{_("Hostname")}: {item.value}'
return None

def _prev_root_pwd(self, item: MenuItem) -> Optional[str]:
if item.value is not None:
return f'{str(_("Root password"))}: {secret(item.value)}'
return f'{_("Root password")}: {secret(item.value)}'
return None

def _prev_audio(self, item: MenuItem) -> Optional[str]:
if item.value is not None:
config: AudioConfiguration = item.value
return f'{str(_("Audio"))}: {config.audio.value}'
return f'{_("Audio")}: {config.audio.value}'
return None

def _prev_parallel_dw(self, item: MenuItem) -> Optional[str]:
if item.value is not None:
return f'{str(_("Parallel Downloads"))}: {item.value}'
return f'{_("Parallel Downloads")}: {item.value}'
return None

def _prev_kernel(self, item: MenuItem) -> Optional[str]:
if item.value:
kernel = ', '.join(item.value)
return f'{str(_("Kernel"))}: {kernel}'
return f'{_("Kernel")}: {kernel}'
return None

def _prev_bootloader(self, item: MenuItem) -> Optional[str]:
if item.value is not None:
return f'{str(_("Bootloader"))}: {item.value.value}'
return f'{_("Bootloader")}: {item.value.value}'
return None

def _prev_disk_encryption(self, item: MenuItem) -> Optional[str]:
Expand Down
2 changes: 1 addition & 1 deletion archinstall/lib/interactions/general_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def validator(value: str) -> Optional[str]:
valid, invalid = validate_package_list(packages)

if invalid:
return f'{str(_("Some packages could not be found in the repository"))}: {invalid}'
return f'{_("Some packages could not be found in the repository")}: {invalid}'

return None

Expand Down
6 changes: 3 additions & 3 deletions archinstall/lib/interactions/manage_users_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def handle_action(self, action: str, entry: Optional[User], data: list[User]) ->
data = [d for d in data if d.username != new_user.username]
data += [new_user]
elif action == self._actions[1] and entry: # change password
header = f'{str(_("User"))}: {entry.username}\n'
header = f'{_("User")}: {entry.username}\n'
new_password = get_password(str(_('Password')), header=header)

if new_password:
Expand Down Expand Up @@ -74,14 +74,14 @@ def _add_user(self) -> Optional[User]:
case _:
raise ValueError('Unhandled result type')

header = f'{str(_("Username"))}: {username}\n'
header = f'{_("Username")}: {username}\n'

password = get_password(str(_('Password')), header=header, allow_skip=True)

if not password:
return None

header += f'{str(_("Password"))}: {secret(password)}\n\n'
header += f'{_("Password")}: {secret(password)}\n\n'
header += str(_('Should "{}" be a superuser (sudo)?\n')).format(username)

group = MenuItemGroup.yes_no()
Expand Down
6 changes: 3 additions & 3 deletions archinstall/lib/mirrors.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def _add_custom_mirror(self, preset: Optional[CustomMirror] = None) -> Optional[
case _:
raise ValueError('Unhandled return type')

header = f'{str(_("Name"))}: {name}'
header = f'{_("Name")}: {name}'

edit_result = EditMenu(
str(_('Url')),
Expand All @@ -195,7 +195,7 @@ def _add_custom_mirror(self, preset: Optional[CustomMirror] = None) -> Optional[
case _:
raise ValueError('Unhandled return type')

header += f'\n{str(_("Url"))}: {url}\n'
header += f'\n{_("Url")}: {url}\n'
prompt = f'{header}\n' + str(_('Select signature check'))

sign_chk_items = [MenuItem(s.value, value=s.value) for s in SignCheck]
Expand All @@ -217,7 +217,7 @@ def _add_custom_mirror(self, preset: Optional[CustomMirror] = None) -> Optional[
case _:
raise ValueError('Unhandled return type')

header += f'{str(_("Signature check"))}: {sign_check.value}\n'
header += f'{_("Signature check")}: {sign_check.value}\n'
prompt = f'{header}\n' + 'Select signature option'

sign_opt_items = [MenuItem(s.value, value=s.value) for s in SignOption]
Expand Down
2 changes: 1 addition & 1 deletion archinstall/lib/profile/profile_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def _prev_gfx(self, item: MenuItem) -> Optional[str]:

def _prev_greeter(self, item: MenuItem) -> Optional[str]:
if item.value:
return f'{str(_("Greeter"))}: {item.value.value}'
return f'{_("Greeter")}: {item.value.value}'
return None

def _preview_profile(self, item: MenuItem) -> Optional[str]:
Expand Down
4 changes: 2 additions & 2 deletions archinstall/lib/utils/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def get_password(
hidden = secret(password)

if header is not None:
confirmation_header = f'{header}{str(_("Pssword"))}: {hidden}\n'
confirmation_header = f'{header}{_("Pssword")}: {hidden}\n'
else:
confirmation_header = f'{str(_("Password"))}: {hidden}\n'
confirmation_header = f'{_("Password")}: {hidden}\n'

result = EditMenu(
str(_('Confirm password')),
Expand Down

0 comments on commit 03f4ed7

Please sign in to comment.