-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
ref(device-contexts): Add function that returns a more detailed desc of a language #26558
Conversation
c57eb63
to
e540929
Compare
|
||
return languageName; | ||
} catch (error) { | ||
Sentry.captureException(error); |
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.
I'm not familiar with how many browsers have Intl.DisplayNames
should we check for it first before logging an exception
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.
nevermind seems okay https://caniuse.com/mdn-javascript_builtins_intl_displaynames_displaynames
const [languageAbbreviation, countryAbbreviation] = locale.includes('_') | ||
? locale.split('_') | ||
: locale.split('-'); |
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.
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, { |
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.
Might be good to comment here about the as any
cast: microsoft/TypeScript#41338
closes #26004