Skip to content

refactor(i18n): take the untranslatable strings out of the locales - #32

Merged
i7Gamer merged 1 commit into
developmentfrom
refactor/invariant-strings-out-of-i18n
Aug 25, 2026
Merged

refactor(i18n): take the untranslatable strings out of the locales#32
i7Gamer merged 1 commit into
developmentfrom
refactor/invariant-strings-out-of-i18n

Conversation

@i7Gamer

@i7Gamer i7Gamer commented Aug 25, 2026

Copy link
Copy Markdown
Owner

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:

locale key shipped as
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"

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" and pt'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, 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 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:

  • the units. ms is мс in Russian and 毫秒 in Chinese; Mbps is Mbit/s across much of Europe and Мбіт/с in Ukrainian; MB/s is Mo/s in French.
  • the notification templates. The %variables% are read by the sender, but the units between them are not.
  • the example hostnames. Every locale localises them on purpose: dein-server.de, su-servidor.es.

Coverage

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. 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.json

It 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 build succeeds.

🤖 Generated with Claude Code

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>
@i7Gamer
i7Gamer merged commit 45cf0f4 into development Aug 25, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant