[SOLVED] | i18n - NumberFormats
-
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?
-
Are you getting any translations working?
Scott
-
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
-
OK! I got it. Now it works like a charm.
Thank you Scott!