mirror of
https://github.com/p-stream/p-stream.git
synced 2026-03-24 05:47:42 +00:00
Merge branch 'main' into update-packages
This commit is contained in:
commit
f08bca6530
5 changed files with 2257 additions and 2105 deletions
|
|
@ -53,6 +53,7 @@
|
||||||
"hls.js": "^1.5.19",
|
"hls.js": "^1.5.19",
|
||||||
"i18next": "^23.16.8",
|
"i18next": "^23.16.8",
|
||||||
"immer": "^10.1.1",
|
"immer": "^10.1.1",
|
||||||
|
"iso-639-3": "^3.0.1",
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
"lodash.isequal": "^4.5.0",
|
"lodash.isequal": "^4.5.0",
|
||||||
"lodash.merge": "^4.6.2",
|
"lodash.merge": "^4.6.2",
|
||||||
|
|
|
||||||
4343
pnpm-lock.yaml
4343
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { iso6393To1 } from "iso-639-3";
|
||||||
import { useCallback } from "react";
|
import { useCallback } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
|
@ -53,10 +54,16 @@ export function AudioView({ id }: { id: string }) {
|
||||||
<AudioOption
|
<AudioOption
|
||||||
key={v.id}
|
key={v.id}
|
||||||
selected={v.id === currentAudioTrack?.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}
|
onClick={audioTracks.includes(v) ? () => change(v) : undefined}
|
||||||
>
|
>
|
||||||
{getPrettyLanguageNameFromLocale(v.language) ?? unknownChoice}
|
{getPrettyLanguageNameFromLocale(v.language) ??
|
||||||
|
v.label ??
|
||||||
|
unknownChoice}
|
||||||
</AudioOption>
|
</AudioOption>
|
||||||
))}
|
))}
|
||||||
</Menu.Section>
|
</Menu.Section>
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ export function SettingsMenu({ id }: { id: string }) {
|
||||||
|
|
||||||
const selectedAudioLanguagePretty = currentAudioTrack
|
const selectedAudioLanguagePretty = currentAudioTrack
|
||||||
? (getPrettyLanguageNameFromLocale(currentAudioTrack.language) ??
|
? (getPrettyLanguageNameFromLocale(currentAudioTrack.language) ??
|
||||||
|
currentAudioTrack.label ??
|
||||||
t("player.menus.subtitles.unknownLanguage"))
|
t("player.menus.subtitles.unknownLanguage"))
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import countryLanguages, { LanguageObj } from "@ladjs/country-language";
|
import countryLanguages, { LanguageObj } from "@ladjs/country-language";
|
||||||
import { getTag } from "@sozialhelden/ietf-language-tags";
|
import { getTag } from "@sozialhelden/ietf-language-tags";
|
||||||
|
import { iso6393To1 } from "iso-639-3";
|
||||||
|
|
||||||
const languageOrder = ["en", "hi", "fr", "de", "nl", "pt"];
|
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
|
* @returns pretty format for language, null if it no info can be found for language
|
||||||
*/
|
*/
|
||||||
export function getPrettyLanguageNameFromLocale(locale: string): string | null {
|
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;
|
const lang = tag?.language?.Description?.[0] ?? null;
|
||||||
if (!lang) return null;
|
if (!lang) return null;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue