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

feat(UI): Use Intl.DisplayNames to show the language name #5365

Merged
merged 2 commits into from
Jun 28, 2023

Conversation

avelad
Copy link
Member

@avelad avelad commented Jun 28, 2023

No description provided.

@avelad avelad added type: enhancement New feature or request component: UI The issue involves the Shaka Player UI priority: P3 Useful but not urgent labels Jun 28, 2023
@avelad avelad added this to the v4.4 milestone Jun 28, 2023
@avelad avelad requested review from joeyparrish and theodab June 28, 2023 08:39
@github-actions
Copy link
Contributor

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) {
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@avelad avelad requested a review from theodab June 28, 2023 10:50
@avelad avelad merged commit 35cb193 into shaka-project:main Jun 28, 2023
@avelad avelad deleted the international-languages branch June 28, 2023 12:11
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Aug 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2023
@joeyparrish
Copy link
Member

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, en yields English and fr yields français. On Google TV, en yields en and fr yields fr. We shouldn't use this if it's unreliable.

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: UI The issue involves the Shaka Player UI priority: P3 Useful but not urgent status: archived Archived and locked; will not be updated type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants