-
Notifications
You must be signed in to change notification settings - Fork 7
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
I18next action #80
I18next action #80
Conversation
✅ Deploy Preview for confessit-web ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
NodeJS 20.x sounds great, but I'd prefer to merge it in a separate commit/PR for numerous reasons. Would you like to make a separate PR for that? If not I'm happy to do it myself since you've done so much other work here, I could get it done quickly. For i18next-scanner, I like your solution. Great idea to use separate configs! But I'm very hesitant about the auto-commit workflow. It's not that I don't think it will work, but that it's not the way I'm most comfortable working. I'd generally prefer, for a variety of reasons, to make the translations file changes in the same commit where the code changes. Fortunately, I actually think we can do this somewhat easily. Husky is a tool to automate the setup of git hooks that we're already using for a linting hook with Prettier. I think (hope) it would be easy to move your script out of the GitHub Action and instead run it as a hook when making a git commit, to include the translation changes as part of the same commit. I'd also be happy to work on doing this, using this PR as a starting point, or you can do the work yourself if you prefer. Let me know what you'd like me to help with. |
And of course, thanks for all your help with Translations! With that AI commit you did, we have very complete translations in several languages now! |
Sure I can do that.
I'm not familiar with Husky, though I'm interested in getting to know it. But best you take care of that. We could close this PR and I'll let you transport the |
Is it just a question of adding the confessit-web/.husky/pre-commit Line 4 in e26fc3f
|
Yes, that should be it actually. Take a look at #86 and see if it seems good to you. (Or we can rebase and merge this PR if you prefer, I don't mind either way.) |
After many hours of testing, I finally came up with a solution that will work both from the command line, or from a Github workflow. I also took the opportunity to update to Node 20, if you think that's ok?
chalk
explicitly among the dev-dependencies blocked atv4
becausev5
changed to ES module syntax, but it seems thati18next-scanner
doesn't have the right version as a dependency because it was pulling inv5
, effectively breaking the scanner configuration<Trans>
component is placed in the code, when the scanner picked it up, it would use the default value (the text contents of the component) for both English and non English language files, which is not very desirable: you don't want to populate non English language files with English values. You only need the keys, but with empty values. I finally came up with a solution: use two separate configuration scripts, one that will update only the English language file and will populate keys related to<Trans>
components with the default value; the other configuration script that will update all other non English language files and will populate keys related to<Trans>
components with an empty value.main
if any.js
or.jsx
files are changed.sort
to true, so that keys will be sorted alphabetically. This will ensure that:So far all is tested and working well, except maybe one little thing in the Github workflow action: it seems that a Husky hook is trying to run when the action tries to commit changes, but it can't find Husky. I don't know much about husky, how or where should it be installed inside the Github action?