fix(locale): translate HLS audio track labels to native names (SUP-52289)#878
Open
MosheMaorKaltura wants to merge 1 commit into
Open
fix(locale): translate HLS audio track labels to native names (SUP-52289)#878MosheMaorKaltura wants to merge 1 commit into
MosheMaorKaltura wants to merge 1 commit into
Conversation
…S audio tracks (SUP-52289) HLS manifests from the Kaltura CDN use English words as NAME= attributes (e.g. "Spanish", "Portuguese") while DASH manifests carry ISO language codes that flow through as native names. The native adapter was reading audioTracks[i].label verbatim, showing English words instead of the native language name (e.g. "español", "português", "日本語") on iOS Safari. - Add getNativeLanguageName(langCode, fallback) to locale.ts using Intl.DisplayNames; falls back to the provided string when the API is unavailable or the code is invalid. - Export the function from playkit.ts so adapters can import it. - Apply the function in NativeAdapter._getParsedAudioTracks to derive the label from the ISO language code rather than the browser-provided label. - Add regression tests in tests/e2e/utils/locale.spec.js. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On iOS Safari, audio track labels show English words ("Spanish", "Portuguese", "Japanese") instead of native language names ("Español", "Português", "日本語").
Root cause: NativeAdapter._getParsedAudioTracks uses audioTracks[i].label verbatim. On iOS Safari this is the English NAME= value from the HLS manifest. The ISO language code (LANGUAGE= attribute) is available but was not used for display.
The Kaltura CDN generates HLS manifests with English NAME= values for audio tracks (NAME="Spanish") but native names for subtitles (NAME="Español") — inconsistency at the CDN level that the player should resolve.
Fix
Add getNativeLanguageName(langCode, fallback) to src/utils/locale.ts using Intl.DisplayNames (iOS Safari 14+, all modern browsers). Converts ISO codes to native names:
Falls back to the provided string when langCode is empty/null/undefined, Intl.DisplayNames is unavailable, or the code is unrecognised.
Apply in NativeAdapter._getParsedAudioTracks and export from playkit.ts for adapters.
Files Changed
Tests
Regression: tests/e2e/utils/locale.spec.js — PASS (11/11)
Full suite: no new failures.
Companion PR
kaltura/playkit-js-hls — same fix applied to hls.js adapter _parseAudioTracks
Jira
https://kaltura.atlassian.net/browse/SUP-52289