mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 04:36:48 +00:00
fix(locale): the VM page's and Settings page's messages show translated
The VM page's and the Settings page's views marked their messages with
gettext_noop, so every message they gave (a refused resize, a saved
setting, a QoS change, a busy VM) showed in English whatever the
language, though the catalogs translate them. They translate in the
request's language now; their module-level texts lazily. The Settings
page's group titles stay English in the view, as the page links them
by their slugs and translates them itself.
Two values went into translated messages as English codes: a job's
state ("... is running on this resource") and a QoS direction ("Remove
the inbound limit ..."). They are named as the pages name them.
This commit is contained in:
parent
763f1525ca
commit
9d57adc097
10 changed files with 412 additions and 380 deletions
|
|
@ -16,6 +16,18 @@ from operations.templatetags.operations import STATE_COLORS, STATE_LABELS, state
|
|||
from operations.tests import fakes
|
||||
|
||||
|
||||
class BusyMessageTestCase(SimpleTestCase):
|
||||
def test_the_state_of_the_job_in_the_way_is_named_in_the_users_language(self):
|
||||
from types import SimpleNamespace
|
||||
|
||||
from operations.utils import busy_message
|
||||
op = Operation(kind="snapshot.create", state=Operation.RUNNING, created_at=django_timezone.now())
|
||||
with translation.override("tr"):
|
||||
text = busy_message(SimpleNamespace(blocker=op), SimpleNamespace(is_superuser=False, pk=1))
|
||||
self.assertIn(" çalışıyor ", text)
|
||||
self.assertNotIn("running", text)
|
||||
|
||||
|
||||
class StateColorsTestCase(SimpleTestCase):
|
||||
def test_every_state_has_its_colour(self):
|
||||
# job_panel.test.js checks the same map in job_panel.js
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue