Fix fstrings in translations

This commit is contained in:
kramo
2023-03-31 15:44:52 +02:00
parent 89afe23535
commit 3e568be6d8
5 changed files with 17 additions and 16 deletions

View File

@@ -198,7 +198,7 @@ class CartridgesApplication(Adw.Application):
title = self.win.games[game_id].name
# The variable is the title of the game
toast = Adw.Toast.new(_(f"{title} removed"))
toast = Adw.Toast.new(_("{} removed").format(title))
toast.set_button_label(_("Undo"))
toast.connect("button-clicked", self.win.on_undo_remove_action, game_id)
toast.set_priority(Adw.ToastPriority.HIGH)

View File

@@ -54,9 +54,10 @@ class ImportPreferences:
window.parent_widget,
_("Installation Not Found"),
# The variable is the name of the game launcher
_(f"Select the {name} configuration directory.") if config
_("Select the {} configuration directory.").format(name)
if config
# The variable is the name of the game launcher
else _(f"Select the {name} data directory."),
else _("Select the {} data directory.").format(name),
"choose_folder",
_("Set Location"),
).connect("response", response)

View File

@@ -115,21 +115,21 @@ def create_details_window(parent_widget, game_id=None):
if os.name == "nt":
exe_name += ".exe"
# Translate this string as you would translate "path to {exe_name}"
exe_path = _(f"C:\\path\\to\\{exe_name}")
# Translate this string as you would translate "path to {file_name}"
file_path = _(f"C:\\path\\to\\{file_name}")
# Translate this string as you would translate "path to {}"
exe_path = _("C:\\path\\to\\{}").format(exe_name)
# Translate this string as you would translate "path to {}"
file_path = _("C:\\path\\to\\{}").format(file_name)
command = "start"
else:
# Translate this string as you would translate "path to {exe_name}"
exe_path = _(f"/path/to/{exe_name}")
# Translate this string as you would translate "path to {file_name}"
file_path = _(f"/path/to/{file_name}")
# Translate this string as you would translate "path to {}"
exe_path = _("/path/to/{}").format(exe_name)
# Translate this string as you would translate "path to {}"
file_path = _("/path/to/{}").format(file_name)
command = "xdg-open"
exec_info_text = _(
f'To launch the executable "{exe_name}", use the command:\n\n<tt>"{exe_path}"</tt>\n\nTo open the file "{file_name}" with the default application, use:\n\n<tt>{command} "{file_path}"</tt>\n\nIf the path contains spaces, make sure to wrap it in double quotes!'
)
'To launch the executable "{}", use the command:\n\n<tt>"{}"</tt>\n\nTo open the file "{}" with the default application, use:\n\n<tt>{} "{}"</tt>\n\nIf the path contains spaces, make sure to wrap it in double quotes!'
).format(exe_name, exe_path, file_name, command, file_path)
exec_info_label = Gtk.Label(
label=exec_info_text,

View File

@@ -93,5 +93,5 @@ class Importer:
self.parent_widget,
_("Games Imported"),
# The variable is the number of games
_(f"Successfully imported {games_no} games."),
_("Successfully imported {} games.").format(games_no),
)

View File

@@ -267,7 +267,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
date = self.get_time(current_game.added)
self.overview_added.set_label(
# The variable is the date when the game was added
_(f"Added: {date}")
_("Added: {}").format(date)
)
last_played_date = (
self.get_time(current_game.last_played)
@@ -276,7 +276,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
)
self.overview_last_played.set_label(
# The variable is the date when the game was last played
_(f"Last played: {last_played_date}")
_("Last played: {}").format(last_played_date)
)
def a_z_sort(self, child1, child2):