diagnostics: Translate descriptions only in view

Tests:

- Enable all apps, and run diagnostics. Diagnostic descriptions are formatted
  as expected.

- Change the language to Spanish, and view the diagnostic results. Diagnostic
  descriptions are translated as expected.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy authored and Sunil Mohan Adapa committed 2024-01-18 22:19:05 -08:00
1 parent a5820bc36d
commit 3fcd6b9e58
18 files changed
+101 -89

No files matched your search

+4 -6
View File
@@ -7,6 +7,7 @@ import subprocess
import augeas
from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy as _
from django.utils.translation import gettext_noop
from plinth import app as app_module
from plinth import cfg, menu
@@ -123,8 +124,7 @@ def _diagnose_ldap_entry(search_item):
except subprocess.CalledProcessError:
pass
template = _('Check LDAP entry "{search_item}"')
description = format_lazy(template, search_item=search_item)
description = gettext_noop('Check LDAP entry "{search_item}"')
parameters = {'search_item': search_item}
return DiagnosticCheck(check_id, description, result, parameters)
@@ -138,8 +138,7 @@ def _diagnose_nslcd_config(config, key, value):
except KeyError:
result = Result.FAILED
template = _('Check nslcd config "{key} {value}"')
description = format_lazy(template, key=key, value=value)
description = gettext_noop('Check nslcd config "{key} {value}"')
parameters = {'key': key, 'value': value}
return DiagnosticCheck(check_id, description, result, parameters)
@@ -169,8 +168,7 @@ def _diagnose_nsswitch_config():
break
template = _('Check nsswitch config "{database}"')
description = format_lazy(template, database=database)
description = gettext_noop('Check nsswitch config "{database}"')
parameters = {'database': database}
results.append(