mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-02-01 15:49:09 +00:00
feat: translations for most of the remaining stuff
This commit is contained in:
@@ -69,11 +69,14 @@
|
||||
"generic.close": "Close",
|
||||
"generic.copy": "Copy",
|
||||
"generic.cut": "Cut",
|
||||
"generic.save": "Save",
|
||||
"generic.delete": "Delete",
|
||||
"generic.delete_alt": "&Delete",
|
||||
"generic.continue": "Continue",
|
||||
"generic.done": "Done",
|
||||
"generic.done_alt": "&Done",
|
||||
"generic.edit": "Edit",
|
||||
"generic.edit_alt": "&Edit",
|
||||
"generic.rename": "Rename",
|
||||
"generic.rename_alt": "&Rename",
|
||||
"generic.overwrite": "Overwrite",
|
||||
@@ -102,7 +105,7 @@
|
||||
"ignore_list.mode.label": "List Mode:",
|
||||
"ignore_list.title": "File Extensions",
|
||||
"library.field.add": "Add Field",
|
||||
"library.field.confirm_remove": "Are you sure you want to remove this \"%{self.lib.get_field_attr(field, \"name\")}\" field?",
|
||||
"library.field.confirm_remove": "Are you sure you want to remove this \"{name}\" field?",
|
||||
"library.field.mixed_data": "Mixed Data",
|
||||
"library.field.remove": "Remove Field",
|
||||
"library.missing": "Library Location is Missing",
|
||||
@@ -118,7 +121,7 @@
|
||||
"menu.edit.manage_file_extensions": "Manage File Extensions",
|
||||
"menu.edit.manage_tags": "Manage Tags",
|
||||
"menu.edit.new_tag": "New &Tag",
|
||||
"menu.edit": "&Edit",
|
||||
"menu.edit": "Edit",
|
||||
"menu.file.close_library": "&Close Library",
|
||||
"menu.file.new_library": "New Library",
|
||||
"menu.file.open_create_library": "&Open/Create Library",
|
||||
@@ -156,6 +159,7 @@
|
||||
"tag.add_to_search": "Add to Search",
|
||||
"tag.edit": "Edit Tag",
|
||||
"tag.add": "Add Tag",
|
||||
"tag.add.plural": "Add Tags",
|
||||
"tag.create": "Create Tag",
|
||||
"tag.remove": "Remove Tag",
|
||||
"tag.aliases": "Aliases",
|
||||
@@ -185,5 +189,38 @@
|
||||
"drop_import.progress.window_title": "Import Files",
|
||||
"drop_import.duplicates_choice.singular": "The following file has a filename that already exists in the library.",
|
||||
"drop_import.duplicates_choice.plural": "The following {count} files have filenames that already exist in the library.",
|
||||
"landing.open_create_library": "Open/Create Library {shortcut}"
|
||||
"landing.open_create_library": "Open/Create Library {shortcut}",
|
||||
"video_player.autoplay": "Autoplay",
|
||||
"json_migration.title": "Save Format Migration: \"{path}\"",
|
||||
"json_migration.info.description": "Library save files created with TagStudio versions <b>9.4 and below</b> will need to be migrated to the new <b>v9.5+</b> format.<br><h2>What you need to know:</h2><ul><li>Your existing library save file will <b><i>NOT</i></b> be deleted</li><li>Your personal files will <b><i>NOT</i></b> be deleted, moved, or modified</li><li>The new v9.5+ save format can not be opened in earlier versions of TagStudio</li></ul>",
|
||||
"json_migration.title.old_lib": "<h2>v9.4 Library</h2>",
|
||||
"json_migration.title.new_lib": "<h2>v9.5+ Library</h2>",
|
||||
"json_migration.start_and_preview": "Start and Preview",
|
||||
"json_migration.finish_migration": "Finish Migration",
|
||||
"json_migration.checking_for_parity": "Checking for Parity...",
|
||||
"json_migration.creating_database_tables": "Creating SQL Database Tables...",
|
||||
"json_migration.migrating_files_entries": "Migrating {entries:,d} File Entries...",
|
||||
"json_migration.migration_complete": "Migration Complete!",
|
||||
"json_migration.migration_complete_with_discrepancies": "Migration Complete, Discrepancies Found",
|
||||
"json_migration.discrepancies_found": "Library Discrepancies Found",
|
||||
"json_migration.discrepancies_found.description": "Discrepancies were found between the original and converted library formats. Please review and choose to whether continue with the migration or to cancel.",
|
||||
"json_migration.discrepancies.sql_entry_id_missing": "[Field Comparison]:\nNEW (SQL): SQL Entry ID not found: {id}",
|
||||
"json_migration.discrepancies.fields": "[Field Comparison]:\nOLD (JSON):{json_fields}\nNEW (SQL):{sql_fields}",
|
||||
"json_migration.discrepancies.subtag": "[Subtag Parity]:\nOLD (JSON):{json_subtags}\nNEW (SQL):{sql_subtags}",
|
||||
"json_migration.discrepancies.alias": "[Alias Parity]:\nOLD (JSON):{json_aliases}\nNEW (SQL):{sql_aliases}",
|
||||
"json_migration.discrepancies.shorthand": "[Shorthand Parity]:\nOLD (JSON):{json_shorthand}\nNEW (SQL):{sql_shorthand}",
|
||||
"json_migration.discrepancies.color": "[Color Parity]:\nOLD (JSON):{json_color}\nNEW (SQL):{sql_color}",
|
||||
"json_migration.heading.match": "Matched",
|
||||
"json_migration.heading.differ": "Discrepancy",
|
||||
"json_migration.heading.entires": "Entries:",
|
||||
"json_migration.heading.tags": "Tags:",
|
||||
"json_migration.heading.shorthands": "Shorthands:",
|
||||
"json_migration.heading.parent_tags": "Parent Tags:",
|
||||
"json_migration.heading.aliases": "Aliases:",
|
||||
"json_migration.heading.colors": "Colors:",
|
||||
"json_migration.heading.file_extension_list": "File Extension List:",
|
||||
"json_migration.heading.extension_list_type": "Extension List Type:",
|
||||
"json_migration.heading.paths": "Paths:",
|
||||
"json_migration.heading.fields": "Fields:",
|
||||
"json_migration.description": "<br>Start and preview the results of the library migration process. The converted library will <i>not</i> be used unless you click \"Finish Migration\". <br><br>Library data should either have matching values or a feature a \"Matched\" label. Values that do not match will be displayed in red and feature a \"<b>(!)</b>\" symbol next to them.<br><center><i>This process may take up to several minutes for larger libraries.</i></center>"
|
||||
}
|
||||
@@ -6,6 +6,8 @@ from PySide6.QtCore import QObject, Signal
|
||||
from PySide6.QtGui import QAction
|
||||
from PySide6.QtWidgets import QLabel, QMenu, QMessageBox, QPushButton
|
||||
|
||||
from .helpers.qbutton_wrapper import QPushButtonWrapper
|
||||
|
||||
DEFAULT_TRANSLATION = "de"
|
||||
|
||||
|
||||
@@ -49,7 +51,7 @@ class Translator:
|
||||
|
||||
def translate_qobject(self, widget: QObject, key: str, **kwargs):
|
||||
"""Translates the text of the QObject using :func:`translate_with_setter`."""
|
||||
if isinstance(widget, (QLabel, QAction, QPushButton, QMessageBox)):
|
||||
if isinstance(widget, (QLabel, QAction, QPushButton, QMessageBox, QPushButtonWrapper)):
|
||||
self.translate_with_setter(widget.setText, key, **kwargs)
|
||||
elif isinstance(widget, (QMenu)):
|
||||
self.translate_with_setter(widget.setTitle, key, **kwargs)
|
||||
|
||||
@@ -259,7 +259,7 @@ class QtDriver(DriverMixin, QObject):
|
||||
file_menu = QMenu(menu_bar)
|
||||
Translations.translate_qobject(file_menu, "menu.file")
|
||||
edit_menu = QMenu(menu_bar)
|
||||
Translations.translate_qobject(edit_menu, "menu.edit")
|
||||
Translations.translate_qobject(edit_menu, "generic.edit_alt")
|
||||
view_menu = QMenu(menu_bar)
|
||||
Translations.translate_qobject(view_menu, "menu.view")
|
||||
tools_menu = QMenu(menu_bar)
|
||||
|
||||
@@ -34,6 +34,8 @@ from src.qt.widgets.paged_panel.paged_body_wrapper import PagedBodyWrapper
|
||||
from src.qt.widgets.paged_panel.paged_panel import PagedPanel
|
||||
from src.qt.widgets.paged_panel.paged_panel_state import PagedPanelState
|
||||
|
||||
from ..translations import Translations
|
||||
|
||||
logger = structlog.get_logger(__name__)
|
||||
|
||||
|
||||
@@ -54,7 +56,7 @@ class JsonMigrationModal(QObject):
|
||||
self.is_migration_initialized: bool = False
|
||||
self.discrepancies: list[str] = []
|
||||
|
||||
self.title: str = f'Save Format Migration: "{self.path}"' # TODO translate
|
||||
self.title: str = Translations.translate_formatted("json_migration.title", path=self.path)
|
||||
self.warning: str = "<b><a style='color: #e22c3c'>(!)</a></b>"
|
||||
|
||||
self.old_entry_count: int = 0
|
||||
@@ -77,24 +79,17 @@ class JsonMigrationModal(QObject):
|
||||
def init_page_info(self) -> None:
|
||||
"""Initialize the migration info page."""
|
||||
body_wrapper: PagedBodyWrapper = PagedBodyWrapper()
|
||||
body_label: QLabel = QLabel( # TODO translate
|
||||
"Library save files created with TagStudio versions <b>9.4 and below</b> will "
|
||||
"need to be migrated to the new <b>v9.5+</b> format."
|
||||
"<br>"
|
||||
"<h2>What you need to know:</h2>"
|
||||
"<ul>"
|
||||
"<li>Your existing library save file will <b><i>NOT</i></b> be deleted</li>"
|
||||
"<li>Your personal files will <b><i>NOT</i></b> be deleted, moved, or modified</li>"
|
||||
"<li>The new v9.5+ save format can not be opened in earlier versions of TagStudio</li>"
|
||||
"</ul>"
|
||||
)
|
||||
body_label = QLabel()
|
||||
Translations.translate_qobject(body_label, "json_migration.info.description")
|
||||
body_label.setWordWrap(True)
|
||||
body_label.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
||||
body_wrapper.layout().addWidget(body_label)
|
||||
body_wrapper.layout().setContentsMargins(0, 36, 0, 0)
|
||||
|
||||
cancel_button: QPushButtonWrapper = QPushButtonWrapper("Cancel") # TODO translate
|
||||
next_button: QPushButtonWrapper = QPushButtonWrapper("Continue") # TODO translate
|
||||
cancel_button = QPushButtonWrapper()
|
||||
Translations.translate_qobject(cancel_button, "generic.cancel")
|
||||
next_button = QPushButtonWrapper()
|
||||
Translations.translate_qobject(next_button, "generic.continue")
|
||||
cancel_button.clicked.connect(self.migration_cancelled.emit)
|
||||
|
||||
self.stack.append(
|
||||
@@ -115,30 +110,20 @@ class JsonMigrationModal(QObject):
|
||||
body_container_layout.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
tab: str = " "
|
||||
self.match_text: str = "Matched" # TODO translate
|
||||
self.differ_text: str = "Discrepancy" # TODO translate
|
||||
self.match_text: str = Translations["json_migration.heading.match"]
|
||||
self.differ_text: str = Translations["json_migration.heading.differ"]
|
||||
|
||||
entries_text: str = "Entries:" # TODO translate
|
||||
tags_text: str = "Tags:" # TODO translate
|
||||
shorthand_text: str = tab + "Shorthands:" # TODO translate
|
||||
subtags_text: str = tab + "Parent Tags:" # TODO translate
|
||||
aliases_text: str = tab + "Aliases:" # TODO translate
|
||||
colors_text: str = tab + "Colors:" # TODO translate
|
||||
ext_text: str = "File Extension List:" # TODO translate
|
||||
ext_type_text: str = "Extension List Type:" # TODO translate
|
||||
desc_text: str = ( # TODO translate
|
||||
"<br>Start and preview the results of the library migration process. "
|
||||
'The converted library will <i>not</i> be used unless you click "Finish Migration". '
|
||||
"<br><br>"
|
||||
'Library data should either have matching values or a feature a "Matched" label. '
|
||||
'Values that do not match will be displayed in red and feature a "<b>(!)</b>" '
|
||||
"symbol next to them."
|
||||
"<br><center><i>"
|
||||
"This process may take up to several minutes for larger libraries."
|
||||
"</i></center>"
|
||||
)
|
||||
path_parity_text: str = tab + "Paths:" # TODO translate
|
||||
field_parity_text: str = tab + "Fields:" # TODO translate
|
||||
entries_text: str = Translations["json_migration.heading.entires"]
|
||||
tags_text: str = Translations["json_migration.heading.tags"]
|
||||
shorthand_text: str = tab + Translations["json_migration.heading.shorthands"]
|
||||
subtags_text: str = tab + Translations["json_migration.heading.parent_tags"]
|
||||
aliases_text: str = tab + Translations["json_migration.heading.aliases"]
|
||||
colors_text: str = tab + Translations["json_migration.heading.colors"]
|
||||
ext_text: str = Translations["json_migration.heading.file_extension_list"]
|
||||
ext_type_text: str = Translations["json_migration.heading.extension_list_type"]
|
||||
desc_text: str = Translations["json_migration.description"]
|
||||
path_parity_text: str = tab + Translations["json_migration.heading.paths"]
|
||||
field_parity_text: str = tab + Translations["json_migration.heading.fields"]
|
||||
|
||||
self.entries_row: int = 0
|
||||
self.path_row: int = 1
|
||||
@@ -153,7 +138,8 @@ class JsonMigrationModal(QObject):
|
||||
|
||||
old_lib_container: QWidget = QWidget()
|
||||
old_lib_layout: QVBoxLayout = QVBoxLayout(old_lib_container)
|
||||
old_lib_title: QLabel = QLabel("<h2>v9.4 Library</h2>") # TODO translate
|
||||
old_lib_title = QLabel()
|
||||
Translations.translate_qobject(old_lib_title, "json_migration.title.old_lib")
|
||||
old_lib_title.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
old_lib_layout.addWidget(old_lib_title)
|
||||
|
||||
@@ -215,7 +201,8 @@ class JsonMigrationModal(QObject):
|
||||
|
||||
new_lib_container: QWidget = QWidget()
|
||||
new_lib_layout: QVBoxLayout = QVBoxLayout(new_lib_container)
|
||||
new_lib_title: QLabel = QLabel("<h2>v9.5+ Library</h2>") # TODO translate
|
||||
new_lib_title = QLabel()
|
||||
Translations.translate_qobject(new_lib_title, "json_migration.title.new_lib")
|
||||
new_lib_title.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
new_lib_layout.addWidget(new_lib_title)
|
||||
|
||||
@@ -291,13 +278,16 @@ class JsonMigrationModal(QObject):
|
||||
self.body_wrapper_01.layout().addWidget(desc_label)
|
||||
self.body_wrapper_01.layout().setSpacing(12)
|
||||
|
||||
back_button: QPushButtonWrapper = QPushButtonWrapper("Back") # TODO translate
|
||||
start_button: QPushButtonWrapper = QPushButtonWrapper("Start and Preview") # TODO translate
|
||||
back_button = QPushButtonWrapper()
|
||||
Translations.translate_qobject(back_button, "generic.navigation.back")
|
||||
start_button = QPushButtonWrapper()
|
||||
Translations.translate_qobject(start_button, "json_migration.start_and_preview")
|
||||
start_button.setMinimumWidth(120)
|
||||
start_button.clicked.connect(self.migrate)
|
||||
start_button.clicked.connect(lambda: finish_button.setDisabled(False))
|
||||
start_button.clicked.connect(lambda: start_button.setDisabled(True))
|
||||
finish_button: QPushButtonWrapper = QPushButtonWrapper("Finish Migration") # TODO translate
|
||||
finish_button: QPushButtonWrapper = QPushButtonWrapper()
|
||||
Translations.translate_qobject(finish_button, "json_migration.finish_migration")
|
||||
finish_button.setMinimumWidth(120)
|
||||
finish_button.setDisabled(True)
|
||||
finish_button.clicked.connect(self.finish_migration)
|
||||
@@ -348,9 +338,11 @@ class JsonMigrationModal(QObject):
|
||||
lambda x: (
|
||||
pb.setLabelText(f"<h4>{x}</h4>"),
|
||||
self.update_sql_value_ui(show_msg_box=False)
|
||||
if x == "Checking for Parity..." # TODO translate
|
||||
if x == Translations["json_migration.checking_for_parity"]
|
||||
else (),
|
||||
self.update_parity_ui()
|
||||
if x == Translations["json_migration.checking_for_parity"]
|
||||
else (),
|
||||
self.update_parity_ui() if x == "Checking for Parity..." else (), # TODO translate
|
||||
)
|
||||
)
|
||||
r = CustomRunnable(iterator.run)
|
||||
@@ -367,23 +359,23 @@ class JsonMigrationModal(QObject):
|
||||
"""Iterate over the library migration process."""
|
||||
try:
|
||||
# Convert JSON Library to SQLite
|
||||
yield "Creating SQL Database Tables..." # TODO translate
|
||||
yield Translations["json_migration.creating_database_tables"]
|
||||
self.sql_lib = SqliteLibrary()
|
||||
self.temp_path: Path = (
|
||||
self.json_lib.library_dir / TS_FOLDER_NAME / "migration_ts_library.sqlite"
|
||||
)
|
||||
self.sql_lib.storage_path = self.temp_path
|
||||
if self.temp_path.exists():
|
||||
logger.info(
|
||||
'Temporary migration file "temp_path" already exists. Removing...'
|
||||
) # TODO translate
|
||||
logger.info('Temporary migration file "temp_path" already exists. Removing...')
|
||||
self.temp_path.unlink()
|
||||
self.sql_lib.open_sqlite_library(
|
||||
self.json_lib.library_dir, is_new=True, add_default_data=False
|
||||
)
|
||||
yield f"Migrating {len(self.json_lib.entries):,d} File Entries..." # TODO translate
|
||||
yield Translations.translate_formatted(
|
||||
"json_migration.migrating_files_entries", entries=len(self.json_lib.entries)
|
||||
)
|
||||
self.sql_lib.migrate_json_to_sqlite(self.json_lib)
|
||||
yield "Checking for Parity..." # TODO translate
|
||||
yield Translations["json_migration.checking_for_parity"]
|
||||
check_set = set()
|
||||
check_set.add(self.check_field_parity())
|
||||
check_set.add(self.check_path_parity())
|
||||
@@ -393,9 +385,9 @@ class JsonMigrationModal(QObject):
|
||||
check_set.add(self.check_color_parity())
|
||||
self.update_parity_ui()
|
||||
if False not in check_set:
|
||||
yield "Migration Complete!" # TODO translate
|
||||
yield Translations["json_migration.migration_complete"]
|
||||
else:
|
||||
yield "Migration Complete, Discrepancies Found" # TODO translate
|
||||
yield Translations["json_migration.migration_complete_with_discrepancies"]
|
||||
self.done = True
|
||||
|
||||
except Exception as e:
|
||||
@@ -434,18 +426,19 @@ class JsonMigrationModal(QObject):
|
||||
self.sql_lib.prefs(LibraryPrefs.IS_EXCLUDE_LIST),
|
||||
self.old_ext_type,
|
||||
)
|
||||
logger.info("Parity check complete!") # TODO translate
|
||||
logger.info("Parity check complete!")
|
||||
if self.discrepancies:
|
||||
logger.warning("Discrepancies found:") # TODO translate
|
||||
logger.warning("Discrepancies found:")
|
||||
logger.warning("\n".join(self.discrepancies))
|
||||
QApplication.beep()
|
||||
if not show_msg_box:
|
||||
return
|
||||
msg_box = QMessageBox()
|
||||
msg_box.setWindowTitle("Library Discrepancies Found") # TODO translate
|
||||
msg_box.setText( # TODO translate
|
||||
"Discrepancies were found between the original and converted library formats. "
|
||||
"Please review and choose to whether continue with the migration or to cancel."
|
||||
Translations.translate_with_setter(
|
||||
msg_box.setWindowTitle, "json_migration.discrepancies_found"
|
||||
)
|
||||
Translations.translate_qobject(
|
||||
msg_box, "json_migration.discrepancies_found.description"
|
||||
)
|
||||
msg_box.setDetailedText("\n".join(self.discrepancies))
|
||||
msg_box.setIcon(QMessageBox.Icon.Warning)
|
||||
@@ -548,8 +541,11 @@ class JsonMigrationModal(QObject):
|
||||
"[Field Comparison]",
|
||||
message=f"NEW (SQL): SQL Entry ID mismatch: {json_entry.id+1}",
|
||||
)
|
||||
self.discrepancies.append( # TODO translate
|
||||
f"[Field Comparison]:\nNEW (SQL): SQL Entry ID not found: {json_entry.id+1}"
|
||||
self.discrepancies.append(
|
||||
Translations.translate_formatted(
|
||||
"json_migration.discrepancies.sql_entry_id_missing",
|
||||
id=json_entry.id + 1,
|
||||
)
|
||||
)
|
||||
self.field_parity = False
|
||||
return self.field_parity
|
||||
@@ -626,8 +622,12 @@ class JsonMigrationModal(QObject):
|
||||
and sql_fields is not None
|
||||
and (json_fields == sql_fields)
|
||||
):
|
||||
self.discrepancies.append( # TODO translate
|
||||
f"[Field Comparison]:\nOLD (JSON):{json_fields}\nNEW (SQL):{sql_fields}"
|
||||
self.discrepancies.append(
|
||||
Translations.translate_formatted(
|
||||
"json_migration.discrepancies.fields",
|
||||
json_fields=json_fields,
|
||||
sql_fields=sql_fields,
|
||||
)
|
||||
)
|
||||
self.field_parity = False
|
||||
return self.field_parity
|
||||
@@ -678,8 +678,12 @@ class JsonMigrationModal(QObject):
|
||||
and json_subtags is not None
|
||||
and (sql_subtags == json_subtags)
|
||||
):
|
||||
self.discrepancies.append( # TODO translate
|
||||
f"[Subtag Parity]:\nOLD (JSON):{json_subtags}\nNEW (SQL):{sql_subtags}"
|
||||
self.discrepancies.append(
|
||||
Translations.translate_formatted(
|
||||
"json_migration.discrepancies.subtag",
|
||||
json_subtags=json_subtags,
|
||||
sql_subtags=sql_subtags,
|
||||
)
|
||||
)
|
||||
self.subtag_parity = False
|
||||
return self.subtag_parity
|
||||
@@ -714,8 +718,12 @@ class JsonMigrationModal(QObject):
|
||||
and json_aliases is not None
|
||||
and (sql_aliases == json_aliases)
|
||||
):
|
||||
self.discrepancies.append( # TODO translate
|
||||
f"[Alias Parity]:\nOLD (JSON):{json_aliases}\nNEW (SQL):{sql_aliases}"
|
||||
self.discrepancies.append(
|
||||
Translations.translate_formatted(
|
||||
"json_migration.discrepancies.alias",
|
||||
json_aliases=json_aliases,
|
||||
sql_aliases=sql_aliases,
|
||||
)
|
||||
)
|
||||
self.alias_parity = False
|
||||
return self.alias_parity
|
||||
@@ -745,8 +753,12 @@ class JsonMigrationModal(QObject):
|
||||
and json_shorthand is not None
|
||||
and (sql_shorthand == json_shorthand)
|
||||
):
|
||||
self.discrepancies.append( # TODO translate
|
||||
f"[Shorthand Parity]:\nOLD (JSON):{json_shorthand}\nNEW (SQL):{sql_shorthand}"
|
||||
self.discrepancies.append(
|
||||
Translations.translate_formatted(
|
||||
"json_migration.discrepancies.shorthand",
|
||||
json_shorthand=json_shorthand,
|
||||
sql_shorthand=sql_shorthand,
|
||||
)
|
||||
)
|
||||
self.shorthand_parity = False
|
||||
return self.shorthand_parity
|
||||
@@ -776,8 +788,12 @@ class JsonMigrationModal(QObject):
|
||||
)
|
||||
|
||||
if not (sql_color is not None and json_color is not None and (sql_color == json_color)):
|
||||
self.discrepancies.append( # TODO translate
|
||||
f"[Color Parity]:\nOLD (JSON):{json_color}\nNEW (SQL):{sql_color}"
|
||||
self.discrepancies.append(
|
||||
Translations.translate_formatted(
|
||||
"json_migration.discrepancies.color",
|
||||
json_color=json_color,
|
||||
sql_color=sql_color,
|
||||
)
|
||||
)
|
||||
self.color_parity = False
|
||||
return self.color_parity
|
||||
|
||||
@@ -7,6 +7,8 @@ from typing import Callable
|
||||
from PySide6.QtCore import Qt, Signal
|
||||
from PySide6.QtWidgets import QHBoxLayout, QLabel, QPushButton, QVBoxLayout, QWidget
|
||||
|
||||
from ..translations import Translations
|
||||
|
||||
|
||||
class PanelModal(QWidget):
|
||||
saved = Signal()
|
||||
@@ -49,7 +51,7 @@ class PanelModal(QWidget):
|
||||
|
||||
if not (save_callback or has_save):
|
||||
self.done_button = QPushButton()
|
||||
self.done_button.setText("Done") # TODO translate
|
||||
Translations.translate_qobject(self.done_button, "generic.done")
|
||||
self.done_button.setAutoDefault(True)
|
||||
self.done_button.clicked.connect(self.hide)
|
||||
if done_callback:
|
||||
@@ -59,7 +61,7 @@ class PanelModal(QWidget):
|
||||
|
||||
if save_callback or has_save:
|
||||
self.cancel_button = QPushButton()
|
||||
self.cancel_button.setText("Cancel") # TODO translate
|
||||
Translations.translate_qobject(self.cancel_button, "generic.cancel")
|
||||
self.cancel_button.clicked.connect(self.hide)
|
||||
self.cancel_button.clicked.connect(widget.reset)
|
||||
# self.cancel_button.clicked.connect(cancel_callback)
|
||||
@@ -67,7 +69,7 @@ class PanelModal(QWidget):
|
||||
self.button_layout.addWidget(self.cancel_button)
|
||||
|
||||
self.save_button = QPushButton()
|
||||
self.save_button.setText("Save") # TODO translate
|
||||
Translations.translate_qobject(self.save_button, "generic.save")
|
||||
self.save_button.setAutoDefault(True)
|
||||
self.save_button.clicked.connect(self.hide)
|
||||
self.save_button.clicked.connect(self.saved.emit)
|
||||
|
||||
@@ -62,6 +62,8 @@ from src.qt.widgets.text_line_edit import EditTextLine
|
||||
from src.qt.widgets.thumb_renderer import ThumbRenderer
|
||||
from src.qt.widgets.video_player import VideoPlayer
|
||||
|
||||
from ..translations import Translations
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from src.qt.ts_qt import QtDriver
|
||||
|
||||
@@ -119,7 +121,8 @@ class PreviewPanel(QWidget):
|
||||
)
|
||||
date_style = "font-size:12px;"
|
||||
|
||||
self.open_file_action = QAction("Open file", self) # TODO translate
|
||||
self.open_file_action = QAction(self)
|
||||
Translations.translate_qobject(self.open_file_action, "file.open_file")
|
||||
self.open_explorer_action = QAction(PlatformStrings.open_file_str, self)
|
||||
|
||||
self.preview_img = QPushButtonWrapper()
|
||||
@@ -279,7 +282,7 @@ class PreviewPanel(QWidget):
|
||||
self.add_field_button.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||
self.add_field_button.setMinimumSize(96, 28)
|
||||
self.add_field_button.setMaximumSize(96, 28)
|
||||
self.add_field_button.setText("Add Field") # TODO translate
|
||||
Translations.translate_qobject(self.add_field_button, "library.field.add")
|
||||
self.afb_layout.addWidget(self.add_field_button)
|
||||
self.add_field_modal = AddFieldModal(self.lib)
|
||||
self.place_add_field_button()
|
||||
@@ -303,7 +306,7 @@ class PreviewPanel(QWidget):
|
||||
self.driver.frame_content[grid_idx] = result
|
||||
|
||||
def remove_field_prompt(self, name: str) -> str:
|
||||
return f'Are you sure you want to remove field "{name}"?' # TODO translate
|
||||
return Translations.translate_formatted("library.field.confirm_remove", name=name)
|
||||
|
||||
def fill_libs_widget(self, layout: QVBoxLayout):
|
||||
settings = self.driver.settings
|
||||
@@ -341,7 +344,8 @@ class PreviewPanel(QWidget):
|
||||
# remove any potential previous items
|
||||
clear_layout(layout)
|
||||
|
||||
label = QLabel("Recent Libraries") # TODO translate
|
||||
label = QLabel()
|
||||
Translations.translate_qobject(label, "generic.recent_libraries")
|
||||
label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
|
||||
row_layout = QHBoxLayout()
|
||||
@@ -379,7 +383,7 @@ class PreviewPanel(QWidget):
|
||||
lib = Path(full_val)
|
||||
if not lib.exists() or not (lib / TS_FOLDER_NAME).exists():
|
||||
button.setDisabled(True)
|
||||
button.setToolTip("Location is missing") # TODO translate
|
||||
Translations.translate_with_setter(button.setToolTip, "library.missing")
|
||||
|
||||
def open_library_button_clicked(path):
|
||||
return lambda: self.driver.open_library(Path(path))
|
||||
@@ -1096,8 +1100,8 @@ class PreviewPanel(QWidget):
|
||||
remove_mb.setWindowTitle("Remove Field") # TODO translate
|
||||
remove_mb.setIcon(QMessageBox.Icon.Warning)
|
||||
cancel_button = remove_mb.addButton(
|
||||
"&Cancel", QMessageBox.ButtonRole.DestructiveRole
|
||||
) # TODO translate
|
||||
Translations["generic.cancel_alt"], QMessageBox.ButtonRole.DestructiveRole
|
||||
)
|
||||
remove_mb.addButton("&Remove", QMessageBox.ButtonRole.RejectRole) # TODO translate
|
||||
# remove_mb.setStandardButtons(QMessageBox.StandardButton.Cancel)
|
||||
remove_mb.setDefaultButton(cancel_button)
|
||||
|
||||
@@ -21,6 +21,8 @@ from src.core.library import Tag
|
||||
from src.core.library.alchemy.enums import TagColor
|
||||
from src.core.palette import ColorType, get_tag_color
|
||||
|
||||
from ..translations import Translations
|
||||
|
||||
|
||||
class TagAliasWidget(QWidget):
|
||||
on_remove = Signal()
|
||||
@@ -126,17 +128,20 @@ class TagWidget(QWidget):
|
||||
self.bg_button.setFlat(True)
|
||||
self.bg_button.setText(tag.name)
|
||||
if has_edit:
|
||||
edit_action = QAction("Edit", self) # TODO translate
|
||||
edit_action = QAction(self)
|
||||
Translations.translate_qobject(edit_action, "generic.edit")
|
||||
edit_action.triggered.connect(on_edit_callback)
|
||||
edit_action.triggered.connect(self.on_edit.emit)
|
||||
self.bg_button.addAction(edit_action)
|
||||
# if on_click_callback:
|
||||
self.bg_button.setContextMenuPolicy(Qt.ContextMenuPolicy.ActionsContextMenu)
|
||||
|
||||
search_for_tag_action = QAction("Search for Tag", self) # TODO translate
|
||||
search_for_tag_action = QAction(self)
|
||||
Translations.translate_qobject(search_for_tag_action, "tag.search_for_tag")
|
||||
search_for_tag_action.triggered.connect(self.on_click.emit)
|
||||
self.bg_button.addAction(search_for_tag_action)
|
||||
add_to_search_action = QAction("Add to Search", self) # TODO translate
|
||||
add_to_search_action = QAction(self)
|
||||
Translations.translate_qobject(add_to_search_action, "tag.add_to_search")
|
||||
self.bg_button.addAction(add_to_search_action)
|
||||
|
||||
self.inner_layout = QHBoxLayout()
|
||||
|
||||
@@ -20,6 +20,8 @@ from src.qt.widgets.fields import FieldWidget
|
||||
from src.qt.widgets.panel import PanelModal
|
||||
from src.qt.widgets.tag import TagWidget
|
||||
|
||||
from ..translations import Translations
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from src.qt.ts_qt import QtDriver
|
||||
|
||||
@@ -75,7 +77,8 @@ class TagBoxWidget(FieldWidget):
|
||||
)
|
||||
tsp = TagSearchPanel(self.driver.lib)
|
||||
tsp.tag_chosen.connect(lambda x: self.add_tag_callback(x))
|
||||
self.add_modal = PanelModal(tsp, title, "Add Tags") # TODO translate
|
||||
self.add_modal = PanelModal(tsp, title)
|
||||
Translations.translate_with_setter(self.add_modal.setWindowTitle, "tag.add.plural")
|
||||
self.add_button.clicked.connect(
|
||||
lambda: (
|
||||
tsp.update_tags(),
|
||||
@@ -130,11 +133,11 @@ class TagBoxWidget(FieldWidget):
|
||||
|
||||
self.edit_modal = PanelModal(
|
||||
build_tag_panel,
|
||||
tag.name, # TODO - display name including subtags
|
||||
"Edit Tag", # TODO translate
|
||||
title=tag.name, # TODO - display name including subtags
|
||||
done_callback=self.driver.preview_panel.update_widgets,
|
||||
has_save=True,
|
||||
)
|
||||
Translations.translate_with_setter(self.edit_modal.setWindowTitle, "tag.edit")
|
||||
# TODO - this was update_tag()
|
||||
self.edit_modal.saved.connect(
|
||||
lambda: self.driver.lib.update_tag(
|
||||
|
||||
@@ -32,6 +32,8 @@ from src.core.enums import SettingItems
|
||||
from src.qt.helpers.file_opener import FileOpenerHelper
|
||||
from src.qt.platform_strings import PlatformStrings
|
||||
|
||||
from ..translations import Translations
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from src.qt.ts_qt import QtDriver
|
||||
|
||||
@@ -115,7 +117,8 @@ class VideoPlayer(QGraphicsView):
|
||||
|
||||
self.setContextMenuPolicy(Qt.ContextMenuPolicy.ActionsContextMenu)
|
||||
self.opener = FileOpenerHelper(filepath=self.filepath)
|
||||
autoplay_action = QAction("Autoplay", self) # TODO translate
|
||||
autoplay_action = QAction(self)
|
||||
Translations.translate_qobject(autoplay_action, "video_player.autoplay")
|
||||
autoplay_action.setCheckable(True)
|
||||
self.addAction(autoplay_action)
|
||||
autoplay_action.setChecked(
|
||||
@@ -124,7 +127,8 @@ class VideoPlayer(QGraphicsView):
|
||||
autoplay_action.triggered.connect(lambda: self.toggle_autoplay())
|
||||
self.autoplay = autoplay_action
|
||||
|
||||
open_file_action = QAction("Open file", self) # TODO translate
|
||||
open_file_action = QAction(self)
|
||||
Translations.translate_qobject(open_file_action, "file.open_file")
|
||||
open_file_action.triggered.connect(self.opener.open_file)
|
||||
|
||||
open_explorer_action = QAction(PlatformStrings.open_file_str, self)
|
||||
|
||||
Reference in New Issue
Block a user