From 9b342dc7ed123b166e7e4ff462d62c3ce51377f3 Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 2 Nov 2026 23:09:05 +0300 Subject: [PATCH] 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. --- appsettings/tests/test_appsettings.py | 6 + appsettings/views.py | 24 +- .../templates/instances/nic_qos_form.html | 5 +- instances/views.py | 23 +- locale/tr/LC_MESSAGES/django.po | 354 +++++++++--------- locale/zh/LC_MESSAGES/django.po | 354 +++++++++--------- networks/templates/network.html | 3 +- networks/views.py | 8 +- operations/tests/test_views.py | 12 + operations/utils.py | 3 +- 10 files changed, 412 insertions(+), 380 deletions(-) diff --git a/appsettings/tests/test_appsettings.py b/appsettings/tests/test_appsettings.py index e70a5298..1114dead 100644 --- a/appsettings/tests/test_appsettings.py +++ b/appsettings/tests/test_appsettings.py @@ -30,6 +30,12 @@ class AppSettingsTestCase(TestCase): choice = choice[:choice.index("")] self.assertEqual(re.findall(r'