-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support @ notation for localization files #15665
Support @ notation for localization files #15665
Conversation
This pull request has conflicts ☹ |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@@ -136,6 +137,8 @@ class IntlStartup extends Component { | |||
} | |||
|
|||
const dasherizedLocale = normalizedLocale.replace('_', '-'); | |||
const { language, formattedLocale } = formatLocaleCode(dasherizedLocale); | |||
|
|||
this.setState({ messages: mergedMessages, fetching: false, normalizedLocale: dasherizedLocale }, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.setState({ messages: mergedMessages, fetching: false, normalizedLocale: dasherizedLocale }, () => { | |
this.setState({ messages: mergedMessages, fetching: false, normalizedLocale: formattedLocale }, () => { |
I think you can set it right away and access it later in render()
.
@@ -157,14 +162,15 @@ class IntlStartup extends Component { | |||
render() { | |||
const { fetching, normalizedLocale, messages } = this.state; | |||
const { children } = this.props; | |||
const { formattedLocale } = formatLocaleCode(normalizedLocale); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { formattedLocale } = formatLocaleCode(normalizedLocale); |
See the comment above.
|
||
return ( | ||
<> | ||
{(fetching || !normalizedLocale) && <LoadingScreen />} | ||
|
||
{normalizedLocale | ||
&& ( | ||
<IntlProvider fallbackOnEmptyString={FALLBACK_ON_EMPTY_STRING} locale={normalizedLocale} messages={messages}> | ||
<IntlProvider fallbackOnEmptyString={FALLBACK_ON_EMPTY_STRING} locale={formattedLocale} messages={messages}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<IntlProvider fallbackOnEmptyString={FALLBACK_ON_EMPTY_STRING} locale={formattedLocale} messages={messages}> | |
<IntlProvider fallbackOnEmptyString={FALLBACK_ON_EMPTY_STRING} locale={normalizedLocale} messages={messages}> |
See the comment above.
What does this PR do?
xx@xxxx
uz@Cyrl
to the fallbackLocales (locales that are not in LangMap)IntlStartup
instead ofApp
component (so it is correctly set in first load and after a refresh)Closes Issue(s)
Closes #15660