feat: add Persian language support

This commit is contained in:
codytseng
2025-07-20 21:47:10 +08:00
parent 78725c1d14
commit 6d5d4d36c1
3 changed files with 309 additions and 0 deletions

View File

@@ -87,6 +87,9 @@ export function detectLanguage(text?: string): string | null {
if (/[\u0600-\u06ff]/.test(cleanText)) {
return 'ar'
}
if (/[\u0590-\u05FF]/.test(cleanText)) {
return 'fa'
}
if (/[\u0400-\u04ff]/.test(cleanText)) {
return 'ru'
}
@@ -98,6 +101,8 @@ export function detectLanguage(text?: string): string | null {
deu: 'de', // German
eng: 'en', // English
spa: 'es', // Spanish
fas: 'fa', // Persian (Farsi)
pes: 'fa', // Persian (alternative code)
fra: 'fr', // French
ita: 'it', // Italian
jpn: 'ja', // Japanese