diagnostics: Lazy format all diagnostic test strings properly

Helps: #1938.

Fixed application of available translations in daemon.py and apache,
diagnostics, networks, firewall and users modules.

diagnostics:
- __init__.py: return the app name along its results.
- diagnostics.html: display the app name instead of its id.
- diagnostics_results.html:
  - mark for translation,
  - apply class to results <td> HTML tag.

main.css: center-align the results.

Locale files excluded. Will be regenerated automatically and translations to be
done via Weblate.

original testing (rebased later):
- Yapf applied.
- Flake8 without errors or warnings for changed files.
- (Unit) tests run without errors.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Translate 'None' app name]
[sunil: Don't translate tests strings second time in template]
[sunil: Tweak the center rule]
[sunil: Don't split a translation string]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Fioddor Superconcentrado authored and Sunil Mohan Adapa committed 2020-10-13 15:43:44 -07:00
1 parent f1f84a2509
commit 633f54b75c
9 files changed
+62 -40

No files matched your search

+10 -6
View File
@@ -6,13 +6,15 @@ App component for other apps to use Apache configuration functionality.
import re
import subprocess
from django.utils.translation import ugettext as _
from django.utils.text import format_lazy
from django.utils.translation import ugettext_lazy
from plinth import action_utils, actions, app
class Webserver(app.LeaderComponent):
"""Component to enable/disable Apache configuration."""
def __init__(self, component_id, web_name, kind='config', urls=None):
"""Initialize the web server component.
@@ -71,6 +73,7 @@ class Webserver(app.LeaderComponent):
class Uwsgi(app.LeaderComponent):
"""Component to enable/disable uWSGI configuration."""
def __init__(self, component_id, uwsgi_name):
"""Initialize the uWSGI component.
@@ -116,12 +119,13 @@ def diagnose_url(url, kind=None, env=None, check_certificate=True,
wrapper, expected_output)
if kind:
return [
_('Access URL {url} on tcp{kind}').format(url=url, kind=kind),
result
]
template = ugettext_lazy('Access URL {url} on tcp{kind}')
testname = format_lazy(template, url=url, kind=kind)
else:
template = ugettext_lazy('Access URL {url}')
testname = format_lazy(template, url=url)
return [_('Access URL {url}').format(url=url), result]
return [testname, result]
def diagnose_url_on_all(url, **kwargs):