Skip to content
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

Merged

Conversation

ramonlsouza
Copy link
Member

What does this PR do?

  • adds support to locales with the format xx@xxxx
  • adds uz@Cyrl to the fallbackLocales (locales that are not in LangMap)
  • sets HTML lang attribute in IntlStartup instead of App component (so it is correctly set in first load and after a refresh)

Closes Issue(s)

Closes #15660

@github-actions
Copy link

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

@ramonlsouza ramonlsouza requested review from JoVictorNunes and removed request for antobinary September 28, 2022 17:32
@sonarcloud
Copy link

sonarcloud bot commented Sep 28, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@@ -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 }, () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<IntlProvider fallbackOnEmptyString={FALLBACK_ON_EMPTY_STRING} locale={formattedLocale} messages={messages}>
<IntlProvider fallbackOnEmptyString={FALLBACK_ON_EMPTY_STRING} locale={normalizedLocale} messages={messages}>

See the comment above.

@ramonlsouza ramonlsouza merged commit e109586 into bigbluebutton:v2.6.x-release Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants