-
Notifications
You must be signed in to change notification settings - Fork 474
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
Impossible to add pluralizationRules via the vueI18n options #237
Comments
Any updates regarding this issue? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue is not fixed, please, reopen |
Passing functions through module options would require serialization of function and that is, while possible, generally discouraged by core team. Better option is to support external configuration file that would be But I agree it should be re-opened. |
this is the same problem that causes custom formatter not to work, raised issue here #585 the json.stringify removes any functions/methods so you can't pass a custom formatter as an option |
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
@lukaVarga try |
Here is the answer #605 |
Version
v5.3.0
Reproduction link
Not really needed
Steps to reproduce
nuxt.config.js
, within the options for thenuxt-i18n
module, add avuei18n
optionpluralizationRules: {'en': function(choice, choicesLength) { return 0 }}
objectnpm run dev
What is expected ?
The generated
.nuxt/nuxt-i18n/plugin.main.js
file should initializenew VueI18n
withpluralizationRules: {'en': function(choice, choicesLength) { return 0 }}
parameterWhat is actually happening?
pluralizationRules
is an empty objectAdditional comments?
This happens because the
vuei18n
options get stringified usingJSON.stringify
here. The result ofJSON.stringify({foo: function() {return 'bar'}})
is an empty object as the method serializes function asnull
value as you can see hereThe option to initialize
VueI18n
with pluralization rules was added recently (see discussion)The text was updated successfully, but these errors were encountered: