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

Fix fallback for locale display names #12204

Merged
merged 2 commits into from
Feb 16, 2024
Merged

Fix fallback for locale display names #12204

merged 2 commits into from
Feb 16, 2024

Conversation

wackerow
Copy link
Member

@wackerow wackerow commented Feb 16, 2024

Description

  • Removes all empty strings from the intl folder (will fallback to English string)
  • Improve check inside useLanguagePicker to check if we have an internal translation available or not
    If the output of t() matches the English name or the i18n key, then this string isn't available internally and Intl.DisplayNames used as fallback to display the locale name.

@github-actions github-actions bot added review needed 👀 translation 🌍 This is related to our Translation Program labels Feb 16, 2024
Copy link

netlify bot commented Feb 16, 2024

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit d85fe5b
🔍 Latest deploy log https://app.netlify.com/sites/ethereumorg/deploys/65cf876b0c031f0008ace0c6
😎 Deploy Preview https://deploy-preview-12204--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@pettinarip pettinarip left a comment

Choose a reason for hiding this comment

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

Lgtm! it seems to fix the issue.

However, I'd strongly suggest removing the throw errors we have inside the useEffect, since all of them are going to break the client experience. Instead, we can console.error them.

@wackerow
Copy link
Member Author

image

Okay... @pettinarip note that without the guard for (!sourceName || !targetName), we end up with the possibility of undefined here for these two items... If you're okay with it, let's get this in and I can look into that separately.

@wackerow wackerow marked this pull request as ready for review February 16, 2024 17:25
@wackerow wackerow merged commit 074c989 into dev Feb 16, 2024
11 checks passed
@wackerow wackerow deleted the intl-empty-strings branch February 16, 2024 17:27
@wackerow wackerow restored the intl-empty-strings branch February 16, 2024 17:27
@pettinarip
Copy link
Member

@wackerow we should assign something to those vars

if (!sourceName) {
  console.error(...)
  sourceName = ""
}

if (!targetName) {
  console.error(...)
  targetName = ""
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
translation 🌍 This is related to our Translation Program
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants