Files
mattermost/.github/workflows
46ed11842e Stricter i18n catalog checkers (#39275)
* Fail an empty translation even under the warn-missing flags

CI runs both checkers with --warn-missing-keys / --warn-missing-ids so a
catalog can lag en.json. That was also downgrading an empty value to a
warning, so a "" placeholder left in a catalog would merge. An absent key
is work in progress; an empty one is a leftover placeholder, and now always
fails.

* Check each webapp catalog's formatting

A hand edit that reindents or reorders a catalog buries its one real change
in a diff of thousands of lines, and nothing caught it. check_icu.mjs now
requires each catalog to be its own canonical serialization: keys in
code-point order, which every webapp catalog already has, a 2-space indent
and a trailing newline. A duplicate key fails too, since JSON.parse keeps
only the last one.

Co-authored-by: Jesse Hallam <lieut-data@users.noreply.github.com>

* Check each server catalog's formatting

A hand edit that reindents a catalog buries its one real change in a diff
of thousands of lines, and nothing caught it. mmgotool i18n verify now
requires each catalog to be its own canonical serialization: a 2-space
indent and a trailing newline. The server catalogs have no order, so entry
order is left alone. A duplicate id fails, which the loader silently
collapses.

Co-authored-by: Jesse Hallam <lieut-data@users.noreply.github.com>

* Warn about horizontal arrows in right-to-left locales

Arrows are not bidi-mirrored, so in a sentence read right to left an arrow
meaning "next" or "leads to" points backwards, and nothing checked for it.
check_icu.mjs now warns when a right-to-left locale's translation contains
a horizontal arrow or pointer. The locale's direction comes from Intl, so
no locale is listed by hand. Vertical arrows and the ↵ key symbol read the
same either way and are not flagged.

* Warn about horizontal arrows in right-to-left server catalogs too

check_icu.mjs warns when a right-to-left locale uses an arrow that is not
bidi-mirrored. mmgotool i18n verify now does as well, for single and plural
translations. It reports the one such string fa.json ships today.

Co-authored-by: Jesse Hallam <lieut-data@users.noreply.github.com>

* Stop using -- as a dash in the checkers' comments

Both checkers take --flags, and a -- dash beside them reads as one.

* Move check_icu.mjs's per-message rules into icu_rules.mjs

check_icu.mjs held the file-level checks and the per-message ICU rules in
one script, so nothing else could run exactly the rules CI runs. The
per-message rules now live in icu_rules.mjs: analyzeSource parses an
en.json message once, and checkMessage returns each finding with a stable
rule id and a severity. check_icu.mjs keeps the file-level checks and
reports each finding as before.

The output over the shipped catalogs is byte-identical before and after,
with and without --warn-missing-keys. The i18n CI workflow now also runs
when icu_rules.mjs changes.

Co-authored-by: Jesse Hallam <lieut-data@users.noreply.github.com>

* Warn about plurals missing a form their locale needs

A plural that shows its count but lacks a form its locale needs for some
integer renders that count with "other": Russian ships "5 каналы" where it
should say "5 каналов". check_icu.mjs now warns about it.

Explicit =N arms count as covering N. Forms that only fractions or numbers
in the millions select are not required. A source plural that itself
leaves out a form English needs is not held against the translations that
copy it. When two plurals on one variable fail the same way, the finding is
reported once.

It is a warning because 370 shipped strings have the problem, nearly all
in pl, cs, uk, ru, lt and ro.

Co-authored-by: Jesse Hallam <lieut-data@users.noreply.github.com>

* Show "this user" for one user in two zh-CN removal prompts

Chinese never selects the plural category one, so the one {这位用户}
arm was dead and a single user read as 这些用户 (these users). =1
selects exactly one.

Co-authored-by: Jesse Hallam <lieut-data@users.noreply.github.com>

---------

Co-authored-by: Jesse Hallam <lieut-data@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-20 15:28:29 -04:00
..