Skip to content

Commit 0a82762

Browse files
committed
refactor: rename "translate_formatted" to "format"
1 parent 4e6a8d4 commit 0a82762

18 files changed

+40
-62
lines changed

tagstudio/src/qt/modals/about.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, config_path):
4444
if ff_version["ffprobe"] is not None:
4545
ffprobe = '<span style="color:green">Found</span> (' + ff_version["ffprobe"] + ")"
4646
self.content_widget = QLabel(
47-
Translations.translate_formatted(
47+
Translations.format(
4848
"about.content",
4949
version=VERSION,
5050
branch=VERSION_BRANCH,

tagstudio/src/qt/modals/delete_unlinked.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, driver: "QtDriver", tracker: MissingRegistry):
3232
self.root_layout.setContentsMargins(6, 6, 6, 6)
3333

3434
self.desc_widget = QLabel(
35-
Translations.translate_formatted(
35+
Translations.format(
3636
"entries.unlinked.delete.confirm",
3737
count=self.tracker.missing_file_entries_count,
3838
)
@@ -66,7 +66,7 @@ def __init__(self, driver: "QtDriver", tracker: MissingRegistry):
6666

6767
def refresh_list(self):
6868
self.desc_widget.setText(
69-
Translations.translate_formatted(
69+
Translations.format(
7070
"entries.unlinked.delete.confirm", count=self.tracker.missing_file_entries_count
7171
)
7272
)

tagstudio/src/qt/modals/drop_import.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def ask_duplicates_choice(self):
131131
self.desc_widget.setText(
132132
Translations["drop_import.duplicates_choice.singular"]
133133
if len(self.duplicate_files) == 1
134-
else Translations.translate_formatted(
134+
else Translations.format(
135135
"drop_import.duplicates_choice.plural", count=len(self.duplicate_files)
136136
)
137137
)
@@ -154,7 +154,7 @@ def begin_transfer(self, choice: DuplicateChoice | None = None):
154154
return
155155

156156
def displayed_text(x):
157-
return Translations.translate_formatted(
157+
return Translations.format(
158158
"drop_import.progress.label.singular"
159159
if x[0] + 1 == 1
160160
else "drop_import.progress.label.plural",

tagstudio/src/qt/modals/fix_dupes.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,10 @@ def set_dupe_count(self, count: int):
114114
self.dupe_count.setText(Translations["file.duplicates.matches_uninitialized"])
115115
elif count == 0:
116116
self.mirror_button.setDisabled(True)
117-
self.dupe_count.setText(
118-
Translations.translate_formatted("file.duplicates.matches", count=count)
119-
)
117+
self.dupe_count.setText(Translations.format("file.duplicates.matches", count=count))
120118
else:
121119
self.mirror_button.setDisabled(False)
122-
self.dupe_count.setText(
123-
Translations.translate_formatted("file.duplicates.matches", count=count)
124-
)
120+
self.dupe_count.setText(Translations.format("file.duplicates.matches", count=count))
125121

126122
@override
127123
def keyPressEvent(self, event: QtGui.QKeyEvent) -> None: # noqa N802

tagstudio/src/qt/modals/fix_unlinked.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,7 @@ def set_missing_count(self, count: int | None = None):
135135
self.search_button.setDisabled(self.missing_count == 0)
136136
self.delete_button.setDisabled(self.missing_count == 0)
137137
self.missing_count_label.setText(
138-
Translations.translate_formatted(
139-
"entries.unlinked.missing_count.some", count=self.missing_count
140-
)
138+
Translations.format("entries.unlinked.missing_count.some", count=self.missing_count)
141139
)
142140

143141
@override

tagstudio/src/qt/modals/mirror_entities.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ def __init__(self, driver: "QtDriver", tracker: DupeRegistry):
3232
self.tracker = tracker
3333

3434
self.desc_widget = QLabel(
35-
Translations.translate_formatted(
36-
"entries.mirror.confirmation", count=self.tracker.groups_count
37-
)
35+
Translations.format("entries.mirror.confirmation", count=self.tracker.groups_count)
3836
)
3937
self.desc_widget.setObjectName("descriptionLabel")
4038
self.desc_widget.setWordWrap(True)
@@ -65,9 +63,7 @@ def __init__(self, driver: "QtDriver", tracker: DupeRegistry):
6563

6664
def refresh_list(self):
6765
self.desc_widget.setText(
68-
Translations.translate_formatted(
69-
"entries.mirror.confirmation", count=self.tracker.groups_count
70-
)
66+
Translations.format("entries.mirror.confirmation", count=self.tracker.groups_count)
7167
)
7268

7369
self.model.clear()
@@ -76,7 +72,7 @@ def refresh_list(self):
7672

7773
def mirror_entries(self):
7874
def displayed_text(x):
79-
return Translations.translate_formatted(
75+
return Translations.format(
8076
"entries.mirror.label", idx=x + 1, count=self.tracker.groups_count
8177
)
8278

tagstudio/src/qt/modals/relink_unlinked.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, tracker: MissingRegistry):
1818

1919
def repair_entries(self):
2020
def displayed_text(x):
21-
return Translations.translate_formatted(
21+
return Translations.format(
2222
"entries.unlinked.relink.attempting",
2323
idx=x,
2424
missing_count=self.tracker.missing_file_entries_count,

tagstudio/src/qt/modals/tag_database.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ def delete_tag(self, tag: Tag):
6060
message_box = QMessageBox(
6161
QMessageBox.Question, # type: ignore
6262
Translations["tag.remove"],
63-
Translations.translate_formatted(
64-
"tag.confirm_delete", tag_name=self.lib.tag_display_name(tag.id)
65-
),
63+
Translations.format("tag.confirm_delete", tag_name=self.lib.tag_display_name(tag.id)),
6664
QMessageBox.Ok | QMessageBox.Cancel, # type: ignore
6765
)
6866

tagstudio/src/qt/modals/tag_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def update_tags(self, query: str | None = None):
245245
# Add back the "Create & Add" button
246246
if query and query.strip():
247247
cb: QPushButton = self.build_create_button(query)
248-
cb.setText(Translations.translate_formatted("tag.create_add", query=query))
248+
cb.setText(Translations.format("tag.create_add", query=query))
249249
with catch_warnings(record=True):
250250
cb.clicked.disconnect()
251251
cb.clicked.connect(lambda: self.create_and_add_tag(query or ""))

tagstudio/src/qt/translations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __format(self, text: str, **kwargs) -> str:
3939
)
4040
return text
4141

42-
def translate_formatted(self, key: str, **kwargs) -> str:
42+
def format(self, key: str, **kwargs) -> str:
4343
return self.__format(self[key], **kwargs)
4444

4545
def __getitem__(self, key: str) -> str:

0 commit comments

Comments
 (0)