Skip to content

Commit b0047b2

Browse files
authored
refactor: split translation keys for about screen (#845)
* fix(translations): remove errant `<b>` tag * refactor: split translation keys for about screen * ui: change form field style * fix: split new translation keys * fix: remove unused key * translations: re-split toki pona "about.content"
1 parent 039cebd commit b0047b2

File tree

14 files changed

+164
-60
lines changed

14 files changed

+164
-60
lines changed

src/tagstudio/qt/modals/about.py

Lines changed: 116 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,23 @@
33
# Created for TagStudio: https://github.com/CyanVoxel/TagStudio
44

55

6+
import math
7+
68
from PIL import ImageQt
79
from PySide6.QtCore import Qt
8-
from PySide6.QtGui import QPixmap
9-
from PySide6.QtWidgets import QHBoxLayout, QLabel, QPushButton, QVBoxLayout, QWidget
10+
from PySide6.QtGui import QGuiApplication, QPixmap
11+
from PySide6.QtWidgets import (
12+
QFormLayout,
13+
QHBoxLayout,
14+
QLabel,
15+
QPushButton,
16+
QSizePolicy,
17+
QVBoxLayout,
18+
QWidget,
19+
)
1020

1121
from tagstudio.core.constants import VERSION, VERSION_BRANCH
22+
from tagstudio.core.enums import Theme
1223
from tagstudio.core.palette import ColorType, UiColor, get_ui_color
1324
from tagstudio.qt.modals.ffmpeg_checker import FfmpegChecker
1425
from tagstudio.qt.resource_manager import ResourceManager
@@ -23,60 +34,134 @@ def __init__(self, config_path):
2334
self.fc: FfmpegChecker = FfmpegChecker()
2435
self.rm: ResourceManager = ResourceManager()
2536

37+
# TODO: There should be a global button theme somewhere.
38+
self.form_content_style = (
39+
f"background-color:{Theme.COLOR_BG.value
40+
if QGuiApplication.styleHints().colorScheme() is Qt.ColorScheme.Dark
41+
else Theme.COLOR_BG_LIGHT.value};"
42+
"border-radius:3px;"
43+
"font-weight: 500;"
44+
"padding: 2px;"
45+
)
46+
2647
self.setWindowModality(Qt.WindowModality.ApplicationModal)
27-
self.setMinimumSize(360, 480)
48+
self.setMinimumSize(360, 540)
49+
self.setMaximumSize(600, 600)
2850
self.root_layout = QVBoxLayout(self)
29-
self.root_layout.setContentsMargins(24, 24, 24, 6)
30-
self.root_layout.setSpacing(12)
31-
self.root_layout.setAlignment(Qt.AlignmentFlag.AlignTop)
51+
self.root_layout.setContentsMargins(0, 12, 0, 0)
52+
self.root_layout.setSpacing(0)
53+
self.root_layout.setAlignment(Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignCenter)
54+
55+
self.content_widget = QWidget()
56+
self.content_layout = QVBoxLayout(self.content_widget)
57+
self.content_layout.setContentsMargins(12, 12, 12, 12)
58+
self.content_layout.setSpacing(12)
3259

60+
# TagStudio Icon Logo --------------------------------------------------
3361
self.logo_widget = QLabel()
34-
self.logo_widget.setObjectName("logo")
3562
self.logo_pixmap = QPixmap.fromImage(ImageQt.ImageQt(self.rm.get("icon")))
63+
self.logo_pixmap.setDevicePixelRatio(self.devicePixelRatio())
3664
self.logo_pixmap = self.logo_pixmap.scaledToWidth(
37-
128, Qt.TransformationMode.SmoothTransformation
65+
math.floor(128 * self.devicePixelRatio()), Qt.TransformationMode.SmoothTransformation
3866
)
3967
self.logo_widget.setPixmap(self.logo_pixmap)
40-
self.logo_widget.setAlignment(Qt.AlignmentFlag.AlignHCenter)
41-
self.logo_widget.setContentsMargins(0, 0, 0, 24)
68+
self.logo_widget.setContentsMargins(0, 0, 0, 0)
69+
self.logo_widget.setAlignment(Qt.AlignmentFlag.AlignCenter)
70+
71+
# Title ----------------------------------------------------------------
72+
branch: str = (" (" + VERSION_BRANCH + ")") if VERSION_BRANCH else ""
73+
self.title_label = QLabel(f"<h2>TagStudio Alpha {VERSION}{branch}</h2>")
74+
self.title_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
75+
76+
# Description ----------------------------------------------------------
77+
self.desc_label = QLabel(Translations["about.description"])
78+
self.desc_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
79+
self.desc_label.setWordWrap(True)
80+
self.desc_label.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
4281

82+
# System Info ----------------------------------------------------------
4383
ff_version = self.fc.version()
4484
red = get_ui_color(ColorType.PRIMARY, UiColor.RED)
4585
green = get_ui_color(ColorType.PRIMARY, UiColor.GREEN)
86+
missing = Translations["generic.missing"]
87+
found = Translations["about.module.found"]
4688

47-
ffmpeg = f'<span style="color:{red}">Missing</span>'
89+
ffmpeg_status = f'<span style="color:{red}">{missing}</span>'
4890
if ff_version["ffmpeg"] is not None:
49-
ffmpeg = f'<span style="color:{green}">Found</span> (' + ff_version["ffmpeg"] + ")"
91+
ffmpeg_status = (
92+
f'<span style="color:{green}">{found}</span> (' + ff_version["ffmpeg"] + ")"
93+
)
5094

51-
ffprobe = f'<span style="color:{red}">Missing</span>'
95+
ffprobe_status = f'<span style="color:{red}">{missing}</span>'
5296
if ff_version["ffprobe"] is not None:
53-
ffprobe = f'<span style="color:{green}">Found</span> (' + ff_version["ffprobe"] + ")"
54-
55-
branch: str = (" (" + VERSION_BRANCH + ")") if VERSION_BRANCH else ""
56-
self.title_label = QLabel(f"<h2>TagStudio Alpha {VERSION}{branch}</h2>")
57-
self.title_label.setAlignment(Qt.AlignmentFlag.AlignHCenter)
58-
59-
self.content_label = QLabel(
60-
Translations.format(
61-
"about.content", config_path=config_path, ffmpeg=ffmpeg, ffprobe=ffprobe
97+
ffprobe_status = (
98+
f'<span style="color:{green}">{found}</span> (' + ff_version["ffprobe"] + ")"
6299
)
100+
101+
self.system_info_widget = QWidget()
102+
self.system_info_layout = QFormLayout(self.system_info_widget)
103+
self.system_info_layout.setLabelAlignment(Qt.AlignmentFlag.AlignRight)
104+
105+
# License
106+
license_title = QLabel(f'{Translations["about.license"]}')
107+
license_content = QLabel("GPLv3")
108+
license_content.setStyleSheet(self.form_content_style)
109+
license_content.setMaximumWidth(license_content.sizeHint().width())
110+
self.system_info_layout.addRow(license_title, license_content)
111+
112+
# Config Path
113+
config_path_title = QLabel(f'{Translations["about.config_path"]}')
114+
config_path_content = QLabel(f"{config_path}")
115+
config_path_content.setStyleSheet(self.form_content_style)
116+
config_path_content.setWordWrap(True)
117+
self.system_info_layout.addRow(config_path_title, config_path_content)
118+
119+
# FFmpeg Status
120+
ffmpeg_path_title = QLabel("FFmpeg")
121+
ffmpeg_path_content = QLabel(f"{ffmpeg_status}")
122+
ffmpeg_path_content.setStyleSheet(self.form_content_style)
123+
ffmpeg_path_content.setMaximumWidth(ffmpeg_path_content.sizeHint().width())
124+
self.system_info_layout.addRow(ffmpeg_path_title, ffmpeg_path_content)
125+
126+
# FFprobe Status
127+
ffprobe_path_title = QLabel("FFprobe")
128+
ffprobe_path_content = QLabel(f"{ffprobe_status}")
129+
ffprobe_path_content.setStyleSheet(self.form_content_style)
130+
ffprobe_path_content.setMaximumWidth(ffprobe_path_content.sizeHint().width())
131+
self.system_info_layout.addRow(ffprobe_path_title, ffprobe_path_content)
132+
133+
# Links ----------------------------------------------------------------
134+
repo_link = "https://github.com/TagStudioDev/TagStudio"
135+
docs_link = "https://docs.tagstud.io"
136+
discord_link = "https://discord.com/invite/hRNnVKhF2G"
137+
138+
self.links_label = QLabel(
139+
f'<p><a href="{repo_link}">GitHub</a> | '
140+
f'<a href="{docs_link}">{Translations["about.documentation"]}</a> | '
141+
f'<a href="{discord_link}">Discord</a></p>'
63142
)
64-
self.content_label.setObjectName("contentLabel")
65-
self.content_label.setWordWrap(True)
66-
self.content_label.setOpenExternalLinks(True)
67-
self.content_label.setAlignment(Qt.AlignmentFlag.AlignHCenter)
143+
self.links_label.setWordWrap(True)
144+
self.links_label.setOpenExternalLinks(True)
145+
self.links_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
68146

147+
# Buttons --------------------------------------------------------------
69148
self.button_widget = QWidget()
70149
self.button_layout = QHBoxLayout(self.button_widget)
150+
self.button_layout.setContentsMargins(12, 12, 12, 12)
71151
self.button_layout.addStretch(1)
72152

73153
self.close_button = QPushButton(Translations["generic.close"])
74154
self.close_button.clicked.connect(lambda: self.close())
75-
76155
self.button_layout.addWidget(self.close_button)
77156

78-
self.root_layout.addWidget(self.logo_widget)
79-
self.root_layout.addWidget(self.title_label)
80-
self.root_layout.addWidget(self.content_label)
81-
self.root_layout.addStretch(1)
157+
# Add Widgets to Layouts -----------------------------------------------
158+
self.content_layout.addWidget(self.logo_widget)
159+
self.content_layout.addWidget(self.title_label)
160+
self.content_layout.addWidget(self.desc_label)
161+
self.content_layout.addWidget(self.system_info_widget)
162+
self.content_layout.addWidget(self.links_label)
163+
self.content_layout.addStretch(1)
164+
self.content_layout.setAlignment(Qt.AlignmentFlag.AlignCenter)
165+
166+
self.root_layout.addWidget(self.content_widget)
82167
self.root_layout.addWidget(self.button_widget)

src/tagstudio/resources/translations/de.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
2-
"about.content": "<p>TagStudio ist eine Anwendung zum organisieren von Fotos & Dateien mit einem zugrunde liegendem Tag-basierten System, welches sich darauf konzentriert, dem Nutzer Freiraum und Flexibilität zu bieten. Keine proprietären Programme oder Formate, kein Meer an Hilfsdateien und keine komplette Umwälzung deiner Dateisystemstruktur.</p>Lizenz: GPLv3<br>Konfigurations-Pfad: {config_path}<br>FFmpeg: {ffmpeg}<br>FFprobe: {ffprobe}<p><a href=\"https://github.com/TagStudioDev/TagStudio\">GitHub</a> | <a href=\"https://docs.tagstud.io\">Dokumentation</a> | <a href=\"https://discord.com/invite/hRNnVKhF2G\">Discord</a></p>",
2+
"about.config_path": "Konfigurations-Pfad",
3+
"about.description": "TagStudio ist eine Anwendung zum organisieren von Fotos & Dateien mit einem zugrunde liegendem Tag-basierten System, welches sich darauf konzentriert, dem Nutzer Freiraum und Flexibilität zu bieten. Keine proprietären Programme oder Formate, kein Meer an Hilfsdateien und keine komplette Umwälzung deiner Dateisystemstruktur.",
4+
"about.documentation": "Dokumentation",
5+
"about.license": "Lizenz",
36
"about.title": "Über TagStudio",
47
"app.git": "Git Commit",
58
"app.pre_release": "Pre-Release",
@@ -116,7 +119,6 @@
116119
"generic.save": "Speichern",
117120
"generic.skip": "Überspringen",
118121
"generic.skip_alt": "Über&springen",
119-
"help.visit_github": "GitHub Repository besuchen",
120122
"home.search": "Suchen",
121123
"home.search_entries": "Nach Einträgen suchen",
122124
"home.search_library": "Bibliothek durchsuchen",

src/tagstudio/resources/translations/en.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{
2+
"about.config_path": "Config Path",
3+
"about.description": "TagStudio is a photo & file organization application with an underlying tag-based system that focuses on giving freedom and flexibility to the user. No proprietary programs or formats, no sea of sidecar files, and no complete upheaval of your filesystem structure.",
4+
"about.documentation": "Documentation",
5+
"about.license": "License",
6+
"about.module.found": "Found",
7+
"about.title": "About TagStudio",
8+
"about.website": "Website",
29
"app.git": "Git Commit",
310
"app.pre_release": "Pre-Release",
411
"app.title": "{base_title} - Library '{library_dir}'",
@@ -83,8 +90,6 @@
8390
"folders_to_tags.description": "Creates tags based on your folder structure and applies them to your entries.\n The structure below shows all the tags that will be created and what entries they will be applied to.",
8491
"folders_to_tags.open_all": "Open All",
8592
"folders_to_tags.title": "Create Tags From Folders",
86-
"about.title": "About TagStudio",
87-
"about.content": "<p>TagStudio is a photo & file organization application with an underlying tag-based system that focuses on giving freedom and flexibility to the user. No proprietary programs or formats, no sea of sidecar files, and no complete upheaval of your filesystem structure.</p>License: GPLv3<br>Config path: {config_path}<br>FFmpeg: {ffmpeg}<br>FFprobe: {ffprobe}<p><a href=\"https://github.com/TagStudioDev/TagStudio\">GitHub</a> | <a href=\"https://docs.tagstud.io\">Documentation</a> | <a href=\"https://discord.com/invite/hRNnVKhF2G\">Discord</a></p>",
8893
"generic.add": "Add",
8994
"generic.apply_alt": "&Apply",
9095
"generic.apply": "Apply",
@@ -101,6 +106,7 @@
101106
"generic.edit_alt": "&Edit",
102107
"generic.edit": "Edit",
103108
"generic.filename": "Filename",
109+
"generic.missing": "Missing",
104110
"generic.navigation.back": "Back",
105111
"generic.navigation.next": "Next",
106112
"generic.none": "None",
@@ -114,7 +120,6 @@
114120
"generic.save": "Save",
115121
"generic.skip_alt": "&Skip",
116122
"generic.skip": "Skip",
117-
"help.visit_github": "Visit GitHub Repository",
118123
"home.search_entries": "Search Entries",
119124
"home.search_library": "Search Library",
120125
"home.search_tags": "Search Tags",
@@ -275,7 +280,7 @@
275280
"trash.dialog.disambiguation_warning.singular": "This will remove it from TagStudio <i>AND</i> your file system!",
276281
"trash.dialog.move.confirmation.plural": "Are you sure you want to move these {count} files to the {trash_term}?",
277282
"trash.dialog.move.confirmation.singular": "Are you sure you want to move this file to the {trash_term}?",
278-
"trash.dialog.permanent_delete_warning": "<b>WARNING!</b> If this file can't be moved to the {trash_term}, <b>it will be <b>permanently deleted!</b>",
283+
"trash.dialog.permanent_delete_warning": "<b>WARNING!</b> If this file can't be moved to the {trash_term}, it will be <b>permanently deleted!</b>",
279284
"trash.dialog.title.plural": "Delete Files",
280285
"trash.dialog.title.singular": "Delete File",
281286
"trash.name.generic": "Trash",

src/tagstudio/resources/translations/es.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
2-
"about.content": "<p>TagStudio es una aplicación de fotografías y archivos con un sistema de etiquetas subyacentes que se centra en dar libertad y flexibilidad al usuario. Sin programas ni formatos propios, ni un mar de archivos y sin trastornar completamente tu sistema de estructurar los archivos.</p>. Licencia: GPLv3<br>Archivo de configuración: {config_path}<br>FFmpeg: {ffmpeg}<br>FFprobe: {ffprobe}<p><a href=\"https://github.com/TagStudioDev/TagStudio\">GitHub</a> | <a href=\"https://docs.tagstud.io\">Documentación</a> | <a href=\"https://discord.com/invite/hRNnVKhF2G\">Discord</a></p>",
2+
"about.config_path": "Archivo de configuración",
3+
"about.description": "TagStudio es una aplicación de fotografías y archivos con un sistema de etiquetas subyacentes que se centra en dar libertad y flexibilidad al usuario. Sin programas ni formatos propios, ni un mar de archivos y sin trastornar completamente tu sistema de estructurar los archivos.",
4+
"about.documentation": "Documentación",
5+
"about.license": "Licencia",
36
"about.title": "Acerca de",
47
"app.git": "Git Commit",
58
"app.pre_release": "Previas al lanzamiento",
@@ -116,7 +119,6 @@
116119
"generic.save": "Guardar",
117120
"generic.skip": "Saltear",
118121
"generic.skip_alt": "&Saltear",
119-
"help.visit_github": "Visitar el repositorio en GitHub",
120122
"home.search": "Buscar",
121123
"home.search_entries": "Buscar entradas",
122124
"home.search_library": "Buscar el biblioteca",

src/tagstudio/resources/translations/fil.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
2-
"about.content": "<p>Ang TagStudio ay isang application ng pagsasaayos ng file at larawan na may pinagbabatayan na tag-based na sistema na nakatutok sa pagbibigay ng kalayaan at kakayahang umangkop sa user. Walang mga proprietary na format o program, walang dagat ng mga sidecar file, at walang kaguluhan ng iyong estruktura ng filesystem.</p>Lisensya: GPLv3<br>Path ng config: {config_path}<br>FFMpeg: {ffmpeg}<br>FFProbe: {ffprobe}<p><a href=\"https://github.com/TagStudioDev/TagStudio\">GitHub</a> | <a href=\"https://docs.tagstud.io\">Dokumentasyon</a> | <a href=\"https://discord.gg/invite/hRNnVKhF2G\">Discord</a></p>",
2+
"about.config_path": "Path ng Config",
3+
"about.description": "Ang TagStudio ay isang application ng pagsasaayos ng file at larawan na may pinagbabatayan na tag-based na sistema na nakatutok sa pagbibigay ng kalayaan at kakayahang umangkop sa user. Walang mga proprietary na format o program, walang dagat ng mga sidecar file, at walang kaguluhan ng iyong estruktura ng filesystem.",
4+
"about.documentation": "Dokumentasyon",
5+
"about.license": "Lisensya",
36
"about.title": "Tungkol sa TagStudio",
47
"app.git": "Git Commit",
58
"app.pre_release": "Pre-Release",
@@ -114,7 +117,6 @@
114117
"generic.save": "I-save",
115118
"generic.skip": "Laktawan",
116119
"generic.skip_alt": "&Laktawan",
117-
"help.visit_github": "Bisitahin ang GitHub Repository",
118120
"home.search": "Maghanap",
119121
"home.search_entries": "Mga Entry sa Paghahanap",
120122
"home.search_library": "Maghanap sa Library",

src/tagstudio/resources/translations/fr.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"about.content": "<p>TagStudio est une application d'organisation de photos et de fichiers avec un système de tags qui mets en avant la liberté et flexibilité à l'utilisateur. Pas de programmes ou de formats propriétaires, pas la moindre trace de fichiers secondaires, et pas de bouleversement complet de la structure de votre système de fichiers.</p>License: GPLv3<br>Chemin de configuration: {config_path}<br>FFmpeg: {ffmpeg}<br>FFprobe: {ffprobe}<p><a href=\"https://github.com/TagStudioDev/TagStudio\">GitHub</a> | <a href=\"https://docs.tagstud.io\">Documentation</a> | <a href=\"https://discord.com/invite/hRNnVKhF2G\">Discord</a></p>",
2+
"about.config_path": "Chemin de Configuration",
3+
"about.description": "TagStudio est une application d'organisation de photos et de fichiers avec un système de tags qui mets en avant la liberté et flexibilité à l'utilisateur. Pas de programmes ou de formats propriétaires, pas la moindre trace de fichiers secondaires, et pas de bouleversement complet de la structure de votre système de fichiers.",
34
"about.title": "À propos de TagStudio",
45
"app.git": "Git Commit",
56
"app.pre_release": "Version Préliminaire",
@@ -116,7 +117,6 @@
116117
"generic.save": "Sauvegarder",
117118
"generic.skip": "Passer",
118119
"generic.skip_alt": "&Passer",
119-
"help.visit_github": "Visiter le Dépôt GitHub",
120120
"home.search": "Rechercher",
121121
"home.search_entries": "Recherche",
122122
"home.search_library": "Rechercher dans la Bibliothèque",

0 commit comments

Comments
 (0)