alibaba / react-intl-universal

Internationalize React apps. Not only for Component but also for Vanilla JS.
1.34k stars 154 forks source link

No locale data has been provided for this object yet. #135

Open astonishqft opened 4 years ago

astonishqft commented 4 years ago

升级完了你们最新的版本react-intl-universal@2.3.1之后,编译完运行会报错,之前的版本是没问题的

E88BE704-C4CF-4787-9080-6FED968C591E

cwtuan commented 4 years ago

hi, please provide your code and locale files

pavelglebov commented 4 years ago

Same issue after update to 2.3.2, code is plain just from the example, locales - en, ru. 2.2.5 works fine

cwtuan commented 4 years ago

@pavelglebov It seems fine when I running the browser-example. Could you provide more info? Thanks

image image

olebrun commented 4 years ago

Have the same issue with 2.4.1 and react-native on android and only in debug mode. Work on non-debug mode et work on ios debug or non-debug mode ... weird ?

Works ok on 2.2.5

cwtuan commented 4 years ago

@olebrun could you provide your code example and locale files

olebrun commented 4 years ago

I will try to provide you a working test app these next day.

astonishqft commented 4 years ago

hi, please provide your code and locale files

我的场景是这样的:

我在主系统里面使用了 react-intl-universal,然后将子系统通过微前端的方式集成到主系统的时候就会报这个错,子系统也使用了react-intl-universal,所以我分析是不是父子系统集成的时候互相影响了。另外如果使用 2.2.5 这个版本就不会报错

cwtuan commented 4 years ago

@astonishqft We also have micro-frontend architecture, but we don't encounter this issue. Please provide your code sample.

oleksandr-dziuban commented 4 years ago

I can confirm that on react-native Android Hermes Engine the latest version is broken. If I downgrade to 2.2.5 it's OK, also if debugger enabled and Google V8 engine is active - it's OK too. Looks like we need intl polyfill now for Android native envs

oleksandr-dziuban commented 4 years ago

Confirmed: Just install yarn add intl:

And add

import 'intl';
import 'intl/locale-data/jsonp/en';

in the root index.js of your app and everything works on Android.

Polyfill is needed now in latest version of this lib.

cwtuan commented 4 years ago

For non-browser application, you should add intl and the locale-data manually.

https://github.com/alibaba/react-intl-universal/blob/master/examples/node-js-example/src/App.js#L11-L16

oleksandr-dziuban commented 3 years ago

Add

yarn add intl
yarn add intl-pluralrules

And add these polyfills to index.js root file:

import 'intl';
import 'intl/locale-data/jsonp/en';
import 'intl-pluralrules'

to support intl and plurals on react native.