From 364ce46fe5964cb9fb6e68851e72a5da3f5a2c10 Mon Sep 17 00:00:00 2001 From: Simon Caron <8635747+simoncaron@users.noreply.github.com> Date: Mon, 13 Jan 2025 22:30:57 -0500 Subject: [PATCH] Screen Orientation Enum + Subtitle Mode --- components/settings/OtherSettings.tsx | 6 +++--- components/settings/SubtitleToggles.tsx | 12 ++++++++++-- translations/en.json | 22 +++++++++++++++++++++- translations/fr.json | 22 +++++++++++++++++++++- utils/atoms/settings.ts | 20 ++++++++++---------- 5 files changed, 65 insertions(+), 17 deletions(-) diff --git a/components/settings/OtherSettings.tsx b/components/settings/OtherSettings.tsx index a7249d6c..51c92717 100644 --- a/components/settings/OtherSettings.tsx +++ b/components/settings/OtherSettings.tsx @@ -98,17 +98,17 @@ export const OtherSettings: React.FC = () => { disabled={pluginSettings?.defaultVideoOrientation?.locked || settings.autoRotate} keyExtractor={String} titleExtractor={(item) => - ScreenOrientationEnum[item] + t(ScreenOrientationEnum[item]) } title={ - {ScreenOrientationEnum[settings.defaultVideoOrientation]} + {t(ScreenOrientationEnum[settings.defaultVideoOrientation])} } - label="Orientation" + label={t("home.settings.other.orientation")} onSelected={(defaultVideoOrientation) => updateSettings({defaultVideoOrientation}) } diff --git a/components/settings/SubtitleToggles.tsx b/components/settings/SubtitleToggles.tsx index a22fcc99..3748d0e5 100644 --- a/components/settings/SubtitleToggles.tsx +++ b/components/settings/SubtitleToggles.tsx @@ -31,6 +31,14 @@ export const SubtitleToggles: React.FC = ({ ...props }) => { SubtitlePlaybackMode.None, ]; + const subtitleModeKeys = { + [SubtitlePlaybackMode.Default]: "home.settings.subtitles.modes.Default", + [SubtitlePlaybackMode.Smart]: "home.settings.subtitles.modes.Smart", + [SubtitlePlaybackMode.OnlyForced]: "home.settings.subtitles.modes.OnlyForced", + [SubtitlePlaybackMode.Always]: "home.settings.subtitles.modes.Always", + [SubtitlePlaybackMode.None]: "home.settings.subtitles.modes.None", + }; + return ( = ({ ...props }) => { data={subtitleModes} disabled={pluginSettings?.subtitleMode?.locked} keyExtractor={String} - titleExtractor={String} + titleExtractor={(item) => t(subtitleModeKeys[item]) || String(item)} title={ - {settings?.subtitleMode || t("home.settings.subtitles.loading")} + {t(subtitleModeKeys[settings?.subtitleMode]) || t("home.settings.subtitles.loading")} = { - [ScreenOrientation.OrientationLock.DEFAULT]: "Default", - [ScreenOrientation.OrientationLock.ALL]: "All", - [ScreenOrientation.OrientationLock.PORTRAIT]: "Portrait", - [ScreenOrientation.OrientationLock.PORTRAIT_UP]: "Portrait Up", - [ScreenOrientation.OrientationLock.PORTRAIT_DOWN]: "Portrait Down", - [ScreenOrientation.OrientationLock.LANDSCAPE]: "Landscape", - [ScreenOrientation.OrientationLock.LANDSCAPE_LEFT]: "Landscape Left", - [ScreenOrientation.OrientationLock.LANDSCAPE_RIGHT]: "Landscape Right", - [ScreenOrientation.OrientationLock.OTHER]: "Other", - [ScreenOrientation.OrientationLock.UNKNOWN]: "Unknown", + [ScreenOrientation.OrientationLock.DEFAULT]: "home.settings.other.orientations.DEFAULT", + [ScreenOrientation.OrientationLock.ALL]: "home.settings.other.orientations.ALL", + [ScreenOrientation.OrientationLock.PORTRAIT]: "home.settings.other.orientations.PORTRAIT", + [ScreenOrientation.OrientationLock.PORTRAIT_UP]: "home.settings.other.orientations.PORTRAIT_UP", + [ScreenOrientation.OrientationLock.PORTRAIT_DOWN]: "home.settings.other.orientations.PORTRAIT_DOWN", + [ScreenOrientation.OrientationLock.LANDSCAPE]: "home.settings.other.orientations.LANDSCAPE", + [ScreenOrientation.OrientationLock.LANDSCAPE_LEFT]: "home.settings.other.orientations.LANDSCAPE_LEFT", + [ScreenOrientation.OrientationLock.LANDSCAPE_RIGHT]: "home.settings.other.orientations.LANDSCAPE_RIGHT", + [ScreenOrientation.OrientationLock.OTHER]: "home.settings.other.orientations.OTHER", + [ScreenOrientation.OrientationLock.UNKNOWN]: "home.settings.other.orientations.UNKNOWN", }; export const DownloadOptions: DownloadOption[] = [