fix: return the key for a missing translation in the default locale too - #32
Merged
Merged
Conversation
A missing key came back as the key for every locale except the translator's own default, where a missing map entry yielded "". Callers that pass raw copy through Translate (bot profile descriptions) therefore got empty text exactly when the requested locale was the default one, and the failure was invisible in every other language. Both branches now return the key; the two tests that pinned the empty string are updated and a regression test covers default and non-default locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Why
mapTranslator._translatereturned the key for a missing translation in every locale except the default one, where it returned"". sneat-co/sneat-bots passed a bot's raw description throughTranslatewith an en-UK translator whose default is en-UK, so @SneatBot published an empty default description on 2026-09-10 while Russian showed the English text. Founder decision the same day: "improve strongo/i18n if needed".What
The default-locale branch now returns the key, matching the non-default branch. The two tests that asserted
""("Key not found", "Non-existent key") now expect the key; a new test covers default and non-default locales forTranslateandTranslateNoWarning. No caller in sneat-bots, sneat-go, debtus, sneat-go-core, bots-fw or bots-fw-telegram compares a translation result to the empty string.Validation
🤖 Generated with Claude Code