fix(i18n): add 6 missing translation keys and enforce locale parity in tests - #2995
Open
Zuhef wants to merge 1 commit into
Open
fix(i18n): add 6 missing translation keys and enforce locale parity in tests#2995Zuhef wants to merge 1 commit into
Zuhef wants to merge 1 commit into
Conversation
…n tests Six keys present in en-US.json were missing from other locale files, so users on those locales fell through to a missing-key render instead of translated text: ar-SA, da-DK chat.favorites.remove de-DE, it, ko components.DatePickerInput ja chat.fileUpload.browse Nothing caught this, which is why the gaps accumulated across three separate PRs. `chainlit lint-translations` loads en-US.json from the package and then lints the *consuming app's* .chainlit/translations/ directory, not backend/chainlit/translations/, and test_translations.py only exercised compare_json_structures against synthetic in-test dictionaries. Add a parametrized suite that walks the shipped locale files and compares each against en-US.json, so every locale gets its own test id and a failure names both the file and the missing key. en-US.json needs no special-casing since comparing it to itself is trivially clean. A separate test asserts the directory is discoverable, so the parametrized cases cannot pass vacuously if the directory is ever moved or renamed. The six translations follow the terminology already present in each file: ar-SA and da-DK reuse the remove wording from chat.fileUpload.actions.removeAttachment, and the date-picker strings follow the existing fr-FR/es/nl phrasing. They would still benefit from native-speaker review. Fixes Chainlit#2993
Zuhef
requested review from
asvishnyakov,
hayescode and
sandangel
as code owners
July 29, 2026 17:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2993
Both halves of the issue
1. The six missing keys. Added to the locales that lacked them:
ar-SA,da-DKchat.favorites.removede-DE,it,kocomponents.DatePickerInputjachat.fileUpload.browse2. A parity test over the real locale files - the durable half.
backend/tests/test_translations.pynow has aTestShippedTranslationFileParitysuite that walksbackend/chainlit/translations/and compares every file againsten-US.jsonusing the project's owncompare_json_structures.It is parametrized per locale, so a regression names the offending file in the test id and lists the exact keys in the assertion message:
Two details from the issue notes:
en-US.jsonneeds no special-casing - it is included in the parametrization and comparing it to itself is trivially clean.test_translations_directory_is_discoverableguards that: it asserts the directory exists, thaten-US.jsonis in it, and that more than one locale file was found.Verification
Ran against the local source tree (
PYTHONPATH=backend):pytest backend/tests/test_translations.py- 81 passed (35 pre-existing, plus 46 parametrized locale cases and the discoverability guard).compare_json_structuresover all 23 locale files.chat.favorites.removefromda-DK.jsonproduces exactly the failure quoted above; restoring it returns to 81 passed. A parity test that cannot fail would be worse than none.On the translations themselves
The issue notes the six strings are best done by native speakers, and I am not one for these locales. Rather than inventing phrasing, each follows terminology already present in the same file or the established house style:
ar-SAreuses the "remove" wording from its existingchat.fileUpload.actions.removeAttachment.da-DKusesFjern, matching its ownremoveAttachmentvalue.jafollows the same pattern as its existingdragDropandremoveAttachmententries.DatePickerInputstrings follow the existingfr-FR/es/nlphrasing ("Choisir une date" / "Elige una fecha" / "Kies een datum").I would welcome native-speaker review on all six, and I am happy to take corrections in this PR. The parity test is the part I would defend on engineering grounds; the wording I would defer on.
Summary by cubic
Adds six missing i18n keys across shipped locales and introduces a parity test to ensure all locale files match
en-US.json. Prevents missing-key renders and blocks future gaps.Bug Fixes
ar-SA,da-DK: addchat.favorites.remove.de-DE,it,ko: addcomponents.DatePickerInputplaceholders (single,range).ja: addchat.fileUpload.browse.Tests
en-US.jsonusingcompare_json_structures, failing with exact missing keys.Written for commit 1bc1a30. Summary will update on new commits.