diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 70812c87..c72668a5 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -66,7 +66,7 @@ jobs: - name: install Dependencies working-directory: apps/readest-app run: | - pnpm install && pnpm setup-pdfjs + pnpm install && pnpm setup-vendors - name: run tests working-directory: apps/readest-app diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e98eba7..47022128 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -180,8 +180,8 @@ jobs: - name: install dependencies run: pnpm install - - name: copy pdfjs-dist to public directory - run: pnpm --filter @readest/readest-app setup-pdfjs + - name: copy pdfjs-dist and simplecc-dist to public directory + run: pnpm --filter @readest/readest-app setup-vendors - name: install Rust stable uses: dtolnay/rust-toolchain@stable diff --git a/.gitmodules b/.gitmodules index 20784d95..8f8ee9b1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "packages/tauri-plugins"] path = packages/tauri-plugins url = https://github.com/readest/tauri-plugins-workspace.git +[submodule "packages/simplecc-wasm"] + path = packages/simplecc-wasm + url = https://github.com/readest/simplecc-wasm.git diff --git a/README.md b/README.md index aa5f5f17..6f1ae096 100644 --- a/README.md +++ b/README.md @@ -145,8 +145,8 @@ cd readest # might need to rerun this when code is updated git submodule update --init --recursive pnpm install -# copy pdfjs-dist to Next.js public directory -pnpm --filter @readest/readest-app setup-pdfjs +# copy vendors dist libs to public directory +pnpm --filter @readest/readest-app setup-vendors ``` ### 3. Verify Dependencies Installation diff --git a/apps/readest-app/package.json b/apps/readest-app/package.json index ad754b39..12daed14 100644 --- a/apps/readest-app/package.json +++ b/apps/readest-app/package.json @@ -14,14 +14,17 @@ "lint": "eslint .", "test": "dotenv -e .env -e .env.test.local vitest", "tauri": "tauri", - "prepare-public-vendor": "mkdirp ./public/vendor/pdfjs", + "prepare-public-vendor": "mkdirp ./public/vendor/pdfjs ./public/vendor/simplecc", "copy-pdfjs-js": "cpx \"../../packages/foliate-js/node_modules/pdfjs-dist/legacy/build/{pdf.worker.min.mjs,pdf.mjs,pdf.d.mts}\" ./public/vendor/pdfjs", "copy-pdfjs-fonts": "cpx \"../../packages/foliate-js/node_modules/pdfjs-dist/{cmaps,standard_fonts}/*\" ./public/vendor/pdfjs", "copy-flatten-pdfjs-annotation-layer-css": "npx postcss \"../../packages/foliate-js/vendor/pdfjs/annotation_layer_builder.css\" --no-map -u postcss-nested > ./public/vendor/pdfjs/annotation_layer_builder.css", "copy-flatten-pdfjs-text-layer-css": "npx postcss \"../../packages/foliate-js/vendor/pdfjs/text_layer_builder.css\" --no-map -u postcss-nested > ./public/vendor/pdfjs/text_layer_builder.css", "copy-flatten-pdfjs-css": "pnpm copy-flatten-pdfjs-annotation-layer-css && pnpm copy-flatten-pdfjs-text-layer-css", "copy-pdfjs": "pnpm copy-pdfjs-js && pnpm copy-pdfjs-fonts && pnpm copy-flatten-pdfjs-css", + "copy-simplecc": "cpx \"../../packages/simplecc-wasm/dist/web/*\" ./public/vendor/simplecc", "setup-pdfjs": "pnpm prepare-public-vendor && pnpm copy-pdfjs", + "setup-simplecc": "pnpm prepare-public-vendor && pnpm copy-simplecc", + "setup-vendors": "pnpm setup-pdfjs && pnpm setup-simplecc", "build-win-x64": "dotenv -e .env.tauri.local -- tauri build --target i686-pc-windows-msvc --bundles nsis", "build-win-arm64": "dotenv -e .env.tauri.local -- tauri build --target aarch64-pc-windows-msvc --bundles nsis", "build-linux-x64": "dotenv -e .env.tauri.local -- tauri build --target x86_64-unknown-linux-gnu --bundles appimage", diff --git a/apps/readest-app/public/locales/ar/translation.json b/apps/readest-app/public/locales/ar/translation.json index 108c32d0..a96dd2ba 100644 --- a/apps/readest-app/public/locales/ar/translation.json +++ b/apps/readest-app/public/locales/ar/translation.json @@ -675,5 +675,16 @@ "Unable to open book": "غير قادر على فتح الكتاب", "Punctuation": "علامات الترقيم", "Replace Quotation Marks": "استبدال علامات الاقتباس", - "Enabled only in vertical layout.": "مفعل فقط في التخطيط الرأسي." + "Enabled only in vertical layout.": "مفعل فقط في التخطيط الرأسي.", + "No Conversion": "لا تحويل", + "Simplified to Traditional": "من المبسّط إلى التقليدي", + "Traditional to Simplified": "من التقليدي إلى المبسّط", + "Simplified to Traditional (Taiwan)": "مبسّط → تقليدي (تايوان)", + "Simplified to Traditional (Hong Kong)": "مبسّط → تقليدي (هونغ كونغ)", + "Simplified to Traditional (Taiwan), with phrases": "مبسّط → تقليدي (تايوان • عبارات)", + "Traditional (Taiwan) to Simplified": "تقليدي (تايوان) → مبسّط", + "Traditional (Hong Kong) to Simplified": "تقليدي (هونغ كونغ) → مبسّط", + "Traditional (Taiwan) to Simplified, with phrases": "تقليدي (تايوان • عبارات) → مبسّط", + "Convert Simplified and Traditional Chinese": "تحويل المبسّط/التقليدي", + "Convert Mode": "وضع التحويل" } diff --git a/apps/readest-app/public/locales/bn/translation.json b/apps/readest-app/public/locales/bn/translation.json index d1aced67..83d79c79 100644 --- a/apps/readest-app/public/locales/bn/translation.json +++ b/apps/readest-app/public/locales/bn/translation.json @@ -659,5 +659,16 @@ "Unable to open book": "বই খুলতে অক্ষম", "Punctuation": "বিরামচিহ্ন", "Replace Quotation Marks": "উদ্ধৃতি চিহ্ন প্রতিস্থাপন করুন", - "Enabled only in vertical layout.": "শুধুমাত্র উল্লম্ব বিন্যাসে সক্রিয়।" + "Enabled only in vertical layout.": "শুধুমাত্র উল্লম্ব বিন্যাসে সক্রিয়।", + "No Conversion": "রূপান্তর নয়", + "Simplified to Traditional": "সরল → প্রথাগত", + "Traditional to Simplified": "প্রথাগত → সরল", + "Simplified to Traditional (Taiwan)": "সরল → প্রথাগত (তাইওয়ান)", + "Simplified to Traditional (Hong Kong)": "সরল → প্রথাগত (হংকং)", + "Simplified to Traditional (Taiwan), with phrases": "সরল → প্রথাগত (তাইওয়ান • বাক্য)", + "Traditional (Taiwan) to Simplified": "প্রথাগত (তাইওয়ান) → সরল", + "Traditional (Hong Kong) to Simplified": "প্রথাগত (হংকং) → সরল", + "Traditional (Taiwan) to Simplified, with phrases": "প্রথাগত (তাইওয়ান • বাক্য) → সরল", + "Convert Simplified and Traditional Chinese": "সরল/প্রথাগত রূপান্তর", + "Convert Mode": "রূপান্তর মোড" } diff --git a/apps/readest-app/public/locales/bo/translation.json b/apps/readest-app/public/locales/bo/translation.json index ef5245df..776975fa 100644 --- a/apps/readest-app/public/locales/bo/translation.json +++ b/apps/readest-app/public/locales/bo/translation.json @@ -655,5 +655,16 @@ "Unable to open book": "དེབ་ཀྱི་སྤྱོད་བྱས་མ་ཐུབ།", "Punctuation": "ཚིག་གྲུབ།", "Replace Quotation Marks": "འདྲེན་འབྲེལ་མཐུད་ཐིག་བརྗེ་བ།", - "Enabled only in vertical layout.": "གཡས་སྒྲིག་ནང་མིང་བརྗེ་བ།" + "Enabled only in vertical layout.": "གཡས་སྒྲིག་ནང་མིང་བརྗེ་བ།", + "No Conversion": "བསྒྱུར་བཤེར་མེད་", + "Simplified to Traditional": "སྟོང་བཟོས → སྲོལ་རྒྱུན", + "Traditional to Simplified": "སྲོལ་རྒྱུན → སྟོང་བཟོས", + "Simplified to Traditional (Taiwan)": "སྟོང་བཟོས → སྲོལ་རྒྱུན (ཏའི་ཝན)", + "Simplified to Traditional (Hong Kong)": "སྟོང་བཟོས → སྲོལ་རྒྱུན (ཧོང་ཀོང)", + "Simplified to Traditional (Taiwan), with phrases": "སྟོང་བཟོས → སྲོལ་རྒྱུན (ཏའི་ཝན • ཚིག་ཕྲེང)", + "Traditional (Taiwan) to Simplified": "སྲོལ་རྒྱུན (ཏའི་ཝན) → སྟོང་བཟོས", + "Traditional (Hong Kong) to Simplified": "སྲོལ་རྒྱུན (ཧོང་ཀོང) → སྟོང་བཟོས", + "Traditional (Taiwan) to Simplified, with phrases": "སྲོལ་རྒྱུན (ཏའི་ཝན • ཚིག་ཕྲེང) → སྟོང་བཟོས", + "Convert Simplified and Traditional Chinese": "རྒྱ་ཡིག སྟོང་བཟོས/སྲོལ་རྒྱུན བསྒྱུར་བ", + "Convert Mode": "བསྒྱུར་བའི་རྣམ་པ" } diff --git a/apps/readest-app/public/locales/de/translation.json b/apps/readest-app/public/locales/de/translation.json index 26cd803b..0323a53a 100644 --- a/apps/readest-app/public/locales/de/translation.json +++ b/apps/readest-app/public/locales/de/translation.json @@ -659,5 +659,16 @@ "Unable to open book": "Buch kann nicht geöffnet werden", "Punctuation": "Interpunktion", "Replace Quotation Marks": "Anführungszeichen ersetzen", - "Enabled only in vertical layout.": "Nur im vertikalen Layout aktiviert." + "Enabled only in vertical layout.": "Nur im vertikalen Layout aktiviert.", + "No Conversion": "Keine Konvertierung", + "Simplified to Traditional": "Vereinfacht → Traditionell", + "Traditional to Simplified": "Traditionell → Vereinfacht", + "Simplified to Traditional (Taiwan)": "Vereinfacht → Traditionell (Taiwan)", + "Simplified to Traditional (Hong Kong)": "Vereinfacht → Traditionell (Hongkong)", + "Simplified to Traditional (Taiwan), with phrases": "Vereinfacht → Traditionell (Taiwan • Phrasen)", + "Traditional (Taiwan) to Simplified": "Traditionell (Taiwan) → Vereinfacht", + "Traditional (Hong Kong) to Simplified": "Traditionell (Hongkong) → Vereinfacht", + "Traditional (Taiwan) to Simplified, with phrases": "Traditionell (Taiwan • Phrasen) → Vereinfacht", + "Convert Simplified and Traditional Chinese": "Vereinfach./Traditionell konvertieren", + "Convert Mode": "Konvertierungsmodus" } diff --git a/apps/readest-app/public/locales/el/translation.json b/apps/readest-app/public/locales/el/translation.json index 2133c778..f4bdc708 100644 --- a/apps/readest-app/public/locales/el/translation.json +++ b/apps/readest-app/public/locales/el/translation.json @@ -659,5 +659,16 @@ "Unable to open book": "Αδύνατη η άνοιγμα του βιβλίου", "Punctuation": "Στίξη", "Replace Quotation Marks": "Αντικατάσταση εισαγωγικών", - "Enabled only in vertical layout.": "Ενεργοποιημένο μόνο σε κάθετη διάταξη." + "Enabled only in vertical layout.": "Ενεργοποιημένο μόνο σε κάθετη διάταξη.", + "No Conversion": "Χωρίς μετατροπή", + "Simplified to Traditional": "Απλοπ. → Παραδ.", + "Traditional to Simplified": "Παραδ. → Απλοπ.", + "Simplified to Traditional (Taiwan)": "Απλοπ. → Παραδ. (Ταϊβάν)", + "Simplified to Traditional (Hong Kong)": "Απλοπ. → Παραδ. (Χονγκ Κονγκ)", + "Simplified to Traditional (Taiwan), with phrases": "Απλοπ. → Παραδ. (Ταϊβάν • φράσεις)", + "Traditional (Taiwan) to Simplified": "Παραδ. (Ταϊβάν) → Απλοπ.", + "Traditional (Hong Kong) to Simplified": "Παραδ. (Χονγκ Κονγκ) → Απλοπ.", + "Traditional (Taiwan) to Simplified, with phrases": "Παραδ. (Ταϊβάν • φράσεις) → Απλοπ.", + "Convert Simplified and Traditional Chinese": "Μετατροπή Απλοπ./Παραδ. Κινέζικων", + "Convert Mode": "Λειτουργία μετατροπής" } diff --git a/apps/readest-app/public/locales/es/translation.json b/apps/readest-app/public/locales/es/translation.json index bdfb437b..7d448fea 100644 --- a/apps/readest-app/public/locales/es/translation.json +++ b/apps/readest-app/public/locales/es/translation.json @@ -663,5 +663,16 @@ "Unable to open book": "No se puede abrir el libro", "Punctuation": "Signos de puntuación", "Replace Quotation Marks": "Reemplazar comillas", - "Enabled only in vertical layout.": "Habilitado solo en diseño vertical." + "Enabled only in vertical layout.": "Habilitado solo en diseño vertical.", + "No Conversion": "Sin conversión", + "Simplified to Traditional": "Simpl. → Trad.", + "Traditional to Simplified": "Trad. → Simpl.", + "Simplified to Traditional (Taiwán)": "Simpl. → Trad. (Taiwán)", + "Simplified to Traditional (Hong Kong)": "Simpl. → Trad. (Hong Kong)", + "Simplified to Traditional (Taiwán), with phrases": "Simpl. → Trad. (Taiwán • frases)", + "Traditional (Taiwán) to Simplified": "Trad. (Taiwán) → Simpl.", + "Traditional (Hong Kong) to Simplified": "Trad. (Hong Kong) → Simpl.", + "Traditional (Taiwán) to Simplified, with phrases": "Trad. (Taiwán • frases) → Simpl.", + "Convert Simplified and Traditional Chinese": "Convertir chino Simpl./Trad.", + "Convert Mode": "Modo de conversión" } diff --git a/apps/readest-app/public/locales/fa/translation.json b/apps/readest-app/public/locales/fa/translation.json index ff32294b..7416b48c 100644 --- a/apps/readest-app/public/locales/fa/translation.json +++ b/apps/readest-app/public/locales/fa/translation.json @@ -659,5 +659,16 @@ "Unable to open book": "قادر به باز کردن کتاب نیست", "Punctuation": "علامت نگارشی", "Replace Quotation Marks": "جایگزینی علامت نقل قول", - "Enabled only in vertical layout.": "فقط در طرح عمودی فعال است." + "Enabled only in vertical layout.": "فقط در طرح عمودی فعال است.", + "No Conversion": "بدون تبدیل", + "Simplified to Traditional": "ساده → سنتی", + "Traditional to Simplified": "سنتی → ساده", + "Simplified to Traditional (Taiwan)": "ساده → سنتی (تایوان)", + "Simplified to Traditional (Hong Kong)": "ساده → سنتی (هنگ‌کنگ)", + "Simplified to Traditional (Taiwan), with phrases": "ساده → سنتی (تایوان • عبارات)", + "Traditional (Taiwan) to Simplified": "سنتی (تایوان) → ساده", + "Traditional (Hong Kong) to Simplified": "سنتی (هنگ‌کنگ) → ساده", + "Traditional (Taiwan) to Simplified, with phrases": "سنتی (تایوان • عبارات) → ساده", + "Convert Simplified and Traditional Chinese": "تبدیل چینی ساده/سنتی", + "Convert Mode": "حالت تبدیل" } diff --git a/apps/readest-app/public/locales/fr/translation.json b/apps/readest-app/public/locales/fr/translation.json index 61aaaf90..8de55b19 100644 --- a/apps/readest-app/public/locales/fr/translation.json +++ b/apps/readest-app/public/locales/fr/translation.json @@ -663,5 +663,16 @@ "Unable to open book": "Impossible d'ouvrir le livre", "Punctuation": "Ponctuation", "Replace Quotation Marks": "Remplacer les guillemets", - "Enabled only in vertical layout.": "Activé uniquement en disposition verticale." + "Enabled only in vertical layout.": "Activé uniquement en disposition verticale.", + "No Conversion": "Pas de conversion", + "Simplified to Traditional": "Simp. → Trad.", + "Traditional to Simplified": "Trad. → Simp.", + "Simplified to Traditional (Taiwan)": "Simp. → Trad. (Taïwan)", + "Simplified to Traditional (Hong Kong)": "Simp. → Trad. (Hong Kong)", + "Simplified to Traditional (Taiwan), with phrases": "Simp. → Trad. (Taïwan • phrases)", + "Traditional (Taiwan) to Simplified": "Trad. (Taïwan) → Simp.", + "Traditional (Hong Kong) to Simplified": "Trad. (Hong Kong) → Simp.", + "Traditional (Taiwan) to Simplified, with phrases": "Trad. (Taïwan • phrases) → Simp.", + "Convert Simplified and Traditional Chinese": "Convertir chinois simp./trad.", + "Convert Mode": "Mode de conversion" } diff --git a/apps/readest-app/public/locales/hi/translation.json b/apps/readest-app/public/locales/hi/translation.json index 75340c83..f397880a 100644 --- a/apps/readest-app/public/locales/hi/translation.json +++ b/apps/readest-app/public/locales/hi/translation.json @@ -659,5 +659,16 @@ "Unable to open book": "पुस्तक खोलने में असमर्थ", "Punctuation": "विराम चिह्न", "Replace Quotation Marks": "उद्धरण चिह्न बदलें", - "Enabled only in vertical layout.": "केवल ऊर्ध्वाधर लेआउट में सक्षम।" + "Enabled only in vertical layout.": "केवल ऊर्ध्वाधर लेआउट में सक्षम।", + "No Conversion": "कोई रूपांतरण नहीं", + "Simplified to Traditional": "सरलीकृत → पारंपरिक", + "Traditional to Simplified": "पारंपरिक → सरलीकृत", + "Simplified to Traditional (Taiwan)": "सरलीकृत → पारंपरिक (ताइवान)", + "Simplified to Traditional (Hong Kong)": "सरलीकृत → पारंपरिक (हांगकांग)", + "Simplified to Traditional (Taiwan), with phrases": "सरलीकृत → पारंपरिक (ताइवान • वाक्यांश)", + "Traditional (Taiwan) to Simplified": "पारंपरिक (ताइवान) → सरलीकृत", + "Traditional (Hong Kong) to Simplified": "पारंपरिक (हांगकांग) → सरलीकृत", + "Traditional (Taiwan) to Simplified, with phrases": "पारंपरिक (ताइवान • वाक्यांश) → सरलीकृत", + "Convert Simplified and Traditional Chinese": "सरलीकृत/पारंपरिक चीनी रूपांतरण", + "Convert Mode": "रूपांतरण मोड" } diff --git a/apps/readest-app/public/locales/id/translation.json b/apps/readest-app/public/locales/id/translation.json index 4bfaf47f..9351edcd 100644 --- a/apps/readest-app/public/locales/id/translation.json +++ b/apps/readest-app/public/locales/id/translation.json @@ -655,5 +655,16 @@ "Unable to open book": "Tidak dapat membuka buku", "Punctuation": "Tanda Baca", "Replace Quotation Marks": "Ganti Tanda Kutip", - "Enabled only in vertical layout.": "Hanya diaktifkan dalam tata letak vertikal." + "Enabled only in vertical layout.": "Hanya diaktifkan dalam tata letak vertikal.", + "No Conversion": "Tanpa konversi", + "Simplified to Traditional": "Sederhana → Tradisional", + "Traditional to Simplified": "Tradisional → Sederhana", + "Simplified to Traditional (Taiwan)": "Sederhana → Tradisional (Taiwan)", + "Simplified to Traditional (Hong Kong)": "Sederhana → Tradisional (Hong Kong)", + "Simplified to Traditional (Taiwan), with phrases": "Sederhana → Tradisional (Taiwan • frasa)", + "Traditional (Taiwan) to Simplified": "Tradisional (Taiwan) → Sederhana", + "Traditional (Hong Kong) to Simplified": "Tradisional (Hong Kong) → Sederhana", + "Traditional (Taiwan) to Simplified, with phrases": "Tradisional (Taiwan • frasa) → Sederhana", + "Convert Simplified and Traditional Chinese": "Konversi Tionghoa Sederhana/Tradisional", + "Convert Mode": "Mode Konversi" } diff --git a/apps/readest-app/public/locales/it/translation.json b/apps/readest-app/public/locales/it/translation.json index cba46c63..6d346396 100644 --- a/apps/readest-app/public/locales/it/translation.json +++ b/apps/readest-app/public/locales/it/translation.json @@ -663,5 +663,16 @@ "Unable to open book": "Impossibile aprire il libro", "Punctuation": "Segni di punteggiatura", "Replace Quotation Marks": "Sostituisci le virgolette", - "Enabled only in vertical layout.": "Abilitato solo in layout verticale." + "Enabled only in vertical layout.": "Abilitato solo in layout verticale.", + "No Conversion": "Nessuna conversione", + "Simplified to Traditional": "Semplificato → Tradizionale", + "Traditional to Simplified": "Tradizionale → Semplificato", + "Simplified to Traditional (Taiwan)": "Semplificato → Tradizionale (Taiwan)", + "Simplified to Traditional (Hong Kong)": "Semplificato → Tradizionale (Hong Kong)", + "Simplified to Traditional (Taiwan), with phrases": "Semplificato → Tradizionale (Taiwan • frasi)", + "Traditional (Taiwan) to Simplified": "Tradizionale (Taiwan) → Semplificato", + "Traditional (Hong Kong) to Simplified": "Tradizionale (Hong Kong) → Semplificato", + "Traditional (Taiwan) to Simplified, with phrases": "Tradizionale (Taiwan • frasi) → Semplificato", + "Convert Simplified and Traditional Chinese": "Converti Cinese Semplificato/Tradizionale", + "Convert Mode": "Modalità conversione" } diff --git a/apps/readest-app/public/locales/ja/translation.json b/apps/readest-app/public/locales/ja/translation.json index 9b4b7525..00d31a36 100644 --- a/apps/readest-app/public/locales/ja/translation.json +++ b/apps/readest-app/public/locales/ja/translation.json @@ -655,5 +655,16 @@ "Unable to open book": "本を開くことができません", "Punctuation": "句読点", "Replace Quotation Marks": "引用符を置き換える", - "Enabled only in vertical layout.": "縦書きレイアウトでのみ有効です。" + "Enabled only in vertical layout.": "縦書きレイアウトでのみ有効です。", + "No Conversion": "変換なし", + "Simplified to Traditional": "簡体字 → 繁体字", + "Traditional to Simplified": "繁体字 → 簡体字", + "Simplified to Traditional (Taiwan)": "簡体字 → 繁体字(台湾)", + "Simplified to Traditional (Hong Kong)": "簡体字 → 繁体字(香港)", + "Simplified to Traditional (Taiwan), with phrases": "簡体字 → 繁体字(台湾)• フレーズ", + "Traditional (Taiwan) to Simplified": "繁体字(台湾) → 簡体字", + "Traditional (Hong Kong) to Simplified": "繁体字(香港) → 簡体字", + "Traditional (Taiwan) to Simplified, with phrases": "繁体字(台湾) → 簡体字 • フレーズ", + "Convert Simplified and Traditional Chinese": "簡体字/繁体字変換", + "Convert Mode": "変換モード" } diff --git a/apps/readest-app/public/locales/ko/translation.json b/apps/readest-app/public/locales/ko/translation.json index 499025d3..dd45e60e 100644 --- a/apps/readest-app/public/locales/ko/translation.json +++ b/apps/readest-app/public/locales/ko/translation.json @@ -655,5 +655,16 @@ "Unable to open book": "책을 열 수 없습니다", "Punctuation": "구두점", "Replace Quotation Marks": "인용 부호 바꾸기", - "Enabled only in vertical layout.": "세로 레이아웃에서만 활성화됩니다." + "Enabled only in vertical layout.": "세로 레이아웃에서만 활성화됩니다.", + "No Conversion": "변환 없음", + "Simplified to Traditional": "간체 → 번체", + "Traditional to Simplified": "번체 → 간체", + "Simplified to Traditional (Taiwan)": "간체 → 번체 (대만)", + "Simplified to Traditional (Hong Kong)": "간체 → 번체 (홍콩)", + "Simplified to Traditional (Taiwan), with phrases": "간체 → 번체 (대만) • 문구", + "Traditional (Taiwan) to Simplified": "번체 (대만) → 간체", + "Traditional (Hong Kong) to Simplified": "번체 (홍콩) → 간체", + "Traditional (Taiwan) to Simplified, with phrases": "번체 (대만) → 간체 • 문구", + "Convert Simplified and Traditional Chinese": "간체/번체 변환", + "Convert Mode": "변환 모드" } diff --git a/apps/readest-app/public/locales/nl/translation.json b/apps/readest-app/public/locales/nl/translation.json index 8956730a..159e3cb3 100644 --- a/apps/readest-app/public/locales/nl/translation.json +++ b/apps/readest-app/public/locales/nl/translation.json @@ -659,5 +659,16 @@ "Unable to open book": "Kan boek niet openen", "Punctuation": "Interpunctie", "Replace Quotation Marks": "Aanhalingstekens vervangen", - "Enabled only in vertical layout.": "Alleen ingeschakeld in verticale lay-out." + "Enabled only in vertical layout.": "Alleen ingeschakeld in verticale lay-out.", + "No Conversion": "Geen conversie", + "Simplified to Traditional": "Vereenvoudigd → Traditioneel", + "Traditional to Simplified": "Traditioneel → Vereenvoudigd", + "Simplified to Traditional (Taiwan)": "Vereenvoudigd → Traditioneel (Taiwan)", + "Simplified to Traditional (Hong Kong)": "Vereenvoudigd → Traditioneel (Hong Kong)", + "Simplified to Traditional (Taiwan), with phrases": "Vereenvoudigd → Traditioneel (Taiwan • zinnen)", + "Traditional (Taiwan) to Simplified": "Traditioneel (Taiwan) → Vereenvoudigd", + "Traditional (Hong Kong) to Simplified": "Traditioneel (Hong Kong) → Vereenvoudigd", + "Traditional (Taiwan) to Simplified, with phrases": "Traditioneel (Taiwan • zinnen) → Vereenvoudigd", + "Convert Simplified and Traditional Chinese": "Converteer Vereenvoudigd/Traditioneel Chinees", + "Convert Mode": "Conversiemodus" } diff --git a/apps/readest-app/public/locales/pl/translation.json b/apps/readest-app/public/locales/pl/translation.json index 56a162b7..4c9fafe4 100644 --- a/apps/readest-app/public/locales/pl/translation.json +++ b/apps/readest-app/public/locales/pl/translation.json @@ -667,5 +667,16 @@ "Unable to open book": "Nie można otworzyć książki", "Punctuation": "Interpunkcja", "Replace Quotation Marks": "Zamień cudzysłowy", - "Enabled only in vertical layout.": "Włączone tylko w układzie pionowym." + "Enabled only in vertical layout.": "Włączone tylko w układzie pionowym.", + "No Conversion": "Brak konwersji", + "Simplified to Traditional": "Uproszczony → Tradycyjny", + "Traditional to Simplified": "Tradycyjny → Uproszczony", + "Simplified to Traditional (Taiwan)": "Uproszczony → Tradycyjny (Tajwan)", + "Simplified to Traditional (Hong Kong)": "Uproszczony → Tradycyjny (Hongkong)", + "Simplified to Traditional (Taiwan), with phrases": "Uproszczony → Tradycyjny (Tajwan • frazy)", + "Traditional (Taiwan) to Simplified": "Tradycyjny (Tajwan) → Uproszczony", + "Traditional (Hong Kong) to Simplified": "Tradycyjny (Hongkong) → Uproszczony", + "Traditional (Taiwan) to Simplified, with phrases": "Tradycyjny (Tajwan • frazy) → Uproszczony", + "Convert Simplified and Traditional Chinese": "Konwertuj chiński uproszczony/tradycyjny", + "Convert Mode": "Tryb konwersji" } diff --git a/apps/readest-app/public/locales/pt/translation.json b/apps/readest-app/public/locales/pt/translation.json index 50823a5f..d0f08949 100644 --- a/apps/readest-app/public/locales/pt/translation.json +++ b/apps/readest-app/public/locales/pt/translation.json @@ -663,5 +663,16 @@ "Unable to open book": "Não foi possível abrir o livro", "Punctuation": "Pontuação", "Replace Quotation Marks": "Substituir Aspas", - "Enabled only in vertical layout.": "Habilitado apenas no layout vertical." + "Enabled only in vertical layout.": "Habilitado apenas no layout vertical.", + "No Conversion": "Sem conversão", + "Simplified to Traditional": "Simplificado → Tradicional", + "Traditional to Simplified": "Tradicional → Simplificado", + "Simplified to Traditional (Taiwan)": "Simplificado → Tradicional (Taiwan)", + "Simplified to Traditional (Hong Kong)": "Simplificado → Tradicional (Hong Kong)", + "Simplified to Traditional (Taiwan), with phrases": "Simplificado → Tradicional (Taiwan • frases)", + "Traditional (Taiwan) to Simplified": "Tradicional (Taiwan) → Simplificado", + "Traditional (Hong Kong) to Simplified": "Tradicional (Hong Kong) → Simplificado", + "Traditional (Taiwan) to Simplified, with phrases": "Tradicional (Taiwan • frases) → Simplificado", + "Convert Simplified and Traditional Chinese": "Converter Chinês Simpl./Trad.", + "Convert Mode": "Modo de conversão" } diff --git a/apps/readest-app/public/locales/ru/translation.json b/apps/readest-app/public/locales/ru/translation.json index 13c97d40..90ab286c 100644 --- a/apps/readest-app/public/locales/ru/translation.json +++ b/apps/readest-app/public/locales/ru/translation.json @@ -667,5 +667,16 @@ "Unable to open book": "Не удалось открыть книгу", "Punctuation": "Пунктуация", "Replace Quotation Marks": "Заменить кавычки", - "Enabled only in vertical layout.": "Включено только в вертикальной раскладке." + "Enabled only in vertical layout.": "Включено только в вертикальной раскладке.", + "No Conversion": "Без преобразования", + "Simplified to Traditional": "Упрощённый → Традиционный", + "Traditional to Simplified": "Традиционный → Упрощённый", + "Simplified to Traditional (Taiwan)": "Упрощённый → Традиционный (Тайвань)", + "Simplified to Traditional (Hong Kong)": "Упрощённый → Традиционный (Гонконг)", + "Simplified to Traditional (Taiwan), with phrases": "Упрощённый → Традиционный (Тайвань • фразы)", + "Traditional (Taiwan) to Simplified": "Традиционный (Тайвань) → Упрощённый", + "Traditional (Hong Kong) to Simplified": "Традиционный (Гонконг) → Упрощённый", + "Traditional (Taiwan) to Simplified, with phrases": "Традиционный (Тайвань • фразы) → Упрощённый", + "Convert Simplified and Traditional Chinese": "Преобразовать упрощённый/традиционный китайский", + "Convert Mode": "Режим преобразования" } diff --git a/apps/readest-app/public/locales/si/translation.json b/apps/readest-app/public/locales/si/translation.json index 3e6dbaa9..1821fc30 100644 --- a/apps/readest-app/public/locales/si/translation.json +++ b/apps/readest-app/public/locales/si/translation.json @@ -659,5 +659,16 @@ "Unable to open book": "පොත විවෘත කිරීමට නොහැක", "Punctuation": "ලකුණු", "Replace Quotation Marks": "උද්ධෘත ලකුණු ප්‍රතිස්ථාපනය කරන්න", - "Enabled only in vertical layout.": "සිරස් ආකෘතියේ පමණක් සක්‍රීයයි." + "Enabled only in vertical layout.": "සිරස් ආකෘතියේ පමණක් සක්‍රීයයි.", + "No Conversion": "ප්‍රතිවර්තනයක් නැත", + "Simplified to Traditional": "සරල → සාම්ප්‍රදායික", + "Traditional to Simplified": "සාම්ප්‍රදායික → සරල", + "Simplified to Traditional (Taiwan)": "සරල → සාම්ප්‍රදායික (තායිවான்)", + "Simplified to Traditional (Hong Kong)": "සරල → සාම්ප්‍රදායික (හොං කොං)", + "Simplified to Traditional (Taiwan), with phrases": "සරල → සාම්ප්‍රදායික (තායිවාන • වාක්‍ය)", + "Traditional (Taiwan) to Simplified": "සාම්ප්‍රදායික (තායිවාන) → සරල", + "Traditional (Hong Kong) to Simplified": "සාම්ප්‍රදායික (හොං කොං) → සරල", + "Traditional (Taiwan) to Simplified, with phrases": "සාම්ප්‍රදායික (තායිවාන • වාක්‍ය) → සරල", + "Convert Simplified and Traditional Chinese": "සරල/සාම්ප්‍රදායික චීන පරිවර්තනය", + "Convert Mode": "පරිවර්තන මෝඩියුලය" } diff --git a/apps/readest-app/public/locales/sv/translation.json b/apps/readest-app/public/locales/sv/translation.json index 9102efa7..f46f2ea1 100644 --- a/apps/readest-app/public/locales/sv/translation.json +++ b/apps/readest-app/public/locales/sv/translation.json @@ -659,5 +659,16 @@ "Unable to open book": "Kunde inte öppna bok", "Punctuation": "Interpunktion", "Replace Quotation Marks": "Ersätt citattecken", - "Enabled only in vertical layout.": "Aktiverad endast i vertikal layout." + "Enabled only in vertical layout.": "Aktiverad endast i vertikal layout.", + "No Conversion": "Ingen konvertering", + "Simplified to Traditional": "Förenklad → Traditionell", + "Traditional to Simplified": "Traditionell → Förenklad", + "Simplified to Traditional (Taiwan)": "Förenklad → Traditionell (Taiwan)", + "Simplified to Traditional (Hong Kong)": "Förenklad → Traditionell (Hongkong)", + "Simplified to Traditional (Taiwan), with phrases": "Förenklad → Traditionell (Taiwan • fraser)", + "Traditional (Taiwan) to Simplified": "Traditionell (Taiwan) → Förenklad", + "Traditional (Hong Kong) to Simplified": "Traditionell (Hongkong) → Förenklad", + "Traditional (Taiwan) to Simplified, with phrases": "Traditionell (Taiwan • fraser) → Förenklad", + "Convert Simplified and Traditional Chinese": "Konvertera förenklad/traditionell kinesiska", + "Convert Mode": "Konverteringsläge" } diff --git a/apps/readest-app/public/locales/ta/translation.json b/apps/readest-app/public/locales/ta/translation.json index 94d6740e..afe8fe68 100644 --- a/apps/readest-app/public/locales/ta/translation.json +++ b/apps/readest-app/public/locales/ta/translation.json @@ -659,5 +659,16 @@ "Unable to open book": "புத்தகத்தைத் திறக்க முடியவில்லை", "Punctuation": "விருத்தி", "Replace Quotation Marks": "உதயம்சுட்டிகளை மாற்றவும்", - "Enabled only in vertical layout.": "செங்குத்து அமைப்பில் மட்டுமே இயலுமைப்படுத்தப்பட்டது." + "Enabled only in vertical layout.": "செங்குத்து அமைப்பில் மட்டுமே இயலுமைப்படுத்தப்பட்டது.", + "No Conversion": "மாற்றம் செய்யவில்லை", + "Simplified to Traditional": "எளிய → பாரம்பரிய", + "Traditional to Simplified": "பாரம்பரிய → எளிய", + "Simplified to Traditional (Taiwan)": "எளிய → பாரம்பரிய (தைவான்)", + "Simplified to Traditional (Hong Kong)": "எளிய → பாரம்பரிய (ஹாங்காங்)", + "Simplified to Traditional (Taiwan), with phrases": "எளிய → பாரம்பரிய (தைவான் • வசனங்கள்)", + "Traditional (Taiwan) to Simplified": "பாரம்பரிய (தைவான்) → எளிய", + "Traditional (Hong Kong) to Simplified": "பாரம்பரிய (ஹாங்காங்) → எளிய", + "Traditional (Taiwan) to Simplified, with phrases": "பாரம்பரிய (தைவான் • வசனங்கள்) → எளிய", + "Convert Simplified and Traditional Chinese": "எளிய/பாரம்பரிய சீன மொழி மாற்றம்", + "Convert Mode": "மாற்ற முறை" } diff --git a/apps/readest-app/public/locales/th/translation.json b/apps/readest-app/public/locales/th/translation.json index d0163c7f..a338b34e 100644 --- a/apps/readest-app/public/locales/th/translation.json +++ b/apps/readest-app/public/locales/th/translation.json @@ -655,5 +655,16 @@ "Unable to open book": "ไม่สามารถเปิดหนังสือได้", "Punctuation": "เครื่องหมายวรรคตอน", "Replace Quotation Marks": "แทนที่เครื่องหมายคำพูด", - "Enabled only in vertical layout.": "เปิดใช้งานเฉพาะในเค้าโครงแนวตั้งเท่านั้น" + "Enabled only in vertical layout.": "เปิดใช้งานเฉพาะในเค้าโครงแนวตั้งเท่านั้น", + "No Conversion": "ไม่แปลงค่า", + "Simplified to Traditional": "ตัวย่อ → ตัวเต็ม", + "Traditional to Simplified": "ตัวเต็ม → ตัวย่อ", + "Simplified to Traditional (Taiwan)": "ตัวย่อ → ตัวเต็ม (ไต้หวัน)", + "Simplified to Traditional (Hong Kong)": "ตัวย่อ → ตัวเต็ม (ฮ่องกง)", + "Simplified to Traditional (Taiwan), with phrases": "ตัวย่อ → ตัวเต็ม (ไต้หวัน • วลี)", + "Traditional (Taiwan) to Simplified": "ตัวเต็ม (ไต้หวัน) → ตัวย่อ", + "Traditional (Hong Kong) to Simplified": "ตัวเต็ม (ฮ่องกง) → ตัวย่อ", + "Traditional (Taiwan) to Simplified, with phrases": "ตัวเต็ม (ไต้หวัน • วลี) → ตัวย่อ", + "Convert Simplified and Traditional Chinese": "แปลงจีนตัวย่อ/ตัวเต็ม", + "Convert Mode": "โหมดแปลงค่า" } diff --git a/apps/readest-app/public/locales/tr/translation.json b/apps/readest-app/public/locales/tr/translation.json index 8a4bd373..0c5ddf5a 100644 --- a/apps/readest-app/public/locales/tr/translation.json +++ b/apps/readest-app/public/locales/tr/translation.json @@ -659,5 +659,16 @@ "Unable to open book": "Kitap açılamıyor", "Punctuation": "Noktalama İşaretleri", "Replace Quotation Marks": "Tırnak İşaretlerini Değiştir", - "Enabled only in vertical layout.": "Yalnızca dikey düzenle etkinleştirildi." + "Enabled only in vertical layout.": "Yalnızca dikey düzenle etkinleştirildi.", + "No Conversion": "Dönüştürme yok", + "Simplified to Traditional": "Basitleştirilmiş → Geleneksel", + "Traditional to Simplified": "Geleneksel → Basitleştirilmiş", + "Simplified to Traditional (Taiwan)": "Basitleştirilmiş → Geleneksel (Tayvan)", + "Simplified to Traditional (Hong Kong)": "Basitleştirilmiş → Geleneksel (Hong Kong)", + "Simplified to Traditional (Taiwan), with phrases": "Basitleştirilmiş → Geleneksel (Tayvan • ifadeler)", + "Traditional (Taiwan) to Simplified": "Geleneksel (Tayvan) → Basitleştirilmiş", + "Traditional (Hong Kong) to Simplified": "Geleneksel (Hong Kong) → Basitleştirilmiş", + "Traditional (Taiwan) to Simplified, with phrases": "Geleneksel (Tayvan • ifadeler) → Basitleştirilmiş", + "Convert Simplified and Traditional Chinese": "Basitleştirilmiş/Geleneksel Çince Dönüştür", + "Convert Mode": "Dönüştürme Modu" } diff --git a/apps/readest-app/public/locales/uk/translation.json b/apps/readest-app/public/locales/uk/translation.json index 7ecfb5ea..9bfaf52c 100644 --- a/apps/readest-app/public/locales/uk/translation.json +++ b/apps/readest-app/public/locales/uk/translation.json @@ -667,5 +667,16 @@ "Unable to open book": "Не вдалося відкрити книгу", "Punctuation": "Пунктуація", "Replace Quotation Marks": "Замінити лапки", - "Enabled only in vertical layout.": "Активовано лише у вертикальному макеті." + "Enabled only in vertical layout.": "Активовано лише у вертикальному макеті.", + "No Conversion": "Без конвертації", + "Simplified to Traditional": "Спрощене → Традиційне", + "Traditional to Simplified": "Традиційне → Спрощене", + "Simplified to Traditional (Taiwan)": "Спрощене → Традиційне (Тайвань)", + "Simplified to Traditional (Hong Kong)": "Спрощене → Традиційне (Гонконг)", + "Simplified to Traditional (Taiwan), with phrases": "Спрощене → Традиційне (Тайвань • фрази)", + "Traditional (Taiwan) to Simplified": "Традиційне (Тайвань) → Спрощене", + "Traditional (Hong Kong) to Simplified": "Традиційне (Гонконг) → Спрощене", + "Traditional (Taiwan) to Simplified, with phrases": "Традиційне (Тайвань • фрази) → Спрощене", + "Convert Simplified and Traditional Chinese": "Конвертувати спрощену/традиційну китайську", + "Convert Mode": "Режим конвертації" } diff --git a/apps/readest-app/public/locales/vi/translation.json b/apps/readest-app/public/locales/vi/translation.json index 92c787f0..4720c85e 100644 --- a/apps/readest-app/public/locales/vi/translation.json +++ b/apps/readest-app/public/locales/vi/translation.json @@ -655,5 +655,16 @@ "Unable to open book": "Không thể mở sách", "Punctuation": "Dấu câu", "Replace Quotation Marks": "Thay thế dấu ngoặc kép", - "Enabled only in vertical layout.": "Chỉ bật trong bố cục dọc." + "Enabled only in vertical layout.": "Chỉ bật trong bố cục dọc.", + "No Conversion": "Không chuyển đổi", + "Simplified to Traditional": "Giản thể → Phồn thể", + "Traditional to Simplified": "Phồn thể → Giản thể", + "Simplified to Traditional (Taiwan)": "Giản thể → Phồn thể (Đài Loan)", + "Simplified to Traditional (Hong Kong)": "Giản thể → Phồn thể (Hồng Kông)", + "Simplified to Traditional (Taiwan), with phrases": "Giản thể → Phồn thể (Đài Loan • cụm từ)", + "Traditional (Taiwan) to Simplified": "Phồn thể (Đài Loan) → Giản thể", + "Traditional (Hong Kong) to Simplified": "Phồn thể (Hồng Kông) → Giản thể", + "Traditional (Taiwan) to Simplified, with phrases": "Phồn thể (Đài Loan • cụm từ) → Giản thể", + "Convert Simplified and Traditional Chinese": "Chuyển đổi Trung giản/Phồn thể", + "Convert Mode": "Chế độ chuyển đổi" } diff --git a/apps/readest-app/public/locales/zh-CN/translation.json b/apps/readest-app/public/locales/zh-CN/translation.json index 9a711e48..e7dcc7bb 100644 --- a/apps/readest-app/public/locales/zh-CN/translation.json +++ b/apps/readest-app/public/locales/zh-CN/translation.json @@ -655,5 +655,16 @@ "Unable to open book": "无法打开书籍", "Punctuation": "标点符号", "Replace Quotation Marks": "替换引号", - "Enabled only in vertical layout.": "仅在竖排布局中启用" + "Enabled only in vertical layout.": "仅在竖排布局中启用", + "No Conversion": "不转换", + "Simplified to Traditional": "简体 → 繁体", + "Traditional to Simplified": "繁体 → 简体", + "Simplified to Traditional (Taiwan)": "简体 → 繁体(台湾)", + "Simplified to Traditional (Hong Kong)": "简体 → 繁体(香港)", + "Simplified to Traditional (Taiwan), with phrases": "简体 → 繁体(台湾)习惯用语", + "Traditional (Taiwan) to Simplified": "繁体(台湾) → 简体", + "Traditional (Hong Kong) to Simplified": "繁体(香港) → 简体", + "Traditional (Taiwan) to Simplified, with phrases": "繁体(台湾) → 简体习惯用语", + "Convert Simplified and Traditional Chinese": "简繁中文转换", + "Convert Mode": "转换模式" } diff --git a/apps/readest-app/public/locales/zh-TW/translation.json b/apps/readest-app/public/locales/zh-TW/translation.json index 30ac2673..2b33a948 100644 --- a/apps/readest-app/public/locales/zh-TW/translation.json +++ b/apps/readest-app/public/locales/zh-TW/translation.json @@ -655,5 +655,16 @@ "Unable to open book": "無法打開書籍", "Punctuation": "標點符號", "Replace Quotation Marks": "替換引號", - "Enabled only in vertical layout.": "僅在直排佈局中啟用" + "Enabled only in vertical layout.": "僅在直排佈局中啟用", + "No Conversion": "不轉換", + "Simplified to Traditional": "簡體 → 繁體", + "Traditional to Simplified": "繁體 → 簡體", + "Simplified to Traditional (Taiwan)": "簡體 → 繁體(台灣)", + "Simplified to Traditional (Hong Kong)": "簡體 → 繁體(香港)", + "Simplified to Traditional (Taiwan), with phrases": "簡體 → 繁體(台灣)慣用語", + "Traditional (Taiwan) to Simplified": "繁體(台灣) → 簡體", + "Traditional (Hong Kong) to Simplified": "繁體(香港) → 簡體", + "Traditional (Taiwan) to Simplified, with phrases": "繁體(台灣) → 簡體慣用語", + "Convert Simplified and Traditional Chinese": "簡繁中文轉換", + "Convert Mode": "轉換模式" } diff --git a/apps/readest-app/src/__tests__/utils/simplecc.test.ts b/apps/readest-app/src/__tests__/utils/simplecc.test.ts new file mode 100644 index 00000000..9aaa474c --- /dev/null +++ b/apps/readest-app/src/__tests__/utils/simplecc.test.ts @@ -0,0 +1,42 @@ +import { describe, test, expect, beforeAll } from 'vitest'; +import init, { simplecc } from '@simplecc/simplecc_wasm'; +import { readFile } from 'fs/promises'; +import { join } from 'path'; + +describe.concurrent('suite', () => { + beforeAll(async () => { + const wasmPath = join(process.cwd(), 'public/vendor/simplecc/simplecc_wasm_bg.wasm'); + const wasmBuffer = await readFile(wasmPath); + await init(wasmBuffer); + await init(); + }); + + test('basic s2t and t2s', () => { + expect(simplecc('发财了去植发', 's2t')).toBe('發財了去植髮'); + expect(simplecc('發財了去植髮', 't2s')).toBe('发财了去植发'); + }); + + test('s2tw - Simplified to Traditional (Taiwan)', () => { + expect(simplecc('鼠标', 's2tw')).toBe('鼠標'); + expect(simplecc('软件', 's2tw')).toBe('軟件'); + expect(simplecc('信息', 's2tw')).toBe('信息'); + }); + + test('s2twp - Simplified to Traditional (Taiwan) with phrases', () => { + expect(simplecc('计算机', 's2twp')).toBe('計算機'); + expect(simplecc('打印机', 's2twp')).toBe('印表機'); + expect(simplecc('激光', 's2twp')).toBe('雷射'); + }); + + test('tw2s - Traditional (Taiwan) to Simplified', () => { + expect(simplecc('滑鼠', 'tw2s')).toBe('滑鼠'); + expect(simplecc('軟體', 'tw2s')).toBe('软体'); + expect(simplecc('資訊', 'tw2s')).toBe('资讯'); + }); + + test('tw2sp - Traditional (Taiwan) to Simplified with phrases', () => { + expect(simplecc('電腦', 'tw2sp')).toBe('电脑'); + expect(simplecc('印表機', 'tw2sp')).toBe('打印机'); + expect(simplecc('雷射', 'tw2sp')).toBe('激光'); + }); +}); diff --git a/apps/readest-app/src/app/reader/components/FoliateViewer.tsx b/apps/readest-app/src/app/reader/components/FoliateViewer.tsx index 3e09f870..8583d890 100644 --- a/apps/readest-app/src/app/reader/components/FoliateViewer.tsx +++ b/apps/readest-app/src/app/reader/components/FoliateViewer.tsx @@ -147,6 +147,7 @@ const FoliateViewer: React.FC<{ 'whitespace', 'language', 'sanitizer', + 'simplecc', ], }; return Promise.resolve(transformContent(ctx)); diff --git a/apps/readest-app/src/components/Select.tsx b/apps/readest-app/src/components/Select.tsx index 359922c9..df4bd0a3 100644 --- a/apps/readest-app/src/components/Select.tsx +++ b/apps/readest-app/src/components/Select.tsx @@ -26,7 +26,10 @@ export default function Select({ value={value} onChange={onChange} onKeyDown={(e) => e.stopPropagation()} - className={clsx('select bg-base-200 h-8 min-h-8 rounded-md border-none text-sm', className)} + className={clsx( + 'select bg-base-200 h-8 min-h-8 max-w-[60%] truncate rounded-md border-none text-sm', + className, + )} disabled={disabled} style={{ textAlignLast: 'end', diff --git a/apps/readest-app/src/components/settings/LangPanel.tsx b/apps/readest-app/src/components/settings/LangPanel.tsx index 59a59f9c..e1fca07d 100644 --- a/apps/readest-app/src/components/settings/LangPanel.tsx +++ b/apps/readest-app/src/components/settings/LangPanel.tsx @@ -9,6 +9,7 @@ import { saveViewSettings } from '@/helpers/settings'; import { getTranslators } from '@/services/translators'; import { useResetViewSettings } from '@/hooks/useResetSettings'; import { TRANSLATED_LANGS, TRANSLATOR_LANGS } from '@/services/constants'; +import { ConvertChineseVariant } from '@/types/book'; import { SettingsPanelPanelProp } from './SettingsDialog'; import { isCJKEnv } from '@/utils/misc'; import Select from '@/components/Select'; @@ -30,6 +31,9 @@ const LangPanel: React.FC = ({ bookKey, onRegisterReset const [replaceQuotationMarks, setReplaceQuotationMarks] = useState( viewSettings.replaceQuotationMarks, ); + const [convertChineseVariant, setConvertChineseVariant] = useState( + viewSettings.convertChineseVariant, + ); const resetToDefaults = useResetViewSettings(); @@ -195,6 +199,46 @@ const LangPanel: React.FC = ({ bookKey, onRegisterReset // eslint-disable-next-line react-hooks/exhaustive-deps }, [replaceQuotationMarks]); + const getConvertModeOptions: () => { value: ConvertChineseVariant; label: string }[] = () => { + return [ + { value: 'none', label: _('No Conversion') }, + { value: 's2t', label: _('Simplified to Traditional') }, + { value: 't2s', label: _('Traditional to Simplified') }, + { value: 's2tw', label: _('Simplified to Traditional (Taiwan)') }, + { value: 's2hk', label: _('Simplified to Traditional (Hong Kong)') }, + { value: 's2twp', label: _('Simplified to Traditional (Taiwan), with phrases') }, + { value: 'tw2s', label: _('Traditional (Taiwan) to Simplified') }, + { value: 'hk2s', label: _('Traditional (Hong Kong) to Simplified') }, + { value: 'tw2sp', label: _('Traditional (Taiwan) to Simplified, with phrases') }, + ]; + }; + + const getConvertModeOption = () => { + const value = convertChineseVariant; + const availableOptions = getConvertModeOptions(); + return availableOptions.find((o) => o.value === value) || availableOptions[0]!; + }; + + const handleSelectConvertMode = (event: React.ChangeEvent) => { + const option = event.target.value as ConvertChineseVariant; + setConvertChineseVariant(option); + }; + + useEffect(() => { + if (convertChineseVariant === viewSettings.convertChineseVariant) return; + saveViewSettings( + envConfig, + bookKey, + 'convertChineseVariant', + convertChineseVariant, + true, + false, + ).then(() => { + recreateViewer(envConfig, bookKey); + }); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [convertChineseVariant]); + return (
@@ -288,6 +332,24 @@ const LangPanel: React.FC = ({ bookKey, onRegisterReset
)} + + {isCJKEnv() && ( +
+

{_('Convert Simplified and Traditional Chinese')}

+
+
+
+ {_('Convert Mode')} +