Files
Teffen Ellis edee3e0c22 web: recover stranded Transifex translations into canonical xliff files (#26735)
* web: recover stranded Transifex translations into canonical xliff files

Transifex writes web/xliff/<lang>.xlf with underscore codes (cs_CZ.xlf),
but lit-localize only reads the hyphenated files named in targetLocales.
Translator work landing in the underscore files never shipped.

Fold each underscore file into its canonical sibling, following the
#24563 recovery rule: a stranded target wins over the existing one. A
donor target is only taken when its <source> matches the canonical
source and its placeholder ids match; placeholders are rewritten from the
canonical source so equiv-text stays current.

- In-tree duplicates: cs_CZ, de_DE, fi_FI, fr_FR, it_IT, ja_JP, pt_BR,
  bg_BG, pl_PL, plus ar_AA -> ar and no_NO -> nb-NO.
- Files deleted by #24024, recovered from 1dc509dca^: es_ES, ko_KR,
  ru_RU, tr_TR (and the older cs/de/fi/fr/it/ja/pt_BR copies as a
  lower-priority donor).

2,478 targets filled and 167 replaced across 15 locales. The underscore
duplicates are removed. Orphans for unshipped locales (bn_BD, cy_GB,
da_DK, hr_HR, sk_SK, sv_SE) are left for their enablement PRs.

* web: fix recovered French Kerberos help and typos

The recovered fr-FR Kerberos sync help described a password or keytab cache instead of the alternative credentials. Also fixes a French typo and a German formal/informal mix.

* core, web: register locales in locales.yaml and normalize Transifex paths

Transifex substitutes its own language code into both translation paths,
and its language_mapping is global, so it can't satisfy lit-localize
(pt-BR.xlf) and Django (locale/pt_BR/) at once. Files landed under names
neither build reads, and nothing reported it.

- locales.yaml is the source of truth: tag, Django directory, Transifex
  code, and whether the locale ships.
- `make gen-locales` writes targetLocales, the LocaleLoaderRecord
  region, and the Transifex language_mapping (code -> web tag).
- `make locales-normalize` moves locale/<tag>/ to locale/<to_locale(tag)>/
  and folds stray xliff files into their canonical file.
- `make lint-locales` / ci-lint-locales fail on unregistered paths and
  stale generated files. A Django test checks each shipped catalog loads.
- A workflow normalizes Transifex PRs and pushes the correction.

Migration: ar_AA -> ar and no_NO -> nb_NO backend catalogs merged;
locale/zh-Hans and zh-Hant renamed to zh_Hans/zh_Hant, which Django
can now find (it served 37 of 1043 zh-Hans strings before); unshipped
xliff orphans renamed to their tags.

Refs #24563

* core: address locale pipeline review

- Normalize xliff target-language on every recognized file, not only
  renamed ones, and fail the check on a mismatch. Transifex's mapping
  renames files but keeps aliases like ar-AA inside them, and
  lit-localize keys catalogs by that attribute.
- Merge every file from a Transifex locale directory, not only
  django.po. A conflicting non-catalog file stops the merge before
  anything is deleted.
- Set each catalog's Language header to its directory, and check it.
- Type the merge callback for mypy --strict.
- Ignore msgstr == msgid in the catalog test, so an English fallback
  can't count as a served translation.

* core, web: ship bn-BD and sk-SK through locales.yaml

Bengali and Slovak were enabled on main by hand. Register them as shipped so the generated lists stay in sync.

* web: re-extract locales

Normalizes Transifex entity escaping in recovered targets and drops the removed base-URL banner strings.

* ci: harden translation normalize workflow
2026-10-08 01:14:16 +01:00

60 lines
1.4 KiB
YAML

---
git:
filters:
- filter_type: file
# all supported i18n types: https://docs.transifex.com/formats
file_format: XLIFF
source_language: en
source_file: web/xliff/en.xlf
# path expression to translation files, must contain <lang> placeholder
translation_files_expression: "web/xliff/<lang>.xlf"
- filter_type: file
# all supported i18n types: https://docs.transifex.com/formats
file_format: PO
source_language: en
source_file: locale/en/LC_MESSAGES/django.po
# path expression to translation files, must contain <lang> placeholder
translation_files_expression: "locale/<lang>/LC_MESSAGES/django.po"
settings:
# Generated from locales.yaml by `make gen-locales`. Do not edit by hand.
language_mapping:
ar_AA: ar
bg_BG: bg-BG
bn_BD: bn-BD
ca_ES: ca-ES
cs_CZ: cs-CZ
sk_SK: sk-SK
cy_GB: cy-GB
da_DK: da-DK
de_DE: de-DE
el_GR: el-GR
es_ES: es-ES
eu_ES: eu-ES
fa_IR: fa-IR
fi_FI: fi-FI
fr_FR: fr-FR
gl_ES: gl-ES
hr_HR: hr-HR
hu_HU: hu-HU
it_IT: it-IT
ja_JP: ja-JP
ka_GE: ka-GE
ko_KR: ko-KR
lt_LT: lt-LT
lv_LV: lv-LV
ms_MY: ms-MY
no_NO: nb-NO
nl_NL: nl-NL
pl_PL: pl-PL
pt_BR: pt-BR
pt_PT: pt-PT
ro_RO: ro-RO
ru_RU: ru-RU
sl_SI: sl-SI
sv_SE: sv-SE
th_TH: th-TH
tr_TR: tr-TR
uk_UA: uk-UA
vi_VN: vi-VN