{ Error: [React Intl Error MISSING_DATA] Missing locale data for locale: "th" in Intl.NumberFormat

Viewed 2352

I've checked this source https://formatjs.io/docs/react-intl#runtime-requirements , and tried to add this code

import { NumberFormat } from '@formatjs/intl-numberformat'

NumberFormat.__addLocaleData(
  require('@formatjs/intl-numberformat/dist/locale-data/en.json') // locale-data for en
)

NumberFormat.__addLocaleData(
  require('@formatjs/intl-numberformat/dist/locale-data/th.json') // locale-data for th
)

But it doesn't help, also I've added defaultLocale param :

<IntlProvider defaultLocale={locale}></IntlProvider>

to intl provider , but it also doesn't help. I have 2 languages , for en language I don't get this error , only for th language , what should I do ?

2 Answers

Try upgrade your Node Version. I had 10 and moved to 14.x: Issue was gone

Issue is with the object being utilized.

Check the object structure of translation content.

IntlProvider should have messages property whose value should be an object which contains property mentioned in id of FormattedMessage

Related