Skip to content

Impossible to add pluralizationRules via the vueI18n options #237

Closed
@lukaVarga

Description

Version

v5.3.0

Reproduction link

Not really needed

Steps to reproduce

  1. In nuxt.config.js, within the options for the nuxt-i18n module, add a vuei18n option
  2. Add pluralizationRules: {'en': function(choice, choicesLength) { return 0 }} object
  3. run npm run dev

What is expected ?

The generated .nuxt/nuxt-i18n/plugin.main.js file should initialize new VueI18n with pluralizationRules: {'en': function(choice, choicesLength) { return 0 }} parameter

What is actually happening?

pluralizationRules is an empty object

Additional comments?

This happens because the vuei18n options get stringified using JSON.stringify here. The result of JSON.stringify({foo: function() {return 'bar'}}) is an empty object as the method serializes function as null value as you can see here

The option to initialize VueI18n with pluralization rules was added recently (see discussion)

This bug report is available on Nuxt community (#c209)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions