alibaba / react-intl-universal

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

plural form isn't incompatible for Android7.0? {key,plural,=1 {#st} =2 {#nd} =3 {#rd} other {#th}} #147

Closed jiangkeyuan closed 3 years ago

jiangkeyuan commented 3 years ago

当 key 为 1,2,3 时正常显示,other 时 就显示 整行代码,是不是不兼容安卓7.0, 其余系统正常

cwtuan commented 3 years ago

your key is "1,2,3" ?

jiangkeyuan commented 3 years ago

code:{intl.get("2020.10.10",{nper:item.date})} date为 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15........ 三语:2020.10.10:"hello {nper,plural,=1 {#nd} =2 {#rd} =3 {#rd} other {#th}}"

jiangkeyuan commented 3 years ago

微信图片_20201105142739

jiangkeyuan commented 3 years ago

手机型号 :SHARP FS8014 版本 安卓,7.0

cwtuan commented 3 years ago

Do you have the following code in your app?

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

jiangkeyuan commented 3 years ago

sure

jiangkeyuan commented 3 years ago

1,2,3 都正常显示了 other 这个api是不是不支持 只有安卓7.0 显示不正常 其余系统正常

cwtuan commented 3 years ago

Any error message? Which version of react-intl-universal?

jiangkeyuan commented 3 years ago

good morning !

jiangkeyuan commented 3 years ago
jiangkeyuan commented 3 years ago

"react-intl-universal": "^2.4.1",

cwtuan commented 3 years ago

Please try this,

npm i --save @formatjs/intl-pluralrules
import '@formatjs/intl-pluralrules/polyfill'
import '@formatjs/intl-pluralrules/locale-data/en' // locale-data for en
jiangkeyuan commented 3 years ago

it is ok! thanks