From 05489282dfb8b6cc6fe9f9ef047372a9a4da864d Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Sun, 16 Mar 2025 02:37:05 +0800 Subject: [PATCH] cjk: always show vertical layout options in CJK locale (#613) --- .../reader/components/settings/LayoutPanel.tsx | 5 +++-- apps/readest-app/src/services/constants.ts | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/apps/readest-app/src/app/reader/components/settings/LayoutPanel.tsx b/apps/readest-app/src/app/reader/components/settings/LayoutPanel.tsx index 05f087d4..9fa0fa50 100644 --- a/apps/readest-app/src/app/reader/components/settings/LayoutPanel.tsx +++ b/apps/readest-app/src/app/reader/components/settings/LayoutPanel.tsx @@ -7,9 +7,11 @@ import { useSettingsStore } from '@/store/settingsStore'; import { useReaderStore } from '@/store/readerStore'; import { useBookDataStore } from '@/store/bookDataStore'; import { useTranslation } from '@/hooks/useTranslation'; +import { isCJKEnv } from '@/utils/misc'; import { getStyles } from '@/utils/style'; import { getMaxInlineSize } from '@/utils/config'; import { getBookDirFromWritingMode, getBookLangCode } from '@/utils/book'; +import { MIGHT_BE_RTL_LANGS } from '@/services/constants'; import NumberInput from './NumberInput'; const LayoutPanel: React.FC<{ bookKey: string }> = ({ bookKey }) => { @@ -244,8 +246,7 @@ const LayoutPanel: React.FC<{ bookKey: string }> = ({ bookKey }) => { }, [borderColor]); const langCode = getBookLangCode(bookData.bookDoc?.metadata?.language); - const mightBeRTLBook = - langCode === 'zh' || langCode === 'ja' || langCode === 'ko' || langCode === ''; + const mightBeRTLBook = MIGHT_BE_RTL_LANGS.includes(langCode) || isCJKEnv(); return (
diff --git a/apps/readest-app/src/services/constants.ts b/apps/readest-app/src/services/constants.ts index 04d2c482..bdb2a376 100644 --- a/apps/readest-app/src/services/constants.ts +++ b/apps/readest-app/src/services/constants.ts @@ -458,3 +458,18 @@ export const CUSTOM_THEME_TEMPLATES = [ }, }, ]; + +export const MIGHT_BE_RTL_LANGS = [ + 'zh', + 'ja', + 'ko', + 'ar', + 'he', + 'fa', + 'ur', + 'dv', + 'ps', + 'sd', + 'yi', + '', +];