我检查了这个来源 https://formatjs.io/docs/react-intl#runtime-requirements , 并尝试添加此代码
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
)
但这并没有帮助,我还添加了 defaultLocale
参数:
<IntlProvider defaultLocale={locale}></IntlProvider>
国际提供商,但也无济于事。我有 2 种语言,对于 en
语言,我没有收到此错误,只有 th
语言,我该怎么办?
最佳答案
尝试升级您的节点版本。我有 10 个并移动到 14.x:问题消失了
关于react-intl - { 错误 : [React Intl Error MISSING_DATA] Missing locale data for locale: "th" in Intl. 数字格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62589492/