Skip to content

Commit

Permalink
feat(suite-native): allow to use plural syntax and use it for Token/T…
Browse files Browse the repository at this point in the history
…okens message
  • Loading branch information
matejkriz committed Sep 19, 2024
1 parent ab05542 commit 88972af
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion scripts/list-outdated-dependencies/mobile-dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ react-native-reanimated
yup
metro
metro-react-native-babel-preset
jest-expo
jest-expo
intl-pluralrules
1 change: 1 addition & 0 deletions suite-native/intl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"type-check": "yarn g:tsc --build"
},
"dependencies": {
"intl-pluralrules": "^2.0.1",
"react": "18.2.0",
"react-intl": "^6.6.8"
}
Expand Down
3 changes: 3 additions & 0 deletions suite-native/intl/src/IntlProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { IntlProvider as ReactIntlProvider } from 'react-intl';

// Polyfill to support plural syntax
import 'intl-pluralrules';

import { en } from './en';

// flatten object to single level deep like { a: { b: { c: 1 } } } => { 'a.b.c': 1 }
Expand Down
2 changes: 1 addition & 1 deletion suite-native/intl/src/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const en = {
},
},
accountList: {
numberOfTokens: '+{numberOfTokens} Tokens',
numberOfTokens: '+{numberOfTokens, plural, one{1 Token} other{# Tokens}}',
tokens: 'Tokens',
},
assets: {
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9998,6 +9998,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@suite-native/intl@workspace:suite-native/intl"
dependencies:
intl-pluralrules: "npm:^2.0.1"
react: "npm:18.2.0"
react-intl: "npm:^6.6.8"
languageName: unknown
Expand Down Expand Up @@ -25759,6 +25760,13 @@ __metadata:
languageName: node
linkType: hard

"intl-pluralrules@npm:^2.0.1":
version: 2.0.1
resolution: "intl-pluralrules@npm:2.0.1"
checksum: 10/562964d81c4477ab0b66e051c31cdbb2ca599307ffdfdc88a1e16d2cf137e481082b90d5ad81f9d2d5f6767ec5528d764a44462f6752109ac035c04604973e23
languageName: node
linkType: hard

"into-stream@npm:^6.0.0":
version: 6.0.0
resolution: "into-stream@npm:6.0.0"
Expand Down

0 comments on commit 88972af

Please sign in to comment.