diff --git a/.github/scripts/build_translation_cache.py b/.github/scripts/build_translation_cache.py index 047b2b06..4cdddc77 100644 --- a/.github/scripts/build_translation_cache.py +++ b/.github/scripts/build_translation_cache.py @@ -179,15 +179,7 @@ def translate_google_web(text: str, dest_lang: str, context: str, timeout: int) req = Request(url, headers={"User-Agent": "ProxMenux translation cache builder"}) with urlopen(req, timeout=timeout) as response: payload = json.loads(response.read().decode("utf-8")) - parts = [part[0] for part in payload[0] if part and part[0]] - # The endpoint returns one segment per sentence and drops the blank that - # separated them, so joining verbatim glues a period to the next word. - joined = "" - for part in parts: - if joined and joined[-1] in ".?!" and part[:1].isalpha() and part[:1].isupper(): - joined += " " - joined += part - return joined + return "".join(part[0] for part in payload[0] if part and part[0]) def translate_appimage( @@ -277,6 +269,20 @@ def clean_translation(value: str) -> str: return value.strip() +# Lowercase-or-digit, then the mark, then an uppercase letter: that is a +# sentence boundary and not `8.0`, `storage.cfg` or `proxmox.com/docs`. +_SENTENCE_RUN = re.compile( + "(?<=[a-z0-9\u00e0-\u00ff\u0107\u010d\u011b\u013e\u0148\u0159\u0161\u0165\u016f\u017a\u017e])" + "([.?!])" + "(?=[A-Z\u00c0-\u00de\u0106\u010c\u011a\u013d\u0147\u0158\u0160\u0164\u016e\u0179\u017d])" +) + + +def restore_sentence_spacing(text: str) -> str: + """Every provider drops the blank between sentences it translated apart.""" + return _SENTENCE_RUN.sub(r"\1 ", text) + + def translate_text( text: str, dest_lang: str, @@ -297,7 +303,7 @@ def translate_text( else: raise ValueError(f"Unknown provider: {provider}") translated = restore_technical_terms(clean_translation(translated), protected_terms) - return translated or text + return restore_sentence_spacing(translated) if translated else text def load_language_cache(path: Path) -> dict[str, str]: diff --git a/lang/de.json b/lang/de.json index c300f7d2..b56f5710 100644 --- a/lang/de.json +++ b/lang/de.json @@ -4587,9 +4587,9 @@ "Unable to detect Proxmox version": "Proxmox-Version konnte nicht erkannt werden", "Unable to detect Proxmox version.": "Proxmox-Version kann nicht erkannt werden.", "Unable to determine the installed memory.": "Der installierte Speicher kann nicht ermittelt werden.", - "Unable to identify the root filesystem. Aborting.": "Das Root-Dateisystem konnte nicht identifiziert werden.Abbruch.", - "Unable to resolve system ZFS pool disks. Aborting.": "System-Pool-Festplatten ZFS können nicht aufgelöst werden.Abbruch.", - "Unable to resolve system disk topology. Aborting.": "Die Topologie der Systemfestplatte kann nicht aufgelöst werden.Abbruch.", + "Unable to identify the root filesystem. Aborting.": "Das Root-Dateisystem konnte nicht identifiziert werden. Abbruch.", + "Unable to resolve system ZFS pool disks. Aborting.": "System-Pool-Festplatten ZFS können nicht aufgelöst werden. Abbruch.", + "Unable to resolve system disk topology. Aborting.": "Die Topologie der Systemfestplatte kann nicht aufgelöst werden. Abbruch.", "Understand the security implications of privileged containers": "Verstehen Sie die Sicherheitsauswirkungen privilegierter Container", "Uninstall Coral drivers and configuration": "Deinstallieren Sie Coral-Treiber und -Konfiguration", "Uninstall Fail2Ban": "Deinstallieren Sie Fail2Ban", diff --git a/lang/es.json b/lang/es.json index 482a9831..81cfab79 100644 --- a/lang/es.json +++ b/lang/es.json @@ -4587,9 +4587,9 @@ "Unable to detect Proxmox version": "No se puede detectar la versión de Proxmox", "Unable to detect Proxmox version.": "No se puede detectar la versión de Proxmox.", "Unable to determine the installed memory.": "No se puede determinar la memoria instalada.", - "Unable to identify the root filesystem. Aborting.": "No se puede identificar el sistema de archivos raíz.Abortando.", - "Unable to resolve system ZFS pool disks. Aborting.": "No se pueden resolver los discos del grupo ZFS del sistema.Abortando.", - "Unable to resolve system disk topology. Aborting.": "No se puede resolver la topología del disco del sistema.Abortando.", + "Unable to identify the root filesystem. Aborting.": "No se pudo identificar el sistema de archivos raíz. Se cancela.", + "Unable to resolve system ZFS pool disks. Aborting.": "No se pudieron resolver los discos del pool ZFS del sistema. Se cancela.", + "Unable to resolve system disk topology. Aborting.": "No se pudo resolver la topología de discos del sistema. Se cancela.", "Understand the security implications of privileged containers": "Comprender las implicaciones de seguridad de los contenedores privilegiados", "Uninstall Coral drivers and configuration": "Desinstalar los controladores y la configuración de Coral", "Uninstall Fail2Ban": "Desinstalar Fail2Ban", diff --git a/lang/fr.json b/lang/fr.json index dfa63ba8..7afb930f 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -4587,9 +4587,9 @@ "Unable to detect Proxmox version": "Impossible de détecter la version de Proxmox", "Unable to detect Proxmox version.": "Impossible de détecter la version de Proxmox.", "Unable to determine the installed memory.": "Impossible de déterminer la mémoire installée.", - "Unable to identify the root filesystem. Aborting.": "Impossible d'identifier le système de fichiers racine.Avorter.", + "Unable to identify the root filesystem. Aborting.": "Impossible d'identifier le système de fichiers racine. Avorter.", "Unable to resolve system ZFS pool disks. Aborting.": "Impossible de résoudre les disques du pool système ZFS.Avorter.", - "Unable to resolve system disk topology. Aborting.": "Impossible de résoudre la topologie du disque système.Avorter.", + "Unable to resolve system disk topology. Aborting.": "Impossible de résoudre la topologie du disque système. Avorter.", "Understand the security implications of privileged containers": "Comprendre les implications de sécurité des conteneurs privilégiés", "Uninstall Coral drivers and configuration": "Désinstaller les pilotes et la configuration Coral", "Uninstall Fail2Ban": "Désinstaller Fail2Ban", diff --git a/lang/it.json b/lang/it.json index 14fcfee1..1a02ddf8 100644 --- a/lang/it.json +++ b/lang/it.json @@ -4587,9 +4587,9 @@ "Unable to detect Proxmox version": "impossibile rilevare la versione di Proxmox", "Unable to detect Proxmox version.": "Impossibile rilevare la versione di Proxmox.", "Unable to determine the installed memory.": "impossibile determinare la memoria installata.", - "Unable to identify the root filesystem. Aborting.": "impossibile identificare il filesystem root.Interruzione.", + "Unable to identify the root filesystem. Aborting.": "impossibile identificare il filesystem root. Interruzione.", "Unable to resolve system ZFS pool disks. Aborting.": "Messaggio tecnico per Proxmox e IT.Traduzione: impossibile risolvere i dischi del pool di sistema ZFS.Interruzione.", - "Unable to resolve system disk topology. Aborting.": "impossibile risolvere la topologia del disco di sistema.Interruzione.", + "Unable to resolve system disk topology. Aborting.": "impossibile risolvere la topologia del disco di sistema. Interruzione.", "Understand the security implications of privileged containers": "Comprendere le implicazioni sulla sicurezza dei contenitori privilegiati", "Uninstall Coral drivers and configuration": "Disinstallare i driver e la configurazione Coral", "Uninstall Fail2Ban": "Disinstallare Fail2Ban", diff --git a/lang/pt.json b/lang/pt.json index 9f06697a..1ce15793 100644 --- a/lang/pt.json +++ b/lang/pt.json @@ -4587,9 +4587,9 @@ "Unable to detect Proxmox version": "Não foi possível detectar a versão do Proxmox", "Unable to detect Proxmox version.": "Não foi possível detectar a versão do Proxmox.", "Unable to determine the installed memory.": "Não é possível determinar a memória instalada.", - "Unable to identify the root filesystem. Aborting.": "Não foi possível identificar o sistema de arquivos raiz.Abortando.", - "Unable to resolve system ZFS pool disks. Aborting.": "Não foi possível resolver os discos do pool ZFS do sistema.Abortando.", - "Unable to resolve system disk topology. Aborting.": "Não é possível resolver a topologia do disco do sistema.Abortando.", + "Unable to identify the root filesystem. Aborting.": "Não foi possível identificar o sistema de arquivos raiz. Abortando.", + "Unable to resolve system ZFS pool disks. Aborting.": "Não foi possível resolver os discos do pool ZFS do sistema. Abortando.", + "Unable to resolve system disk topology. Aborting.": "Não é possível resolver a topologia do disco do sistema. Abortando.", "Understand the security implications of privileged containers": "Entenda as implicações de segurança de contêineres privilegiados", "Uninstall Coral drivers and configuration": "Desinstale os drivers e configuração do Coral", "Uninstall Fail2Ban": "Desinstalar Fail2Ban", diff --git a/lang/sk.json b/lang/sk.json index ed9b2ee7..27502225 100644 --- a/lang/sk.json +++ b/lang/sk.json @@ -4587,9 +4587,9 @@ "Unable to detect Proxmox version": "Nepodarilo sa zistiť verziu Proxmoxu", "Unable to detect Proxmox version.": "Nepodarilo sa zistiť verziu Proxmoxu.", "Unable to determine the installed memory.": "Nainštalovanú pamäť sa nepodarilo zistiť.", - "Unable to identify the root filesystem. Aborting.": "Nepodarilo sa identifikovať koreňový súborový systém.Prerušuje sa.", - "Unable to resolve system ZFS pool disks. Aborting.": "Nepodarilo sa vyriešiť systémové disky ZFS fondu.Prerušuje sa.", - "Unable to resolve system disk topology. Aborting.": "Nepodarilo sa vyriešiť topológiu systémového disku.Prerušuje sa.", + "Unable to identify the root filesystem. Aborting.": "Nepodarilo sa identifikovať koreňový súborový systém. Prerušuje sa.", + "Unable to resolve system ZFS pool disks. Aborting.": "Nepodarilo sa vyriešiť systémové disky ZFS fondu. Prerušuje sa.", + "Unable to resolve system disk topology. Aborting.": "Nepodarilo sa vyriešiť topológiu systémového disku. Prerušuje sa.", "Understand the security implications of privileged containers": "Uistite sa, že rozumiete bezpečnostným dôsledkom privilegovaných kontajnerov", "Uninstall Coral drivers and configuration": "Odinštalovať ovládače a nastavenie Coral", "Uninstall Fail2Ban": "Odinštalovať Fail2Ban", diff --git a/lang/sv.json b/lang/sv.json index 294c4410..5178f6b7 100644 --- a/lang/sv.json +++ b/lang/sv.json @@ -4587,9 +4587,9 @@ "Unable to detect Proxmox version": "Det gick inte att upptäcka Proxmox-versionen", "Unable to detect Proxmox version.": "Det gick inte att upptäcka Proxmox-versionen.", "Unable to determine the installed memory.": "Det går inte att fastställa det installerade minnet.", - "Unable to identify the root filesystem. Aborting.": "Det går inte att identifiera rotfilsystemet.Avbryter.", - "Unable to resolve system ZFS pool disks. Aborting.": "Det går inte att lösa system ZFS pooldiskar.Avbryter.", - "Unable to resolve system disk topology. Aborting.": "Det gick inte att lösa systemdisktopologin.Avbryter.", + "Unable to identify the root filesystem. Aborting.": "Det går inte att identifiera rotfilsystemet. Avbryter.", + "Unable to resolve system ZFS pool disks. Aborting.": "Det går inte att lösa system ZFS pooldiskar. Avbryter.", + "Unable to resolve system disk topology. Aborting.": "Det gick inte att lösa systemdisktopologin. Avbryter.", "Understand the security implications of privileged containers": "Förstå säkerhetskonsekvenserna av privilegierade containrar", "Uninstall Coral drivers and configuration": "Avinstallera Coral drivrutiner och konfiguration", "Uninstall Fail2Ban": "Avinstallera Fail2Ban",