Refactor localization files and remove Aliyun references

This commit is contained in:
2026-04-07 11:37:47 +08:00
parent 2662b494c5
commit b395cb0b98
47 changed files with 136 additions and 1311 deletions

View File

@@ -23,22 +23,6 @@ SPEAKER_DESCRIPTIONS = {
"Sohee": "Female, soft and melodious"
}
ALIYUN_SPEAKERS = [
"Vivian", "Serena", "Dylan", "Eric",
"Ryan", "Aiden", "Ono_Anna", "Sohee"
]
ALIYUN_SPEAKER_DESCRIPTIONS = {
"Vivian": "Female, cute and lively (十三 - 拽拽的、可爱的小暴躁)",
"Serena": "Female, gentle and warm (苏瑶 - 温柔小姐姐)",
"Dylan": "Male, young and energetic (北京-晓东 - 北京胡同里长大的少年)",
"Eric": "Male, calm and steady (四川-程川 - 跳脱市井的四川成都男子)",
"Ryan": "Male, friendly and dramatic (甜茶 - 节奏拉满,戏感炸裂)",
"Aiden": "Male, deep and resonant (艾登 - 精通厨艺的美语大男孩)",
"Ono_Anna": "Female, cute and playful (小野杏 - 鬼灵精怪的青梅竹马)",
"Sohee": "Female, soft and melodious (素熙 - 温柔开朗的韩国欧尼)"
}
LOCAL_SPEAKERS = SUPPORTED_SPEAKERS.copy()
LOCAL_SPEAKER_DESCRIPTIONS = SPEAKER_DESCRIPTIONS.copy()
@@ -60,18 +44,13 @@ def validate_language(language: str) -> str:
def validate_speaker(speaker: str, backend: str = "local") -> str:
normalized = speaker.strip()
if backend == "aliyun":
speaker_list = ALIYUN_SPEAKERS
else:
speaker_list = LOCAL_SPEAKERS
for supported in speaker_list:
for supported in LOCAL_SPEAKERS:
if normalized.lower() == supported.lower():
return supported
raise ValueError(
f"Unsupported speaker: {speaker} for backend '{backend}'. "
f"Supported speakers: {', '.join(speaker_list)}"
f"Unsupported speaker: {speaker}. "
f"Supported speakers: {', '.join(LOCAL_SPEAKERS)}"
)
@@ -118,17 +97,10 @@ def get_supported_languages() -> List[str]:
def get_supported_speakers(backend: str = "local") -> List[dict]:
if backend == "aliyun":
speakers = ALIYUN_SPEAKERS
descriptions = ALIYUN_SPEAKER_DESCRIPTIONS
else:
speakers = LOCAL_SPEAKERS
descriptions = LOCAL_SPEAKER_DESCRIPTIONS
return [
{
"name": speaker,
"description": descriptions.get(speaker, "")
"description": LOCAL_SPEAKER_DESCRIPTIONS.get(speaker, "")
}
for speaker in speakers
for speaker in LOCAL_SPEAKERS
]