USe the system locale if the parameter default_language is not set while instanciating Ki18n

This commit is contained in:
2026-11-22 09:46:04 +01:00
parent 0e8875e878
commit f7825e6789
8 changed files with 420 additions and 37 deletions
+9
View File
@@ -20,6 +20,15 @@ ki18n_module = importlib.import_module("ki18n.ki18n")
ENV_VARS = ("LC_ALL", "LC_MESSAGES", "LANG", "LANGUAGE")
# conftest.py replaces ``Ki18n.get_locale`` for all tests; this module tests the
# real implementation, so it is captured at import time and restored per test.
_REAL_GET_LOCALE = Ki18n.__dict__["get_locale"]
@pytest.fixture(autouse=True)
def _real_system_locale(monkeypatch):
monkeypatch.setattr(Ki18n, "get_locale", _REAL_GET_LOCALE)
def set_env(monkeypatch, **variables):
for name, value in variables.items():