(pronouns) display pronunciation speaker on morphemes in grammar table

This commit is contained in:
Valentyne Stigloher 2023-11-26 16:46:59 +01:00
parent eb916934f5
commit 60b788bf3c
3 changed files with 34 additions and 13 deletions

View File

@ -7,11 +7,9 @@
<small v-if="link">
(<nuxt-link :to="'/' + pronoun.canonicalName"><Spelling escape :text="pronoun.canonicalName"/></nuxt-link>)
</small>
<template v-if="config.pronunciation.enabled && pronunciation && pronoun.pronounceable && example.toPronunciationString(pronoun)">
<PronunciationSpeaker v-for="voice in voices" :key="voice"
:pronunciation="example.toPronunciationString(pronoun)" :voice="voice"
/>
</template>
<Pronunciation v-if="pronunciation && pronoun.pronounceable && example.toPronunciationString(pronoun)"
:pronunciation="example.toPronunciationString(pronoun)"
/>
</span>
</template>
@ -24,10 +22,5 @@
link: { type: Boolean },
pronunciation: { type: Boolean },
},
computed: {
voices() {
return Object.keys(this.config.pronunciation.voices);
},
},
}
</script>

View File

@ -1,9 +1,9 @@
<template>
<span v-if="pronoun.getMorpheme(morpheme, counter)">
<Morpheme :pronoun="pronoun" :morpheme="morpheme" :counter="counter" :prepend="prepend" :append="append"/>
<span v-if="config.pronunciation.enabled && pronoun.pronounceable && pronoun.getPronunciation(morpheme, counter) && !pronoun.getPronunciation(morpheme, counter).startsWith('=')" class="text-muted">
/{{prependPr}}{{pronoun.getPronunciation(morpheme, counter)}}{{appendPr}}/
</span>
<Pronunciation v-if="pronoun.pronounceable && pronoun.getPronunciation(morpheme, counter) && !pronoun.getPronunciation(morpheme, counter).startsWith('=')"
:pronunciation="`/${prependPr}${pronoun.getPronunciation(morpheme, counter)}${appendPr}/`" text
/>
</span>
</template>

View File

@ -0,0 +1,28 @@
<template>
<span>
<span v-if="text" class="text-muted">
{{ pronunciation }}
</span>
<PronunciationSpeaker v-for="voice in voices" :key="voice"
:pronunciation="pronunciation" :voice="voice"
/>
</span>
</template>
<script>
export default {
props: {
pronunciation: { required: true, type: String },
text: { default: false, type: Boolean },
},
computed: {
voices() {
if (this.config.pronunciation.enabled) {
return Object.keys(this.config.pronunciation.voices);
} else {
return [];
}
},
},
}
</script>