alibaba / alibaba/react-intl-universal
Plural form with default message
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 158
- Avg merge
- 2h 9m
- Merged PRs (30d)
- 1
Description
In the example you can use variables with defaultMessage like
```intl.get('HELLO', { name }).d(`Hello, ${name}`); // "Hello, Tony"```. But is there anyway to get defaultMessage to work with locale template like
```intl.get('HELLO', { num }).d("You have {num, plural, =0 {no photos.} =1 {one photo.} other {# photos.}}" )" })``` . For example, maybe add a parameter to `intl.get`: `intl.get(key, variables, defaultMessage)` or you may need to do some refactoring to make it work with current apis.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the existing intl.get and defaultMessage APIs, using the plural-message example in the issue as the expected case. Determine how locale templates are currently handled and define what support for a plural defaultMessage should look like; done means the example resolves correctly without breaking the existing variable-based defaultMessage behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- internationalization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100