0

i18n directory with index.js and the localization files: es.js, it.js and en.js.

index.js content:

export { default as es } from './es'
export { default as it } from './it'
export { default as en } from './en'

en.js content file (similar to es.js and it.js):

/*eslint-disable max-len,quotes*/
export default {
  "about.h1": "This is the title from the about page",
  ...
}

I try to load localization messages:

import * as i18n from 'i18n'
...
const intlData = {
  locale: 'en',
  messages: i18n['en']
}

However messages variable is undefined.

When I checked the console log with:

window.console.log(i18n)

I get undefined:

Object {__esMOdule: true}
 es:undefined
 get es: function get()
 it: undefined
 get it: function get()
 en: undefined
 get en: function get()
 __proto__: Object

Where I should get something like:

Object {__esMOdule: true}
 es: Object
 it: Object
 en: Object
 __proto__: Object
Kirill Fuchs
  • 13,446
  • 4
  • 42
  • 72
user2670996
  • 2,654
  • 6
  • 29
  • 45

0 Answers0