replace string in advanced_settings_frame for translate

This commit is contained in:
2025-08-24 12:28:42 +02:00
parent 54ee969349
commit fe3003ffdc
4 changed files with 21 additions and 14 deletions

View File

@@ -151,6 +151,7 @@ class Msg:
"cancel": _("Cancel"),
"yes": _("Yes"),
"no": _("No"),
"apply": _("Apply"),
"source": _("Source"),
"destination": _("Destination"),
"system_backup_info": _("System Backup"),
@@ -167,6 +168,12 @@ class Msg:
"ready_for_first_backup": _("Everything is ready for your first backup."),
"backup_mode_info": _("Backup Mode: You can start a backup here."),
"restore_mode_info": _("Restore Mode: You can start a restore here."),
"advanced_settings_title": _("Advanced Settings"),
"advanced_settings_warning": _("WARNING: Changing these settings is recommended for experienced users only. Incorrect configurations can lead to an unreliable backup.\n\nThe backup destination is always excluded for security reasons and cannot be changed here."),
"exclude_system_folders": _("Exclude system folders"),
"in_backup": _("In Backup"),
"name": _("Name"),
"path": _("Path"),
# Menus
"file_menu": _("File"),
@@ -224,4 +231,4 @@ class Msg:
"projected_usage_label": _("Projected usage after backup"),
"header_title": _("Lx Tools Py-Backup"),
"header_subtitle": _("Simple GUI for rsync"),
}
}

View File

@@ -4,30 +4,30 @@ import os
from pathlib import Path
import fnmatch
from app_config import AppConfig
from app_config import AppConfig, Msg
class AdvancedSettingsFrame(tk.Toplevel):
def __init__(self, master, **kwargs):
super().__init__(master, **kwargs)
self.title("Erweiterte Einstellungen")
self.title(Msg.STR["advanced_settings_title"])
self.geometry("800x600")
self.app_config = AppConfig()
# --- Warning Label ---
warning_label = ttk.Label(self, text="WARNUNG: Das Ändern dieser Einstellungen wird nur für erfahrene Benutzer empfohlen. Falsche Konfigurationen können zu einem unzuverlässigen Backup führen.\n\nDas Backup-Ziel ist aus Sicherheitsgründen immer ausgeschlossen und kann hier nicht geändert werden.", wraplength=780, justify="center")
warning_label = ttk.Label(self, text=Msg.STR["advanced_settings_warning"], wraplength=780, justify="center")
warning_label.pack(pady=10)
# --- Treeview for system folder exclusion ---
self.tree_frame = ttk.LabelFrame(self, text="Systemordner ausschließen", padding=10)
self.tree_frame = ttk.LabelFrame(self, text=Msg.STR["exclude_system_folders"], padding=10)
self.tree_frame.pack(fill=tk.BOTH, expand=True, padx=10, pady=10)
columns = ("included", "name", "path")
self.tree = ttk.Treeview(self.tree_frame, columns=columns, show="headings")
self.tree.heading("included", text="Im Backup")
self.tree.heading("name", text="Name")
self.tree.heading("path", text="Pfad")
self.tree.heading("included", text=Msg.STR["in_backup"])
self.tree.heading("name", text=Msg.STR["name"])
self.tree.heading("path", text=Msg.STR["path"])
self.tree.column("included", width=100, anchor="center")
self.tree.pack(fill=tk.BOTH, expand=True, padx=5, pady=5)
@@ -37,8 +37,8 @@ class AdvancedSettingsFrame(tk.Toplevel):
button_frame = ttk.Frame(self)
button_frame.pack(pady=10)
ttk.Button(button_frame, text="Anwenden", command=self._apply_changes).pack(side=tk.LEFT, padx=5)
ttk.Button(button_frame, text="Abbrechen", command=self.destroy).pack(side=tk.LEFT, padx=5)
ttk.Button(button_frame, text=Msg.STR["apply"], command=self._apply_changes).pack(side=tk.LEFT, padx=5)
ttk.Button(button_frame, text=Msg.STR["cancel"], command=self.destroy).pack(side=tk.LEFT, padx=5)
self._load_system_folders()
@@ -70,7 +70,7 @@ class AdvancedSettingsFrame(tk.Toplevel):
continue # Skip always excluded items
is_user_excluded = f"{item_path_str}/*" in user_patterns
included_text = "Nein" if is_user_excluded else "Ja"
included_text = Msg.STR["no"] if is_user_excluded else Msg.STR["yes"]
items_to_display[item_path_str] = (included_text, item.name, item_path_str)
# Explicitly add or update the backup destination's root
@@ -80,7 +80,7 @@ class AdvancedSettingsFrame(tk.Toplevel):
backup_root_path_str = str(backup_root_path.absolute())
# Set the backup destination to be always excluded
items_to_display[backup_root_path_str] = ("Nein", backup_root_path.name, backup_root_path_str)
items_to_display[backup_root_path_str] = (Msg.STR["no"], backup_root_path.name, backup_root_path_str)
# Insert items into the treeview
for item_path_str in sorted(items_to_display.keys()):
@@ -100,7 +100,7 @@ class AdvancedSettingsFrame(tk.Toplevel):
current_values = self.tree.item(item_id, 'values')
current_status = current_values[0]
new_status = "Ja" if current_status == "Nein" else "Nein"
new_status = Msg.STR["yes"] if current_status == Msg.STR["no"] else Msg.STR["no"]
self.tree.item(item_id, values=(new_status, current_values[1], current_values[2]))
@@ -115,7 +115,7 @@ class AdvancedSettingsFrame(tk.Toplevel):
new_excludes = []
for item_id in self.tree.get_children():
values = self.tree.item(item_id, 'values')
if values[0] == "Nein":
if values[0] == Msg.STR["no"]:
path = values[2]
if os.path.isdir(path):
new_excludes.append(f"{path}/*")