refactor(i18n): take the untranslatable strings out of the locales - #32
Merged
Merged
Conversation
Twenty-four keys held values that read the same in every language: the nine
integration brand names, the example URLs and numbers shown greyed out in a
field, the export formats, "GitHub", "MySpeed", "speedtest.net". Fifteen copies
of each, and a standing invitation to translate a word that has no translation.
Several were duly translated, and four were still wrong on this branch:
de integrations.ntfy.title "nackt"
fr integrations.pushover.title "Effet de poussée"
fr integrations.healthChecks.title "Tests de santé"
pt integrations.telegram.title "Telegrama"
nl had "kant-en-klare" for the same key and pt had "Discórdia" for Discord;
those two were caught by hand last week, which is the whole problem - none of it
is catchable by a test. localeParity.test.js can see a value that is still the
English text, because that is what an untranslated one looks like. It cannot see
one confidently rendered into the wrong thing, because that is what a
*translated* one looks like. A German instance offered an integration called
"nackt" and nothing anywhere disagreed.
So they are constants now, in client/src/common/utils/InvariantText.js, and the
keys are gone from all fifteen files. The lookup the dialog does for a title and
a placeholder consults the constants first and falls through to i18next, because
integrations.email.title stays a locale key: "Email" is a word, not a name, and
every language has one.
UNIVERSAL_SHARED goes with them - it existed to stop the gap report crying wolf
over exactly these keys, and there is nothing left for it to hold. What remains
in the registry is per-language, which is the only kind of allowance that means
anything: French really does write "ms" and "Mbps", Russian really does not. The
test that kept units off the universal list is kept in that form: an allowance
every single language carries is a key that should not have been translatable.
The guarantee that every integration has a name it can be stored under moves
from integrationFieldLabels.test.js to invariantText.test.js rather than
lapsing - an integration with no name writes its raw key into integration_name
on first save and carries it in every language afterwards.
en.json loses 24 of its keys. It already differed from upstream's Crowdin source
on 166 of 600 - 165 this fork added - so the file is long past being mergeable
without a hand on it.
Co-Authored-By: Claude Opus 5 <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.
Twenty-four locale keys held values that read the same in every language: the nine integration brand names, the example URLs and numbers shown greyed out in a field the reader is about to overwrite, the export formats, "GitHub", "MySpeed", "speedtest.net". Fifteen copies of each, and a standing invitation to translate a word that has no translation.
Several were duly translated. Four were still wrong after #31:
integrations.ntfy.title"nackt"integrations.pushover.title"Effet de poussée"integrations.healthChecks.title"Tests de santé"integrations.telegram.title"Telegrama"A German instance offered an integration called "nackt", and nothing anywhere disagreed.
Why a test can't fix this
localeParity.test.js, added in #31, catches a value that is still the English text — that is what an untranslated one looks like. It cannot catch one that has been confidently rendered into the wrong thing, because that is exactly what a translated one looks like.nl's "kant-en-klare" andpt's "Discórdia" were only found by reading the files by hand.The only fix that holds is to stop asking the question.
What changed
The twenty-four values are constants in
client/src/common/utils/InvariantText.js, and the keys are gone from all fifteen locale files — 599 keys down to 575. The title and placeholder lookups in the integration dialog consult the constants first and fall through to i18next, becauseintegrations.email.titlestays a locale key: "Email" is a word, not a name, and every language has one.UNIVERSAL_SHAREDgoes with them. It existed only to stop the gap report crying wolf over exactly these keys, and there is nothing left for it to hold. What remains in the registry is per-language, which is the only kind of allowance that means anything — French really does write "ms" and "Mbps", Russian really does not. Its guard rail is kept in inverted form: an allowance that every single language carries is now a test failure, because that means the key should never have been translatable.What deliberately did not move
Documented in the module, because the naive version of this change is wrong:
msisмсin Russian and毫秒in Chinese;MbpsisMbit/sacross much of Europe andМбіт/сin Ukrainian;MB/sisMo/sin French.%variables%are read by the sender, but the units between them are not.dein-server.de,su-servidor.es.Coverage
The guarantee that every integration has a name it can be stored under moves from
integrationFieldLabels.test.jstoinvariantText.test.jsrather than lapsing — an integration with no name writes its raw key intointegration_nameon first save and carries it in every language afterwards. The new tests also assert the retired keys are gone from all fifteen files, that no brand names an integration the server does not define, and that no placeholder points at a field that does not exist.On
en.jsonIt loses 24 keys. It already differed from upstream's Crowdin source on 166 of 600 — 165 of which this fork added — so the file is long past being mergeable without a hand on it.
4,185 tests pass, lint clean,
vite buildsucceeds.🤖 Generated with Claude Code