Skip to content

fix(locale): translate HLS audio track labels to native names (SUP-52289)#878

Open
MosheMaorKaltura wants to merge 1 commit into
masterfrom
fix/SUP-52289-hls-audio-track-labels-not-translated
Open

fix(locale): translate HLS audio track labels to native names (SUP-52289)#878
MosheMaorKaltura wants to merge 1 commit into
masterfrom
fix/SUP-52289-hls-audio-track-labels-not-translated

Conversation

@MosheMaorKaltura

Copy link
Copy Markdown
Contributor

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:

  • es → español, pt → português, ja → 日本語, en → English

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

  • src/utils/locale.ts — new getNativeLanguageName() utility
  • src/playkit.ts — export getNativeLanguageName
  • src/engines/html5/media-source/adapters/native-adapter.ts — use getNativeLanguageName in _getParsedAudioTracks
  • tests/e2e/utils/locale.spec.js — 11 regression assertions

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

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant