mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-09-29 18:16:43 +00:00
fix: localize empty important package lists
This commit is contained in:
@@ -3517,7 +3517,9 @@ class PollingCollector:
|
|||||||
'security_count': str(len(security_pkgs)),
|
'security_count': str(len(security_pkgs)),
|
||||||
'pve_count': str(len(pve_pkgs)),
|
'pve_count': str(len(pve_pkgs)),
|
||||||
'kernel_count': str(len(kernel_pkgs)),
|
'kernel_count': str(len(kernel_pkgs)),
|
||||||
'important_list': '\n'.join(f' \u2022 {l}' for l in important_lines) if important_lines else 'none',
|
# An empty value is intentionally rendered later by the
|
||||||
|
# notification template as the selected locale's “none”.
|
||||||
|
'important_list': '\n'.join(f' \u2022 {l}' for l in important_lines),
|
||||||
'package_list': ', '.join(important_lines[:6]) if important_lines else '',
|
'package_list': ', '.join(important_lines[:6]) if important_lines else '',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1831,7 +1831,8 @@ def render_template(event_type: str, data: Dict[str, Any],
|
|||||||
variables[f'{_byte_key}_human'] = _format_bytes_human(data[_byte_key])
|
variables[f'{_byte_key}_human'] = _format_bytes_human(data[_byte_key])
|
||||||
|
|
||||||
# Ensure important_list is never blank (fallback to localized "none")
|
# Ensure important_list is never blank (fallback to localized "none")
|
||||||
if not variables.get('important_list', '').strip():
|
important_list = str(variables.get('important_list', '')).strip()
|
||||||
|
if not important_list or important_list.casefold() == 'none':
|
||||||
variables['important_list'] = runtime_message('fallback.none', language)
|
variables['important_list'] = runtime_message('fallback.none', language)
|
||||||
|
|
||||||
# Derive the affected object's display name for titles that use it.
|
# Derive the affected object's display name for titles that use it.
|
||||||
|
|||||||
@@ -189,6 +189,8 @@ class RuntimeCatalogTests(unittest.TestCase):
|
|||||||
self.assertIn("🛡️ Bezpečnostné aktualizácie: 0", enriched_body)
|
self.assertIn("🛡️ Bezpečnostné aktualizácie: 0", enriched_body)
|
||||||
self.assertIn("⚙️ Aktualizácie jadra: 0", enriched_body)
|
self.assertIn("⚙️ Aktualizácie jadra: 0", enriched_body)
|
||||||
self.assertIn("📋 Dôležité balíky:", enriched_body)
|
self.assertIn("📋 Dôležité balíky:", enriched_body)
|
||||||
|
self.assertIn("žiadne", enriched_body)
|
||||||
|
self.assertNotIn("\nnone", enriched_body)
|
||||||
|
|
||||||
for language in self.RUNTIME_LANGUAGES:
|
for language in self.RUNTIME_LANGUAGES:
|
||||||
locale_data = {**data, "_notification_language": language}
|
locale_data = {**data, "_notification_language": language}
|
||||||
|
|||||||
Reference in New Issue
Block a user