-
-
Notifications
You must be signed in to change notification settings - Fork 488
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: experimental vue-i18n
and messages type generation
#3151
feat: experimental vue-i18n
and messages type generation
#3151
Conversation
commit: |
vue-i18n
and messages type generationvue-i18n
and messages type generation
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 will leave a comment on the points that I am concerned about.
I integrated all the locale messages when I implemented i18n support first time for h3.
I noticed that all the locale messages are unnecessary on the server side, affecting performance.
Since this is experimental, I think this implementation is fine, but at some point, I think a mechanism that allows locale messages to be loaded only on the server side will be necessary.
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.
Hmm I'm not entirely sure what you mean 🤔 Do you mean a mechanism to load a part/subset of messages?
I haven't checked if this does anything to a project production build, this should only be used in development so I should probably disable this functionality if not in dev mode.
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.
After looking into it, it looked like it was being included in production too 😅 Now this functionality should only be enabled (if configured) during development, this still has performance impact but not after building.
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 have added some options, the configuration now accepts false | 'default' | 'all'
:
false
- disables type generation'default'
- generate types based on configureddefaultLocale
'all'
- generate types based on all configured locales
This way users can decide to only generate types using the defaultLocale
resources, which prevents loading all locales unnecessarily.
@BobbieGoede I've wanted to implement a type generation like your PR, and I'm so happy you're supporting it! |
vue-i18n
and messages type generationvue-i18n
and messages type generation
🔗 Linked issue
❓ Type of change
📚 Description
This is a different, improved approach compared to BobbieGoede#50, that PR reimplemented the loading of configs and messages while this PR reuses the existing logic.
(Same demo video as BobbieGoede#50 as this should be functionally the same)
Code_2024-07-17_14-54-20.mp4
📝 Checklist