Files
bookorbit/client/scripts/locale-typography.mjs
T
neon 5ff6bdfecb ci(i18n): stop the crowdin sync failing on a single translator edit
Fail the nightly export only when a catalog loses far more than churn
explains, rewrite a Crowdin em dash to the hyphen the source uses instead
of discarding the translation, and report a rejected message as a
rejection rather than a lost one. See docs/LOCALIZATION.md.
2026-08-27 18:29:42 +00:00

21 lines
866 B
JavaScript

// Catalogs never carry a Unicode em dash. That is a house style rule rather than a correctness one,
// and translators reach for the character constantly, so rejecting the message would discard a sound
// translation over punctuation and stall the sync until somebody edits Crowdin by hand. The English
// source writes a plain hyphen in the same place, so the sync rewrites the character instead.
export function normalizeMessageTypography(message) {
return message.replaceAll('\u2014', '-')
}
export function findTypographyDrift({ catalogs }) {
const drift = []
for (const [locale, catalog] of catalogs) {
if (locale === 'en') continue
for (const [key, message] of catalog) {
const normalized = normalizeMessageTypography(message)
if (normalized !== message) drift.push({ locale, key, message: normalized })
}
}
return drift
}