alibaba / alibaba/react-intl-universal

should variables apply when defaultMessage is used?

Open
#8 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.4k
Forks
158
Avg merge
2h 9m
Merged PRs (30d)
1

Description

Hi,
Not sure if it is a bug, but with my usage of extract-intl, I had a case, when the locale message was actually an empty string, so we passed [this null check](https://github.com/alibaba/react-intl-universal/blob/master/src/index.js#L49) variables had no effect, and the defaultMessage is shown in the end with {variable} as in "locale.json".

I don't know what is a right thing to do, but it seems to me that the desired result would be to have variables inserted into defaultMessage as well.

Thanks!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the null check at src/index.js line 49 and trace how extract-intl handles an empty locale message. Reproduce the case with a defaultMessage containing {variable}, then verify that the chosen behavior is covered and that variables are handled consistently when the defaultMessage is shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
internationalization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.