fix: normalize language code for TTS (#457)

This commit is contained in:
Huang Xin
2025-02-26 19:30:22 +01:00
committed by GitHub
parent 3cc41b7b71
commit fc8c9546b6
21 changed files with 24 additions and 57 deletions
@@ -222,11 +222,7 @@
"Advanced AI Tools": "أدوات ذكاء اصطناعي متقدمة",
"Early Feature Access": "وصول مبكر للميزات",
"10 GB Cloud Sync Space": "مساحة مزامنة سحابية 10 جيجابايت",
"Unlimited Offline Reading": "قراءة غير محدودة بدون اتصال",
"Unlimited Customization": "تخصيص غير محدود",
"Loading profile...": "جارٍ تحميل الملف الشخصي...",
"Plan": "الخطة",
"Plan Details": "تفاصيل الخطة",
"Features": "الميزات",
"Delete Account": "حذف الحساب",
"Delete Your Account?": "حذف حسابك؟",
@@ -223,8 +223,6 @@
"Early Feature Access": "Früher Zugang zu neuen Funktionen",
"10 GB Cloud Sync Space": "10 GB Cloud-Synchronisierungsspeicher",
"Loading profile...": "Profil wird geladen...",
"Plan": "Tarif",
"Plan Details": "Tarifdetails",
"Features": "Funktionen",
"Delete Account": "Konto löschen",
"Delete Your Account?": "Ihr Konto löschen?",
@@ -223,8 +223,6 @@
"Early Feature Access": "Πρώιμη πρόσβαση σε λειτουργίες",
"10 GB Cloud Sync Space": "10 GB χώρος συγχρονισμού Cloud",
"Loading profile...": "Φόρτωση προφίλ...",
"Plan": "Πρόγραμμα",
"Plan Details": "Λεπτομέρειες προγράμματος",
"Features": "Χαρακτηριστικά",
"Delete Account": "Διαγραφή λογαριασμού",
"Delete Your Account?": "Διαγραφή του λογαριασμού σας;",
@@ -223,8 +223,6 @@
"Early Feature Access": "Acceso anticipado a funciones",
"10 GB Cloud Sync Space": "10 GB de espacio de sincronización en la nube",
"Loading profile...": "Cargando perfil...",
"Plan": "Plan",
"Plan Details": "Detalles del plan",
"Features": "Características",
"Delete Account": "Eliminar cuenta",
"Delete Your Account?": "¿Eliminar tu cuenta?",
@@ -223,8 +223,6 @@
"Early Feature Access": "Accès anticipé aux fonctionnalités",
"10 GB Cloud Sync Space": "10 Go d'espace de synchronisation cloud",
"Loading profile...": "Chargement du profil...",
"Plan": "Forfait",
"Plan Details": "Détails du forfait",
"Features": "Fonctionnalités",
"Delete Account": "Supprimer le compte",
"Delete Your Account?": "Supprimer votre compte ?",
@@ -223,8 +223,6 @@
"Early Feature Access": "प्रारंभिक फीचर पहुंच",
"10 GB Cloud Sync Space": "10 GB क्लाउड सिंक स्पेस",
"Loading profile...": "प्रोफ़ाइल लोड हो रहा है...",
"Plan": "योजना",
"Plan Details": "योजना विवरण",
"Features": "विशेषताएं",
"Delete Account": "खाता हटाएं",
"Delete Your Account?": "अपना खाता हटाएं?",
@@ -223,8 +223,6 @@
"Early Feature Access": "Akses Fitur Awal",
"10 GB Cloud Sync Space": "Ruang Sinkronisasi Cloud 10 GB",
"Loading profile...": "Memuat profil...",
"Plan": "Paket",
"Plan Details": "Detail Paket",
"Features": "Fitur",
"Delete Account": "Hapus Akun",
"Delete Your Account?": "Hapus Akun Anda?",
@@ -223,8 +223,6 @@
"Early Feature Access": "Accesso anticipato alle funzionalità",
"10 GB Cloud Sync Space": "10 GB di spazio di sincronizzazione cloud",
"Loading profile...": "Caricamento profilo...",
"Plan": "Piano",
"Plan Details": "Dettagli del piano",
"Features": "Funzionalità",
"Delete Account": "Elimina account",
"Delete Your Account?": "Eliminare il tuo account?",
@@ -223,8 +223,6 @@
"Early Feature Access": "新機能への早期アクセス",
"10 GB Cloud Sync Space": "10 GBのクラウド同期スペース",
"Loading profile...": "プロフィール読み込み中...",
"Plan": "プラン",
"Plan Details": "プラン詳細",
"Features": "機能",
"Delete Account": "アカウント削除",
"Delete Your Account?": "アカウントを削除しますか?",
@@ -223,8 +223,6 @@
"Early Feature Access": "신기능 조기 접근",
"10 GB Cloud Sync Space": "10 GB 클라우드 동기화 공간",
"Loading profile...": "프로필 로딩 중...",
"Plan": "플랜",
"Plan Details": "플랜 세부사항",
"Features": "기능",
"Delete Account": "계정 삭제",
"Delete Your Account?": "계정을 삭제하시겠습니까?",
@@ -223,8 +223,6 @@
"Early Feature Access": "Wczesny dostęp do nowych funkcji",
"10 GB Cloud Sync Space": "10 GB przestrzeni synchronizacji w chmurze",
"Loading profile...": "Ładowanie profilu...",
"Plan": "Plan",
"Plan Details": "Szczegóły planu",
"Features": "Funkcje",
"Delete Account": "Usuń konto",
"Delete Your Account?": "Usunąć Twoje konto?",
@@ -223,8 +223,6 @@
"Early Feature Access": "Acesso antecipado a recursos",
"10 GB Cloud Sync Space": "10 GB de espaço de sincronização na nuvem",
"Loading profile...": "Carregando perfil...",
"Plan": "Plano",
"Plan Details": "Detalhes do plano",
"Features": "Recursos",
"Delete Account": "Excluir conta",
"Delete Your Account?": "Excluir sua conta?",
@@ -223,8 +223,6 @@
"Early Feature Access": "Ранний доступ к новым функциям",
"10 GB Cloud Sync Space": "10 ГБ облачного пространства для синхронизации",
"Loading profile...": "Загрузка профиля...",
"Plan": "Тариф",
"Plan Details": "Детали тарифа",
"Features": "Функции",
"Delete Account": "Удалить аккаунт",
"Delete Your Account?": "Удалить ваш аккаунт?",
@@ -223,8 +223,6 @@
"Early Feature Access": "Erken Özellik Erişimi",
"10 GB Cloud Sync Space": "10 GB Bulut Senkronizasyon Alanı",
"Loading profile...": "Profil yükleniyor...",
"Plan": "Plan",
"Plan Details": "Plan Detayları",
"Features": "Özellikler",
"Delete Account": "Hesabı Sil",
"Delete Your Account?": "Hesabınızı Silmek İstiyor musunuz?",
@@ -223,8 +223,6 @@
"Early Feature Access": "Ранній доступ до нових функцій",
"10 GB Cloud Sync Space": "10 ГБ простору для хмарної синхронізації",
"Loading profile...": "Завантаження профілю...",
"Plan": "Тариф",
"Plan Details": "Деталі тарифу",
"Features": "Функції",
"Delete Account": "Видалити обліковий запис",
"Delete Your Account?": "Видалити ваш обліковий запис?",
@@ -223,8 +223,6 @@
"Early Feature Access": "Truy cập tính năng sớm",
"10 GB Cloud Sync Space": "10 GB không gian đồng bộ hóa đám mây",
"Loading profile...": "Đang tải hồ sơ...",
"Plan": "Gói",
"Plan Details": "Chi tiết gói",
"Features": "Tính năng",
"Delete Account": "Xóa tài khoản",
"Delete Your Account?": "Xóa tài khoản của bạn?",
@@ -202,29 +202,27 @@
"Account": "账户",
"Cloud Storage": "云存储",
"Failed to delete user. Please try again later.": "删除用户失败。请稍后重试。",
"Unlimited Offline/Online Reading": "无限离线/在线阅读",
"Unlimited Cloud Sync Devices": "无限云同步设备",
"Essential Text-to-Speech Voices": "基本文本转语音声音",
"DeepL Free Access": "使用 DeepL 免费版翻译",
"Unlimited Offline/Online Reading": "无限离线在线阅读",
"Unlimited Cloud Sync Devices": "无限云同步设备个数",
"Essential Text-to-Speech Voices": "基础 TTS 语音包",
"DeepL Free Access": "免费版 DeepL 翻译",
"Community Support": "社区支持",
"500 MB Cloud Sync Space": "500 MB 云同步空间",
"Includes All Free Tier Benefits": "包含所有免费版权益",
"AI Summaries": "AI 摘要",
"AI Translations": "AI 翻译",
"Priority Support": "优先支持",
"DeepL Pro Access": "使用 DeepL 专业版翻译",
"DeepL Pro Access": "专业版 DeepL 翻译",
"Expanded Text-to-Speech Voices": "更多文本转语音声音",
"2000 MB Cloud Sync Space": "2000 MB 云同步空间",
"Includes All Plus Tier Benefits": "包含所有增强版权益",
"Unlimited AI Summaries": "无限使用 AI 摘要",
"Unlimited AI Translations": "无限使用 AI 翻译",
"Unlimited DeepL Pro Access": "无限使用 DeepL 专业版翻译",
"Unlimited DeepL Pro Access": "无限使用专业版 DeepL 翻译",
"Advanced AI Tools": "高级 AI 工具",
"Early Feature Access": "抢先体验新功能",
"10 GB Cloud Sync Space": "10 GB 云同步空间",
"Loading profile...": "加载个人资料中...",
"Plan": "套餐",
"Plan Details": "套餐详情",
"Features": "功能特性",
"Delete Account": "删除账户",
"Delete Your Account?": "删除您的账户?",
@@ -223,8 +223,6 @@
"Early Feature Access": "搶先體驗新功能",
"10 GB Cloud Sync Space": "10 GB雲端同步空間",
"Loading profile...": "載入個人資料中...",
"Plan": "方案",
"Plan Details": "方案詳情",
"Features": "功能",
"Delete Account": "刪除帳戶",
"Delete Your Account?": "刪除您的帳戶?",
@@ -112,24 +112,24 @@ const TTSPanel = ({
</div>
</div>
<div className='flex items-center justify-between space-x-2'>
<button onClick={onBackward} className='hover:bg-base-200/75 rounded-full p-1'>
<button onClick={onBackward} className='rounded-full p-1'>
<MdFastRewind size={iconSize32} />
</button>
<button onClick={onTogglePlay} className='hover:bg-base-200/75 rounded-full p-1'>
<button onClick={onTogglePlay} className='rounded-full p-1'>
{isPlaying ? (
<MdPauseCircle size={iconSize48} className='fill-primary' />
) : (
<MdPlayCircle size={iconSize48} className='fill-primary' />
)}
</button>
<button onClick={onForward} className='hover:bg-base-200/75 rounded-full p-1'>
<button onClick={onForward} className='rounded-full p-1'>
<MdFastForward size={iconSize32} />
</button>
<button onClick={onStop} className='hover:bg-base-200/75 rounded-full p-1'>
<button onClick={onStop} className='rounded-full p-1'>
<MdStop size={iconSize32} />
</button>
<div className='dropdown dropdown-top'>
<button tabIndex={0} className='hover:bg-base-200/75 rounded-full p-1'>
<button tabIndex={0} className='rounded-full p-1'>
<RiVoiceAiFill size={iconSize32} />
</button>
<ul
+6 -7
View File
@@ -95,11 +95,11 @@ const ProfilePage = () => {
name: _('Free Tier'),
color: 'bg-gray-200 text-gray-800',
features: [
_('Community Support'),
_('DeepL Free Access'),
_('Essential Text-to-Speech Voices'),
_('Unlimited Offline/Online Reading'),
_('Unlimited Cloud Sync Devices'),
_('Essential Text-to-Speech Voices'),
_('DeepL Free Access'),
_('Community Support'),
_('500 MB Cloud Sync Space'),
],
};
@@ -109,9 +109,9 @@ const ProfilePage = () => {
color: 'bg-blue-200 text-blue-800',
features: [
_('Includes All Free Tier Benefits'),
_('Priority Support'),
_('AI Summaries'),
_('AI Translations'),
_('Priority Support'),
_('DeepL Pro Access'),
_('Expanded Text-to-Speech Voices'),
_('2000 MB Cloud Sync Space'),
@@ -196,16 +196,15 @@ const ProfilePage = () => {
<span
className={`inline-block rounded-full px-3 py-1 text-sm font-medium ${planDetails.color}`}
>
{planDetails.name} {_('Plan')}
{planDetails.name}
</span>
</div>
</div>
</div>
<div className='bg-base-100 mb-8 rounded-lg p-6'>
<h3 className='text-base-content mb-2 text-lg font-semibold'>{_('Plan Details')}</h3>
<h3 className='text-base-content mb-2 text-lg font-semibold'>{_('Features')}</h3>
<div className='mt-6'>
<p className='text-base-content/85 mb-2 text-base'>{_('Features')}</p>
<ul className='text-base-content/60 grid grid-cols-1 gap-2 md:grid-cols-2'>
{planDetails.features.map((feature, index) => (
<li key={index} className='flex items-center'>
+7 -1
View File
@@ -58,5 +58,11 @@ export const findSSMLMark = (charIndex: number, marks: TTSMark[]) => {
export const parseSSMLLang = (ssml: string): string | null => {
const match = ssml.match(/xml:lang\s*=\s*"([^"]+)"/);
return match ? match[1]! : null;
if (match && match[1]) {
const parts = match[1].split('-');
return parts.length > 1
? `${parts[0]!.toLowerCase()}-${parts[1]!.toUpperCase()}`
: parts[0]!.toLowerCase();
}
return null;
};