-
-
Notifications
You must be signed in to change notification settings - Fork 186
feat(i18n): strip unused i18n keys #471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(i18n): strip unused i18n keys #471
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
danielroe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to run this in CI and automatically remove unused keys in other languages
in autofix.yml, it would ensure when removing keys from one lang, they are automatically removed from every other one
Should I create the github workflow for that directly here? (Would be later, as I got work to do now until evening or so) |
package.json
Outdated
| "build:lunaria": "node --experimental-transform-types ./lunaria/lunaria.ts", | ||
| "dev": "nuxt dev", | ||
| "dev:docs": "pnpm run --filter npmx-docs dev --port=3001", | ||
| "i18n:check": "node scripts/compare-translations.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're targeting node 24 right? if so this could be a ts file :p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes!
scripts/compare-translations.js
Outdated
| import { existsSync, readFileSync } from 'fs' | ||
| import { join } from 'path' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import { existsSync, readFileSync } from 'fs' | |
| import { join } from 'path' | |
| import { existsSync, readFileSync } from 'node:fs' | |
| import { join } from 'node:path' |
danielroe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hope you don't mind - I pushed the refactor 🙏
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
Awesome, I'm thankful you like the idea 💡 |
I find it pretty useful when translating to be able to check locally if I have updated everything as sometimes it get's chaotic with a lot of outdated strings...
Therefore I made a little script that can easily be called with
pnpmfor all the languages, which outputs the missing keys and also which have been removed in the original.In the future, if we keep the single JSON file, we could integrate this into CI, checking for all i18n PRs if everything has been updated automatically.
Not sure, if this goes into the desired direction of the project, as I saw some other issues and PRs improving i18n in other ways. So just close if this is not desired 👍