Methods
(static) languageBaseCode(code) → {string}
languageBaseCode: One canonical form of a language code, for comparing codes written in different ISO 639 forms: "fra", "fre" and "fr" all give "fr", "sw" and "swa" give "sw". A region or script suffix is dropped first ("pt-BR" becomes "pt"), as resolveLanguageName() does. A code neither map knows is returned lowercased as-is.
| Name | Type | Description |
|---|---|---|
code | dynamic | Language code in any common form |
- Source
- Canonical code, or "" when code is missing or empty
- Type:
- string
(static) languageEnglishFallbacks() → {object}
Comprehensive English-name fallback for ISO 639-2 codes that the app does not have a UI translation for (for example "lat" Latin, "swa" Swahili). Used as tier 2 by resolveLanguageName(): translatable languages always go through translate() first; this only fires when no LanguageX key exists for the resolved base code, ensuring no recognized 3-letter code ever displays raw.
Names are the official ISO 639-2 forms. They are intentionally not routed through the i18n pipeline: these languages are unlikely to be a UI locale for our users, so the maintenance cost of translating "Akkadian" into Polish (etc.) outweighs the UX benefit. Users see the English name in any UI when an audio/subtitle track is in one of these less-common languages.
Cached on the caller's m scope after first build.
- AssocArray of 3-letter ISO 639-2 code to English name
- Type:
- object
(static) languageTranslationKeys() → {object}
Maps a normalized 2-letter base code (or a 3-letter code for languages without a 639-1 equivalent) to the translation key used by translate() for the localized language name. Keys must exist in locale/custom/en_US.json.
Region/script suffixes (for example "_BR", "_Hant") are stripped before lookup by resolveLanguageName(), so en_GB and en_US both land at "en", then LanguageEn.
Cached on the caller's m scope after first build.
- Source
- AssocArray of base code to translationKeys.* string
- Type:
- object
(static) languagesMatch(a, b) → {boolean}
languagesMatch: True when two language codes name the same language, whatever ISO 639 form each is written in (see languageBaseCode()). Regional variants count as the same language.
| Name | Type | Description |
|---|---|---|
a | dynamic | Language code |
b | dynamic | Language code |
- Source
- False when either code is missing or empty
- Type:
- boolean
(static) mediaLanguageAliases() → {object}
Maps 3-letter ISO 639-2 codes (T = terminological, B = bibliographic) and deprecated ISO 639-1 codes to the 2-letter base codes used by the app's translation system. Only languages the app supports as a UI locale are covered (see scripts/lint/update-translations.cjs LANGUAGE_METADATA).
Why this exists: ffmpeg/Jellyfin pass through whatever the container metadata holds: most modern files use 639-2/T (for example "fra"), older or hand-tagged files use 639-2/B (for example "fre"), and some use 639-1 ("fr" already, no alias needed). MediaStream.Language is therefore not a single standardized format; this map normalizes to one canonical form.
3-letter codes that have no 2-letter ISO 639-1 equivalent (ckb, fil, gsw, jbo, kab) are not aliased here: they're looked up directly in languageTranslationKeys() under their 3-letter form.
Cached on the caller's m scope after first build to avoid reallocating on every audio/subtitle render.
- Source
- AssocArray of 3-letter alias to 2-letter base code
- Type:
- object
(static) mediaLanguageMatchAliases() → {object}
ISO 639-2 codes for the languages mediaLanguageAliases() leaves out (it covers only UI locales), mapped to their ISO 639-1 code. For language MATCHING only: see languageBaseCode(). Kept apart from mediaLanguageAliases() because display depends on that map's gaps: languageEnglishFallbacks() is keyed by the 3-letter code, so aliasing "swa" to "sw" there would show Swahili as the raw "swa".
Source: the ISO 639-2 list (Library of Congress) as Jellyfin 12.0 ships it, Emby.Server.Implementations/Localization/iso6392.txt: every code with an ISO 639-1 equivalent that mediaLanguageAliases() does not already map. lint:language-coverage fails if the two maps overlap.
- Source
- AssocArray of 3-letter code to 2-letter code
- Type:
- object