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 -8
View File
@@ -4,8 +4,7 @@
import re
import subprocess
from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy
from django.utils.translation import gettext_noop
from plinth import action_utils, app
from plinth.modules.diagnostics.check import DiagnosticCheck, Result
@@ -149,16 +148,13 @@ def diagnose_url(url, kind=None, env=None, check_certificate=True,
except FileNotFoundError:
result = Result.ERROR
parameters = {'url': url}
parameters = {'url': url, 'kind': kind}
if kind:
parameters['kind'] = kind
check_id = f'apache-url-kind-{url}-{kind}'
template = gettext_lazy('Access URL {url} on tcp{kind}')
description = format_lazy(template, url=url, kind=kind)
description = gettext_noop('Access URL {url} on tcp{kind}')
else:
check_id = f'apache-url-{url}'
template = gettext_lazy('Access URL {url}')
description = format_lazy(template, url=url)
description = gettext_noop('Access URL {url}')
return DiagnosticCheck(check_id, description, result, parameters)