-
-
Notifications
You must be signed in to change notification settings - Fork 495
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
Add .ts and .js as supported file extensions #1576
Conversation
✅ Deploy Preview for nuxt-i18n-v8 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Ultimately it's up to @kazupon to decide but based on functionality available in the Nuxt 2 version, I would say that support for async functions is something that many would expect and use. So introducing "half-working" solution is probably not a great idea. |
@rchl I disagree with calling it "half working" idea. This feature is requested by many users: The PR is intentionally kept very compact, to avoid any changes outside of the scope of allowing using static JS/TS files as translation source. Currently the module is in a state where everyone attempting to use JS/TS translations encounters a silent error. With this PR:
For me it's a win/win situation, instead of silent failure, users get proper error message. Consciously limiting scope != half working. |
Thank you for your contribution! There is a reason why we currently limit ourselves to formats such as json, json5, and yml. Currently, vue-i18n v9 used as the core of @nuxtjs/i18n, transpiles locale messages into message functions that can be executed as JS. Currently supported formats such as json, json5 and, yml also support sourcemap when transpiled. sourcemap must be supported in order to support js/ts as a locale messages resource. |
@kazupon This makes a lot of sense. It was too easy to enable the static file support. The generator function in bundle-tools seems quite complex for JSON alone, I imagine for JS it's going to be even more extensive as there are more edge cases. Definitely out of realm for a first time contribution. Is there an approach you would recommend for supporting splitting translation files into components?
Since |
I would like to use this feature, is this pull request going to be merged? |
The approach presented in this PR is lacking. It is unlikely to get merged. |
@Aareksio |
any news on this feature? in my case I need to use async function for getting i18n data from server and just need to support functions and js files. That works well in nuxt 2 but not works in nuxt 3. Thanks very frustrating because there no breaking change info about it in documentation when updating. @kazupon if you can tell more about what to do, I can find time for help with that support. Just need to know what to do for add support. Because that feature need me ASAP :) |
add for linking issue #1829 |
Reviewing the source code of
next
branch I found no obstacles that would disallow loading locales fromjs
andts
files. It does not support exporting (async) functions, but should be enough for requested feature of joining localization components: