Repository navigation
chore(renderer): remove the dead i18n module cluster - #101
Merged
Merged
Conversation
Three renderer modules were unreachable from every entry point:
`LanguageSelector`, `Versions`, and `lib/i18n.ts`. The evidence is not a
judgement call — a repo-wide search for each name returns its own definition and
nothing else:
$ grep -rn "LanguageSelector\|lib/i18n\|preloadLocales" .
(none)
`lib/i18n.ts` was a second, independent i18n implementation — its own locale
cache, its own `useTranslation`, `t`, `getTranslation`, `formatMessage` and
`pluralize` — while the app actually uses `i18next` through
`src/renderer/src/i18n.ts`. Its only importer was `LanguageSelector`, which was
itself unused; `preloadLocales` had no consumer at all. `Versions.tsx` rendered
the Electron/Chromium/Node versions and was never mounted.
Dead i18n code that looks live is a trap: it invites someone to "fix" a
translation in a module the app never calls. The second implementation had
already drifted from the live one — its `Namespace` union omits `anki` and
`shortcuts`, which exist in `locales/` and in `i18n.ts`.
`lib/` keeps `dragLock.ts`, `platform.ts` and `utils.ts`, so the directory stays.
No behaviour change: nothing imported any of the three modules, and typecheck,
lint, `npm test` and the production build are unaffected.
Fixes #87
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.
What does this PR do?
Deletes three renderer modules that were unreachable from every entry point, so the app no longer ships and maintains a second, drifted i18n implementation that looks live.
Why?
src/renderer/src/components/LanguageSelector.tsxsrc/renderer/src/components/Versions.tsxsrc/renderer/src/lib/i18n.tslib/i18n.tswas a complete second i18n implementation — its own locale cache, its ownuseTranslation,t,getTranslation,formatMessageandpluralize— while the app usesi18nextthroughsrc/renderer/src/i18n.ts. Its only importer wasLanguageSelector, which was itself unused;preloadLocaleshad no consumer at all.Versions.tsxrendered the Electron/Chromium/Node versions and was never mounted.Dead i18n code that looks live is a trap: it invites someone to "fix" a translation in a module the app never calls. The second implementation had already drifted — its
Namespaceunion omitsankiandshortcuts, which exist inlocales/and ini18n.ts.Related issue
Fixes #87
What changed?
src/renderer/src/components/LanguageSelector.tsxsrc/renderer/src/components/Versions.tsxsrc/renderer/src/lib/i18n.tsNothing else.
lib/keepsdragLock.ts,platform.tsandutils.ts, so the directory stays.How was this tested?
Verified nothing references the deleted modules before removing them:
Then, on a clean checkout of this branch:
npm run typechecknpm run lintnpm testnpm run check:designnpm run build✓ built in 5.24s)No UI or behaviour change, so there is nothing to screenshot.
Checklist
npm run typecheckpasses.npm run buildpasses.Desktop / build changes