diff --git a/lang/sk.json b/lang/sk.json index fde9b4e5..fbee9989 100644 --- a/lang/sk.json +++ b/lang/sk.json @@ -1103,7 +1103,7 @@ "Container:": "Kontajner:", "Containers & Docker": "Kontajnery a Docker", "Containers returned to their previous state": "Kontajnery sa vrátili do predchádzajúceho stavu", - "Containers that are removed:": "Nádoby, ktoré sú odstránené:", + "Containers that are removed:": "Kontajnery, ktoré sa odstránia:", "Containers that will be created (one LXC per service, on a private network):": "Kontajnery, ktoré budú vytvorené (jeden LXC na službu, na súkromnej sieti):", "Containers that will receive this device": "Kontajnery, ktoré dostanú toto zariadenie", "Containers that will receive this path": "Kontajnery, ktoré dostanú túto cestu", @@ -5552,7 +5552,7 @@ "Stale VFIO Config Detected": "Zistila sa zastaraná konfigurácia VFIO", "Stale VFIO entries removed and initramfs rebuilt.": "Zastarané záznamy VFIO boli odstránené a initramfs prestavané.", "Standard NAS (backup, iso, vztmpl)": "Štandardné NAS (backup, iso, vztmpl)", - "Start": "Začiatok", + "Start": "Spustenie", "Start VM": "Spustiť VM", "Start VM after creation": "Spustiť VM po vytvorení", "Start VM after creation?": "Spustiť VM po vytvorení?", @@ -5578,8 +5578,8 @@ "Start the stack with Proxmox": "Spustiť zásobník s Proxmox", "Start uploading to PBS — sets a recovery passphrase": "Spustiť nahrávanie do PBS - nastaví obnovovaciu frázu", "Start when finished": "Spustiť po dokončení", - "Start with Proxmox": "Začnite s Proxmox", - "Starting": "Začiatok", + "Start with Proxmox": "Spúšťať spolu so spustením Proxmoxu", + "Starting": "Spúšťanie", "Starting Borg backup...": "Spúšťam Borg zálohu...", "Starting CT": "Spúšťam CT", "Starting LXC Privileged to Unprivileged conversion process...": "Spúšťam prevod LXC z privilegovaného na neprivilegovaný...", @@ -5879,7 +5879,7 @@ "The application did not pass its HTTP check:": "Aplikácia neprešla kontrolou HTTP:", "The application did not respond in time:": "Žiadosť neodpovedala včas:", "The application stopped during its first start:": "Aplikácia sa zastavila počas prvého začiatku:", - "The application was removed": "Žiadosť bola stiahnutá", + "The application was removed": "Aplikácia bola odstránená", "The archive could not be extracted.": "Archív sa nepodarilo rozbaliť.", "The archive destination directory is INSIDE one of the paths you are about to back up. Writing the archive there would copy the backup into itself — producing a corrupted archive, or growing without limit until the disk fills up.": "Cieľový priečinok archívu je VNÚTRI jednej z ciest, ktoré sa chystáte zálohovať. Zápis archívu na toto miesto by zálohu kopíroval samu do seba - vznikol by poškodený archív alebo by rástol, kým sa disk nezaplní.", "The backup could not be identified; the image is not replaced": "Zálohovanie nebolo možné identifikovať; obrázok nie je nahradený", diff --git a/oci/src/proxmenux_oci/console.py b/oci/src/proxmenux_oci/console.py index f58a43c4..b577a1a9 100644 --- a/oci/src/proxmenux_oci/console.py +++ b/oci/src/proxmenux_oci/console.py @@ -8,7 +8,7 @@ import sys import textwrap import threading -from .i18n import BASE_DIR +from .i18n import BASE_DIR, translate MG = "\033[1;35m" GN = "\033[1;92m" @@ -101,6 +101,7 @@ def ask_yes_no(text: str, default_yes: bool = True) -> bool: width = 74 lines = sum(max(1, len(textwrap.wrap(line, width - 6) or [''])) for line in text.splitlines() or ['']) widget = ['whiptail', '--backtitle', 'ProxMenux', '--title', 'ProxMenux', + '--yes-button', translate('Yes'), '--no-button', translate('No'), '--yesno', text, str(min(lines + 8, 20)), str(width)] if not default_yes: widget.insert(1, '--defaultno') diff --git a/oci/src/proxmenux_oci/ui.py b/oci/src/proxmenux_oci/ui.py index 2266b0a8..7e55b8c1 100644 --- a/oci/src/proxmenux_oci/ui.py +++ b/oci/src/proxmenux_oci/ui.py @@ -192,9 +192,10 @@ class DialogUI: # dialog draws on the terminal and writes the selection to stderr. back_widget = ['--extra-button', '--extra-label', translate('Back')] if self.back_enabled and any( flag in widget for flag in ('--inputbox', '--passwordbox', '--yesno', '--menu', '--checklist')) else [] + confirmation_labels = ['--yes-label', translate('Yes'), '--no-label', translate('No')] if '--yesno' in widget else [] result = subprocess.run( ["dialog", "--no-collapse", "--cancel-label", translate('Cancel'), "--backtitle", self.backtitle, "--title", title or self.title, - *back_widget, *widget], + *confirmation_labels, *back_widget, *widget], stdout=None, stderr=subprocess.PIPE, text=True, check=False, env=environment, ) if result.returncode == 3 and back_widget: diff --git a/oci/tests/test_confirmation_labels.py b/oci/tests/test_confirmation_labels.py new file mode 100644 index 00000000..5a39f36f --- /dev/null +++ b/oci/tests/test_confirmation_labels.py @@ -0,0 +1,36 @@ +"""OCI confirmation buttons use the active language catalog.""" +from pathlib import Path +import sys +import unittest +from subprocess import CompletedProcess +from unittest.mock import patch + + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / "src")) + +from proxmenux_oci import console +from proxmenux_oci.ui import DialogUI + + +def slovak(text: str) -> str: + return {"Yes": "Áno", "No": "Nie", "Cancel": "Zrušiť"}.get(text, text) + + +class ConfirmationLabelTests(unittest.TestCase): + def test_dialog_confirmation_uses_translated_yes_and_no_labels(self): + with patch("proxmenux_oci.ui.translate", side_effect=slovak): + with patch("proxmenux_oci.ui.subprocess.run", return_value=CompletedProcess([], 0, "", "")) as run: + DialogUI().confirm("Continue?") + command = run.call_args.args[0] + self.assertEqual(command[command.index("--yes-label") + 1], "Áno") + self.assertEqual(command[command.index("--no-label") + 1], "Nie") + + def test_console_confirmation_uses_translated_yes_and_no_labels(self): + with patch("proxmenux_oci.console.translate", side_effect=slovak): + with patch("proxmenux_oci.console.shutil.which", return_value="/usr/bin/whiptail"): + with patch("proxmenux_oci.console.subprocess.run", return_value=CompletedProcess([], 0)) as run: + self.assertTrue(console.ask_yes_no("Continue?")) + command = run.call_args.args[0] + self.assertEqual(command[command.index("--yes-button") + 1], "Áno") + self.assertEqual(command[command.index("--no-button") + 1], "Nie") diff --git a/oci/tests/test_slovak_oci_wording.py b/oci/tests/test_slovak_oci_wording.py new file mode 100644 index 00000000..9b88a75a --- /dev/null +++ b/oci/tests/test_slovak_oci_wording.py @@ -0,0 +1,22 @@ +"""Regression checks for the Slovak wording in the OCI Manager journey.""" +import json +from pathlib import Path +import unittest + + +ROOT = Path(__file__).resolve().parents[2] +SLOVAK = ROOT / "lang" / "sk.json" + + +class SlovakOCIWordingTests(unittest.TestCase): + def test_wizard_and_removal_copy_is_clear(self): + text = json.loads(SLOVAK.read_text(encoding="utf-8")) + self.assertEqual(text["Start with Proxmox"], "Spúšťať spolu so spustením Proxmoxu") + self.assertEqual(text["Start"], "Spustenie") + self.assertEqual(text["Starting"], "Spúšťanie") + self.assertEqual(text["Containers that are removed:"], "Kontajnery, ktoré sa odstránia:") + self.assertEqual(text["The application was removed"], "Aplikácia bola odstránená") + + +if __name__ == "__main__": + unittest.main()