-
-
Notifications
You must be signed in to change notification settings - Fork 483
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
custom formatter interpolate not a function #585
Comments
workaround is to create a plugin which sets the formatter after the fact
|
Nuxt doesn't provide good way to implement this through module options. Stringifying functions wouldn't work as you need to import stuff in this case, so I think plugin is the best option if you can set those things after the fact... Not sure I can think of anything better. |
Same issue arises with modifiers. This example should register a snakeCase modifier but does not (because it is a function):
Current workaround is to create a plugin in the same manner as @oppianmatt did:
|
Added support for specifying path to local file for options passed to vue-i18n (the `vueI18n` key of `nuxt-i18n` configuration). This allows for configuration some options that have function type which previously would fail due to stringifying and lack of possibility to import stuff. Resolves #585, resolves #237
Version
v5.3.0
Reproduction link
https://github.com/kazupon/vue-i18n/blob/dev/examples/formatting/custom/src/formatter.js
Steps to reproduce
Try and use the example custom formatter from vue-i18n.
What is expected ?
custom formatter to work
What is actually happening?
nuxt-i18n has a build error in plugins/main,.js
a circular reference
If I change the custom formatter to not have the class property caasuing the circular error I get a different error. That interpolate isn't a function
Additional comments?
Debugging in the browser it looks like it removes any methods on the vue-i18n options, like the formatter, and turns it into a simple data structure
my guess is that it's inspecting the options to write out which causes the circular reference error. And then it also removes any classes/methods on the object and makes it a simple key/value
The text was updated successfully, but these errors were encountered: