Skip to content

Commit

Permalink
Specify SpeechSynthesisUtterance lang explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
wtetsu committed Feb 11, 2022
1 parent 3119a3e commit ce93732
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/lib/sound.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const pronounce = (text) => {
return;
}
const ssu = new SpeechSynthesisUtterance(text);
if (!isEnglishLikeCharacter(text.charCodeAt(0))) {
if (isEnglishLikeCharacter(text.charCodeAt(0))) {
ssu.lang = "en-US";
} else {
ssu.lang = "ja-JP";
}
speechSynthesis.speak(ssu);
Expand Down

0 comments on commit ce93732

Please sign in to comment.