mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
5ff6bdfecb
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.
21 lines
866 B
JavaScript
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
|
|
}
|