feat: Add new translation keys and backward-compatible aliases for web source settings
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
This commit is contained in:
parent
3f9fa06fbd
commit
bc6c08b6ea
8 changed files with 238 additions and 1 deletions
|
|
@ -58,3 +58,30 @@ class TestI18n:
|
|||
available = i18n.get_available_languages()
|
||||
assert "en" in available
|
||||
assert "fr" in available
|
||||
|
||||
def test_renamed_settings_keys_fall_back_to_legacy_aliases(self, tmp_path: Path):
|
||||
"""Renamed keys should resolve via alias mapping to existing translations."""
|
||||
translations = tmp_path / "translations"
|
||||
translations.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
(translations / "en.json").write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"settings.log_file.browse_btn": "Browse...",
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
(translations / "de.json").write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"settings.log_file.browse_btn": "Durchsuchen...",
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
i18n._translator = i18n.Translator() # type: ignore[attr-defined]
|
||||
i18n.initialize("de", translations)
|
||||
|
||||
assert i18n.tr("settings.logging.browse_btn") == "Durchsuchen..."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue