Skip to content

Warn on region mismatch between filename locale and target-language #122

@konradmichalik

Description

@konradmichalik

Follow-up to #119.

The XLIFF target-language check currently normalizes both the filename locale and the target-language / trgLang attribute to the base language before comparison. That is intentional and pragmatic, but it silently accepts region-level inconsistencies:

Filename XLIFF attribute Current Desired
de_DE.locallang.xlf target-language="de-AT" OK WARNING
messages.de_DE.xlf trgLang="de-AT" OK WARNING

Proposal

  • Keep base-language mismatches as ERROR (current behavior).
  • Emit a WARNING when the base language matches but regions differ.
  • Lift the locale parse/compare into a small LocaleUtility so other validators can reuse it (suggested by @maikschneider in Validate target-language in XLF files #119).

Out of scope

  • Validating that the region itself is meaningful (e.g. de-XX is not a real region). BCP 47 conformance can be a separate ticket if it ever becomes relevant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions