from app.i18n import t def test_known_key_is_translated(): assert t("health.ok") == "Service opérationnel" def test_unknown_key_returns_key(): assert t("does.not.exist") == "does.not.exist" def test_params_are_interpolated(tmp_path, monkeypatch): # Vérifie le mécanisme d'interpolation sans dépendre du catalogue réel. from app import i18n i18n._catalog.cache_clear() monkeypatch.setattr( i18n, "_catalog", lambda locale: {"greet": "Bonjour {name}"} ) assert i18n.t("greet", name="Festival") == "Bonjour Festival"