Merge branch 'main' into update-packages

This commit is contained in:
Cooper 2025-05-07 12:10:19 -04:00 committed by GitHub
commit f08bca6530
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 2257 additions and 2105 deletions

View file

@ -53,6 +53,7 @@
"hls.js": "^1.5.19",
"i18next": "^23.16.8",
"immer": "^10.1.1",
"iso-639-3": "^3.0.1",
"jwt-decode": "^4.0.0",
"lodash.isequal": "^4.5.0",
"lodash.merge": "^4.6.2",

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,4 @@
import { iso6393To1 } from "iso-639-3";
import { useCallback } from "react";
import { useTranslation } from "react-i18next";
@ -53,10 +54,16 @@ export function AudioView({ id }: { id: string }) {
<AudioOption
key={v.id}
selected={v.id === currentAudioTrack?.id}
langCode={v.language}
langCode={
v.language.length === 3
? (iso6393To1[v.language] ?? v.language)
: v.language
}
onClick={audioTracks.includes(v) ? () => change(v) : undefined}
>
{getPrettyLanguageNameFromLocale(v.language) ?? unknownChoice}
{getPrettyLanguageNameFromLocale(v.language) ??
v.label ??
unknownChoice}
</AudioOption>
))}
</Menu.Section>

View file

@ -41,6 +41,7 @@ export function SettingsMenu({ id }: { id: string }) {
const selectedAudioLanguagePretty = currentAudioTrack
? (getPrettyLanguageNameFromLocale(currentAudioTrack.language) ??
currentAudioTrack.label ??
t("player.menus.subtitles.unknownLanguage"))
: undefined;

View file

@ -1,5 +1,6 @@
import countryLanguages, { LanguageObj } from "@ladjs/country-language";
import { getTag } from "@sozialhelden/ietf-language-tags";
import { iso6393To1 } from "iso-639-3";
const languageOrder = ["en", "hi", "fr", "de", "nl", "pt"];
@ -99,7 +100,10 @@ function populateLanguageCode(language: string): string {
* @returns pretty format for language, null if it no info can be found for language
*/
export function getPrettyLanguageNameFromLocale(locale: string): string | null {
const tag = getTag(locale, true);
const tag =
locale.length === 3
? getTag(iso6393To1[locale] ?? locale, true)
: getTag(locale, true);
const lang = tag?.language?.Description?.[0] ?? null;
if (!lang) return null;