We ran our translation checks on 31,879 of Django's translations. Half of the first alarms were ours.
Languages
Our translation checks grew up on machine translations: what our local model writes for our own sites, refused and asked for again when a placeholder, a number or a name goes missing. People translate differently. To see what the checks make of that, we ran them over the .po files that ship with Django 5.2, in the 39 of our languages Django has: 31,879 translated entries.
The first run
The checks flagged 1,031 entries, and about half of the flags were the checks' own mistakes. Translators leave "URL", "IPv4" and "%s KB" as they are in Japanese, Thai or Bulgarian, which our script check took for English left in place. They keep PostgreSQL, JSON and True inside a translated sentence, write 6 p.m. as 18.00, 6 a.m. as 06.00 and Feb. as 2月, and "%(value).1f" was not even recognised as a placeholder. Each of those is now accepted: names, code and paths copied from the source do not count against the script, a single word or unit kept as it is passes, and times, calendar labels, ordinals and fractions written in digits count as the same numbers.
After the fixes the same files give 475 flagged entries, 1.5%, and on the 576,120 page translations our own sites accept the checks still raise no false alarm.
What was really wrong
- Plural headers that disagree with their entries: the Spanish, French, Italian and Portuguese admin files declare two plural forms in their header and carry three in every plural entry, and the Hebrew file declares four and carries three. GNU
msgfmt --checkstops on the Spanish one with a fatal error. 234 entries in all. - English left in place: Thai "content type" and "log entry", Greek "work factor", a Bulgarian plural form, 125 entries in all.
- A letter of another script: a Thai letter inside the Khmer word for "Russian".
- Plural rules that differ from CLDR: the Armenian and Punjabi files put 0 with the plural form, the Turkish file puts 0 with the singular, where CLDR has it the other way.
What a person may still accept
Some flags are judgement calls the checks will keep making. A translator who writes "Past 7 days" as "the past seven days" in words has not made a mistake, but for machine translations a changed or missing number is exactly what the check is for, so it stays strict and can be switched off with --no-numbers. A term a team has decided to keep in English, such as "Flat Pages", is flagged until it is passed with --keep.
What it changed for our sites
The checker that guards our own sites had the same blind spots for numbers. With the same fixes it accepts 3,379 translations from its log of refusals, such as "one-fifth" as 1/5 in Korean and dates with their leading zero, and every translation it had accepted before still passes. One rule we loosened too far on the way: a weekday now counts as a number only in a short calendar label ("Thursday" as Vietnamese "Thứ 5"), after an Oromo line in our measurement slipped a wrong date past it.
Where it lives
The checks are free in translation-checks, which since 1.3 also checks a .po file on its own, its Plural-Forms rule included, and since 1.4 runs as a pre-commit hook over a project's .po files; the rules for 42 languages are in our gettext note. Polyglot does the translating with your own model and runs the same checks on every string it writes.