From 7a3c649fb49c5ddd34dbc807b3081ea85404e88b Mon Sep 17 00:00:00 2001 From: Mandel Olaiya Date: Sun, 3 May 2026 00:57:21 +0200 Subject: [PATCH] ci: only block on configured i18n locales --- scripts/multilingual_audit_ci.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/scripts/multilingual_audit_ci.py b/scripts/multilingual_audit_ci.py index 932bfc7..7ea0fff 100755 --- a/scripts/multilingual_audit_ci.py +++ b/scripts/multilingual_audit_ci.py @@ -51,12 +51,44 @@ def _cta_issue_is_allowed_now(locale: str, issue: dict) -> bool: return issue.get("severity") == "block" and issue.get("issue_type") == "cta_language_mismatch" +def enabled_locales_from_config() -> set[str] | None: + """ + If the project config declares a limited set of i18n languages, use it to + scope CI blocking checks. + """ + + config_path = PROJECT_ROOT / "mandelstudio" / "ocyan.json" + if not config_path.exists(): + return None + + try: + payload = load_json(config_path) + except Exception: + return None + + languages = ( + (payload.get("settings") or {}) + .get("i18n", {}) + .get("languages") + ) + if not languages or not isinstance(languages, list): + return None + + enabled = {str(code).split("-")[0] for code in languages if code} + return enabled or None + + def effective_block_count(payload: dict) -> tuple[int, int]: """Return (effective_block, ignored_block) after applying allowlists.""" + enabled_locales = enabled_locales_from_config() ignored = 0 block = 0 issues = payload.get("issues") or {} for locale, data in locale_rows(payload): + if enabled_locales is not None and locale not in enabled_locales: + locale_issues = issues.get(locale) or [] + ignored += sum(int(issue.get("count") or 1) for issue in locale_issues if issue.get("severity") == "block") + continue locale_issues = issues.get(locale) or [] for issue in locale_issues: if issue.get("severity") != "block":