No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    [SOLVED] | i18n - NumberFormats

    Help
    2
    4
    412
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      marcodc last edited by marcodc

      I am trying to use the number localization of the i18n plugin but I receive the following warnings.

       WARNING  Compiled with 2 warnings                                                                          
       warning  in ./src/boot/i18n.js
      "export 'messages' was not found in 'src/i18n'
       warning  in ./src/boot/i18n.js
      "export 'numberFormats' was not found in 'src/i18n'
      
      // i18n/it/index.js
      const messages = {...}
      const numberFormats = {
        currency: {
          style: 'currency', currency: 'EUR'
        }
      }
      export default { messages, numberFormats }
      
      
      // i18n/index.js
      import enUS from './en-us'
      import itIT from './it'
      
      export default {
        'en-us': enUS,
        it: itIT
      }
      
      // boot/i18n.js
      import Vue from 'vue'
      import VueI18n from 'vue-i18n'
      import { messages, numberFormats } from 'src/i18n'
      
      Vue.use(VueI18n)
      const i18n = new VueI18n({
        locale: 'it',
        fallbackLocale: 'en-us',
        messages,
        numberFormats
      })
      
      export default ({ app }) => {
        // Set i18n instance on app
        app.i18n = i18n
      }
      export { i18n }
      
      

      What am I doing wrong?

      1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by

        Are you getting any translations working?

        Scott

        1 Reply Last reply Reply Quote 0
        • s.molinari
          s.molinari last edited by s.molinari

          Ok. I see what is wrong. You won’t be able to put the numberFormats object inside the messages. You need to create a new file and add them there and then import and export as necessary.

          See here: https://codesandbox.io/s/0b5n9

          Scott

          1 Reply Last reply Reply Quote 1
          • M
            marcodc last edited by

            OK! I got it. Now it works like a charm.

            Thank you Scott!

            1 Reply Last reply Reply Quote 1
            • First post
              Last post