-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
chore(dashboard): Setup test and script for validating i18n #9799
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
6 Skipped Deployments
|
|
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.
LGTM, just one comment!
@@ -7,6 +7,9 @@ | |||
"build": "tsup && node ./scripts/generate-types.js", | |||
"build:preview": "vite build", | |||
"preview": "vite preview", | |||
"test": "vitest --run", | |||
"i18n:validate": "node ./scripts/i18n/validate-translation.js", | |||
"i18n:schema": "node ./scripts/i18n/generate-schema.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.
I feel like it would be very easy to forget to run this. Should we add a test in our CI that after running this command there are no changes (i.e we haven't forgotten to run it after changing en.json)?
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.
That's what the test I added ensures. It checks if $schema.json === en.json. So if we make an update to en.json or the schema without updating the other the test will fail and block your PR.
What
yarn i18n:validate <file name>
e.g.yarn i18n:validate da.json
which will look for a da.json file in the translation folder, and validate it against the schema. We handle this with a script as we don't want to do so through a test. Doing it with a test would mean that if we update the schema, we would also have to update all translations files that we don't maintain ourselves. The purpose of the script is just to allow us to easily review community PRs and also as a tool for people opening PR's to check their translations agains the schema, as it will print missing/additional keys.yarn i18n:generate
.