-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix: add functions to genRawValue #61
Conversation
Hi, any reviews on this please? 😬 |
Serializing a function in general is super tricky concept and i prefer not to support/adopt it here. Transforms (via runtime/buildtime) and global variable dependency are some examples of problems that can occur. Is nuxt/i18n supporting function serialization from nuxt.config to runtime? |
I'm in the process of investigating all function options in the vue-i18n ecosystem and helping out kazupon (massive respect to him) in the Nuxt adoption. Some have been moved to runtime hooks (nuxt-modules/i18n#1919), while I see that there's also a runtime plugin I've discovered |
For reference about serialization in the i18n module: |
Thanks for sharing context. I wasn't aware. We probably have to also avoid this kind of serilization for i18n module too considering we are not doing this as best practice for Nuxt 3 itself. /cc @danielroe wdyt shall we support with warn or not? |
I've moved the root config functions to hook, but the vue-i18n plugin takes functions (read https://vue-i18n.intlify.dev/guide/essentials/syntax.html#custom-modifiers). Open to have a discussion about this over pm / discord. (and also involving kazupon if required) |
Closing this as I completely agree with the reasons of serialising functions to be extremely difficult so I don't want to encourage supporting it - I'm brainstorming & testing ideas to ensure there are no fragile behaviour for the module and so I'm feeling certain that I'll progress around it. 🙂 |
inspired from nuxt-modules/i18n#1617
This was the behaviour earlier:
This is the behaviour after this PR:
This is using regex, and I'm really happy to address cases I may have missed.
(PS. Could we consider also exporting
genRawValue
too please?)