mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-02-01 16:08:04 +00:00
feat(tv): add language selector
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
} from "@/components/tv";
|
||||
import { useScaledTVTypography } from "@/constants/TVTypography";
|
||||
import { useTVOptionModal } from "@/hooks/useTVOptionModal";
|
||||
import { APP_LANGUAGES } from "@/i18n";
|
||||
import { apiAtom, useJellyfin, userAtom } from "@/providers/JellyfinProvider";
|
||||
import {
|
||||
AudioTranscodeMode,
|
||||
@@ -49,6 +50,7 @@ export default function SettingsTV() {
|
||||
const currentTypographyScale =
|
||||
settings.tvTypographyScale || TVTypographyScale.Default;
|
||||
const currentCacheMode = settings.mpvCacheEnabled ?? "auto";
|
||||
const currentLanguage = settings.preferedLanguage;
|
||||
|
||||
// Audio transcoding options
|
||||
const audioTranscodeModeOptions: TVOptionItem<AudioTranscodeMode>[] = useMemo(
|
||||
@@ -189,6 +191,23 @@ export default function SettingsTV() {
|
||||
[t, currentTypographyScale],
|
||||
);
|
||||
|
||||
// Language options
|
||||
const languageOptions: TVOptionItem<string | undefined>[] = useMemo(
|
||||
() => [
|
||||
{
|
||||
label: t("home.settings.languages.system"),
|
||||
value: undefined,
|
||||
selected: !currentLanguage,
|
||||
},
|
||||
...APP_LANGUAGES.map((lang) => ({
|
||||
label: lang.label,
|
||||
value: lang.value,
|
||||
selected: currentLanguage === lang.value,
|
||||
})),
|
||||
],
|
||||
[t, currentLanguage],
|
||||
);
|
||||
|
||||
// Get display labels for option buttons
|
||||
const audioTranscodeLabel = useMemo(() => {
|
||||
const option = audioTranscodeModeOptions.find((o) => o.selected);
|
||||
@@ -220,6 +239,12 @@ export default function SettingsTV() {
|
||||
return option?.label || t("home.settings.buffer.cache_auto");
|
||||
}, [cacheModeOptions, t]);
|
||||
|
||||
const languageLabel = useMemo(() => {
|
||||
if (!currentLanguage) return t("home.settings.languages.system");
|
||||
const option = APP_LANGUAGES.find((l) => l.value === currentLanguage);
|
||||
return option?.label || t("home.settings.languages.system");
|
||||
}, [currentLanguage, t]);
|
||||
|
||||
return (
|
||||
<View style={{ flex: 1, backgroundColor: "#000000" }}>
|
||||
<View style={{ flex: 1 }}>
|
||||
@@ -480,6 +505,18 @@ export default function SettingsTV() {
|
||||
})
|
||||
}
|
||||
/>
|
||||
<TVSettingsOptionButton
|
||||
label={t("home.settings.languages.app_language")}
|
||||
value={languageLabel}
|
||||
onPress={() =>
|
||||
showOptions({
|
||||
title: t("home.settings.languages.app_language"),
|
||||
options: languageOptions,
|
||||
onSelect: (value) =>
|
||||
updateSettings({ preferedLanguage: value }),
|
||||
})
|
||||
}
|
||||
/>
|
||||
<TVSettingsToggle
|
||||
label={t(
|
||||
"home.settings.appearance.merge_next_up_continue_watching",
|
||||
|
||||
Reference in New Issue
Block a user