Skip to content

Commit

Permalink
Merge pull request #265 from mjtc1985/#182/properly-speech-for-speak-…
Browse files Browse the repository at this point in the history
…custom-text

Use custom text value for "Speak custom text" to speech instead ob label value
  • Loading branch information
klues committed May 3, 2023
2 parents 1d211f1 + af0a003 commit a508c39
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/js/service/collectElementService.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,16 +353,17 @@ function getSpeakTextObject(element, dontIncludeAudio) {
base64Sound: audioAction.dataBase64
};
}
let label = getLabel(element);
if (!label) {
let customSpeakAction = element.actions.filter((a) => a.modelName === GridActionSpeakCustom.getModelName())[0];
if (customSpeakAction) {
let lang = customSpeakAction.speakLanguage || i18nService.getContentLang();
label = i18nService.getTranslation(customSpeakAction.speakText, { forceLang: lang });
}
let text;
let customSpeakAction = element.actions.filter((a) => a.modelName === GridActionSpeakCustom.getModelName())[0];
if (customSpeakAction) {
let lang = customSpeakAction.speakLanguage || i18nService.getContentLang();
text = i18nService.getTranslation(customSpeakAction.speakText, { forceLang: lang });
}
if (!text) {
text = getLabel(element);
}
return {
text: label
text: text
};
}

Expand Down

0 comments on commit a508c39

Please sign in to comment.