feat(editor): display name for available voices

This commit is contained in:
Valentyne Stigloher 2025-09-15 21:25:30 +02:00
parent 06826fb5ea
commit fe7644a718
3 changed files with 44 additions and 10 deletions

View File

@ -45,8 +45,8 @@ watch(pronounciationModelValue, (value, oldValue) => {
const sortedVoices = computed(() => {
const voicesOfLocale = config.pronunciation?.enabled ? config.pronunciation.voices : [];
return (Object.keys(voices) as VoiceKey[]).toSorted((a, b) => {
return (voicesOfLocale.includes(b) ? 1 : 0) - (voicesOfLocale.includes(a) ? 1 : 0);
return entriesWithKeys(voices).toSorted((a, b) => {
return (voicesOfLocale.includes(b.key as VoiceKey) ? 1 : 0) - (voicesOfLocale.includes(a.key as VoiceKey) ? 1 : 0);
});
});
</script>
@ -70,8 +70,8 @@ const sortedVoices = computed(() => {
<option :value="null">
<T>profile.pronunciation.voice.without</T>
</option>
<option v-for="voice of sortedVoices" :key="voice" :value="voice">
{{ voice.toUpperCase() }}
<option v-for="voice of sortedVoices" :key="voice.key" :value="voice.key">
{{ voice.key.toUpperCase() }} {{ voice.name }}
</option>
</select>
<PronunciationSpeaker

View File

@ -29,7 +29,7 @@ pronouns:
pronunciation:
enabled: false
ipa: true
voices: ['tok']
voices: ['us']
sources:
enabled: false

View File

@ -6,6 +6,10 @@ export type Voice = AwsPollyVoice | NarakeetVoice;
* @see https://docs.aws.amazon.com/polly/latest/dg/voicelist.html
*/
export interface AwsPollyVoice {
/**
* human-readable name
*/
name: string;
/**
* text-to-speech provider (aws_polly is the default, if not specified)
*/
@ -25,6 +29,10 @@ export interface AwsPollyVoice {
}
export interface NarakeetVoice {
/**
* human-readable name
*/
name: string;
/**
* text-to-speech provider
*/
@ -43,131 +51,157 @@ const defineVoices = <T extends Record<string, Voice>>(voices: T) => voices as R
export const voices = defineVoices({
ar: {
name: 'العربية',
language: 'arb',
voice: 'Zeina',
engine: 'standard',
},
ae: {
name: '(الخليجية) العربية',
language: 'ar-AE',
voice: 'Hala',
engine: 'neural',
},
de: {
name: 'Deutsch',
language: 'de-DE',
voice: 'Vicki',
engine: 'standard',
},
gb: {
name: 'English (British)',
language: 'en-GB',
voice: 'Emma',
engine: 'neural',
},
us: {
name: 'English (American)',
language: 'es-US',
voice: 'Lupe',
engine: 'standard',
},
es: {
name: 'Español (España)',
language: 'es-ES',
voice: 'Lucia',
engine: 'standard',
},
mx: {
name: 'Español (México)',
language: 'es-MX',
voice: 'Mia',
engine: 'standard',
},
fi: {
name: 'Suomi',
language: 'fi-FI',
voice: 'Suvi',
engine: 'neural',
},
fr: {
name: 'Français (France)',
language: 'fr-FR',
voice: 'Lea',
engine: 'standard',
},
ca: {
name: 'Français (Canada)',
language: 'fr-CA',
voice: 'Gabrielle',
engine: 'neural',
},
bos: {
name: 'Босански',
language: 'bos',
voice: 'suada',
provider: 'narakeet',
},
hrv: {
name: 'Hrvatski',
language: 'hrv',
voice: 'jasna',
provider: 'narakeet',
},
srp: {
name: 'Српски',
language: 'srp',
voice: 'milica-latin',
provider: 'narakeet',
},
it: {
name: 'Italiano',
language: 'it-IT',
voice: 'Bianca',
engine: 'neural',
},
ja: {
name: '日本語',
language: 'ja-JP',
voice: 'Mizuki',
engine: 'standard',
},
ko: {
name: '한국어',
language: 'ko-KR',
voice: 'Seoyeon',
engine: 'neural',
},
nb: {
name: 'Norsk',
language: 'nb-NO',
voice: 'Liv',
engine: 'standard',
},
nl: {
name: 'Nederlands',
language: 'nl-NL',
voice: 'Ruben',
engine: 'standard',
},
pl: {
name: 'Polski',
language: 'pl-PL',
voice: 'Ewa',
engine: 'standard',
},
pt: {
name: 'Português (europeu)',
language: 'pt-PT',
voice: 'Cristiano',
engine: 'standard',
},
br: {
name: 'Português (brasileiro)',
language: 'pt-BR',
voice: 'Vitoria',
engine: 'standard',
},
ro: {
name: 'Română',
language: 'ro-RO',
voice: 'Carmen',
engine: 'standard',
},
ru: {
name: 'Русский',
language: 'ru-RU',
voice: 'Tatyana',
engine: 'standard',
},
se: {
name: 'Svenska',
language: 'sv-SE',
voice: 'Astrid',
engine: 'standard',
},
tok: {
language: 'es-US',
voice: 'Lupe',
engine: 'standard',
},
tr: {
name: 'Türkçe',
language: 'tr-TR',
voice: 'Filiz',
engine: 'standard',
},
cn: {
name: '中文(普通话)',
language: 'cmn-CN',
voice: 'Zhiyu',
engine: 'standard',