Skip to content

ref(device-contexts): Add function that returns a more detailed desc of a language #26558

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

Merged

Conversation

priscilawebdev
Copy link
Member

@priscilawebdev priscilawebdev commented Jun 11, 2021

closes #26004

@priscilawebdev priscilawebdev force-pushed the ref/display-lang-of-device-context-in-more-human-form branch from c57eb63 to e540929 Compare June 11, 2021 09:55
@priscilawebdev priscilawebdev marked this pull request as ready for review June 11, 2021 14:40
@priscilawebdev priscilawebdev requested a review from a team June 11, 2021 14:41

return languageName;
} catch (error) {
Sentry.captureException(error);
Copy link
Member

Choose a reason for hiding this comment

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

I'm not familiar with how many browsers have Intl.DisplayNames should we check for it first before logging an exception

Copy link
Member

Choose a reason for hiding this comment

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

@priscilawebdev priscilawebdev merged commit 977ab9e into master Jun 14, 2021
@priscilawebdev priscilawebdev deleted the ref/display-lang-of-device-context-in-more-human-form branch June 14, 2021 06:27
Comment on lines +73 to +75
const [languageAbbreviation, countryAbbreviation] = locale.includes('_')
? locale.split('_')
: locale.split('-');
Copy link
Member

Choose a reason for hiding this comment

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

If you ever get a name like a-b-c, you're gonna be in trouble. Could that happen?

: locale.split('-');

try {
const languageNames = new (Intl as any).DisplayNames(sentryAppLanguageCode, {
Copy link
Member

Choose a reason for hiding this comment

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

Might be good to comment here about the as any cast: microsoft/TypeScript#41338

@github-actions github-actions bot locked and limited conversation to collaborators Jun 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display language of Device context in a more human readable form
3 participants