-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(UI): Use Intl.DisplayNames to show the language name #5365
Conversation
Incremental code coverage: 100.00% |
@@ -199,6 +199,18 @@ shaka.ui.LanguageUtils = class { | |||
// When there is a loss of specificity (either to a base language or to | |||
// "unknown"), we should append the original language code. | |||
// Otherwise, there may be multiple identical-looking items in the list. | |||
if (window.Intl && 'DisplayNames' in Intl) { |
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.
You could put this above line 194, right? Since we don't use the value of language
that we get from that line.
That would also give us room for a comment describing what Intl.DisplayNames
is, and why we are using it preferentially.
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.
Done!
This is causing test failures on Google TV devices, and I think the tests are correct. For some reason, Intl.DisplayNames is returning garbage for most things on that device. On Chrome on Linux, I would like to start by reverting this change to make the tests green. We can follow-up with a change that either excludes Google TV devices or that falls back to the internal map when the output matches the input. |
No description provided.