from __future__ import annotations from ...types import make_issue from .patterns import PLACEHOLDER_VALUES from .language import detect_language_mismatch FORM_FIELDS = {"label", "placeholder", "help_text"} def validate_form_copy(locale_code: str, field_path: str, normalized: str): last_segment = field_path.split(".")[-1] if last_segment not in FORM_FIELDS: return [] issues = [] if normalized in PLACEHOLDER_VALUES or normalized == "": issues.append(make_issue("empty_form_copy", field_path, normalized)) mismatch = detect_language_mismatch(locale_code, normalized) if mismatch: issues.append(make_issue("form_language_mismatch", field_path, mismatch["message"])) return issues