Skip to content

Commit 85d9c7f

Browse files
authored
Fix typo: "speach" should be "speech" (#1354)
1 parent d789a77 commit 85d9c7f

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const LanguageVoiceMapping: Record<string, VoiceId> = {
1717
de: 'Vicki',
1818
};
1919

20-
const useSpeach = (language: string) => {
20+
const useSpeech = (language: string) => {
2121
const { t } = useTranslation();
2222
const [loading, setLoading] = useState(false);
2323
const [voiceId, setVoiceId] = useState<VoiceId>('Joanna');
@@ -33,7 +33,7 @@ const useSpeach = (language: string) => {
3333

3434
return {
3535
loading,
36-
synthesizeSpeach: async (text: string): Promise<string> => {
36+
synthesizeSpeech: async (text: string): Promise<string> => {
3737
setLoading(true);
3838

3939
const token = (await fetchAuthSession()).tokens?.idToken?.toString();
@@ -87,4 +87,4 @@ const useSpeach = (language: string) => {
8787
};
8888
};
8989

90-
export default useSpeach;
90+
export default useSpeech;

packages/web/src/pages/TranslatePage.tsx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { TranslatePageQueryParams } from '../@types/navigate';
3131
import { MODELS } from '../hooks/useModel';
3232
import { getPrompter } from '../prompts';
3333
import queryString from 'query-string';
34-
import useSpeach from '../hooks/useSpeach';
34+
import useSpeech from '../hooks/useSpeech';
3535
import { useTranslation } from 'react-i18next';
3636

3737
const languages = ['en', 'ja', 'zh', 'ko', 'fr', 'es', 'de', 'th', 'vi'];
@@ -125,7 +125,7 @@ const TranslatePage: React.FC = () => {
125125
const stopReason = getStopReason();
126126
const [auto, setAuto] = useLocalStorageBoolean('Auto_Translate', true);
127127
const [audio, setAudioInput] = useState(false); // Audio input flag
128-
const { synthesizeSpeach, loading: speachIsLoading } = useSpeach(language);
128+
const { synthesizeSpeech, loading: speechIsLoading } = useSpeech(language);
129129

130130
useEffect(() => {
131131
updateSystemContextByModel();
@@ -257,41 +257,41 @@ const TranslatePage: React.FC = () => {
257257
}, []);
258258

259259
const audioRef = useRef<HTMLAudioElement | null>(null);
260-
const [isSpeachPlaying, setIsSpeachPlaying] = useState(false);
260+
const [isSpeechPlaying, setIsSpeechPlaying] = useState(false);
261261

262-
const handleSpeachEnded = useCallback(() => {
263-
setIsSpeachPlaying(false);
264-
}, [setIsSpeachPlaying]);
262+
const handleSpeechEnded = useCallback(() => {
263+
setIsSpeechPlaying(false);
264+
}, [setIsSpeechPlaying]);
265265

266-
const startOrStopSpeach = useCallback(async () => {
267-
if (speachIsLoading) return;
266+
const startOrStopSpeech = useCallback(async () => {
267+
if (speechIsLoading) return;
268268

269269
// If it is playing, stop it
270-
if (isSpeachPlaying && audioRef.current) {
271-
setIsSpeachPlaying(false);
270+
if (isSpeechPlaying && audioRef.current) {
271+
setIsSpeechPlaying(false);
272272

273273
audioRef.current.pause();
274274
audioRef.current.currentTime = 0;
275275
audioRef.current = null;
276276
return;
277277
}
278278

279-
setIsSpeachPlaying(true);
279+
setIsSpeechPlaying(true);
280280

281-
const speachUrl = await synthesizeSpeach(translatedSentence);
282-
const audio = new Audio(speachUrl!);
281+
const speechUrl = await synthesizeSpeech(translatedSentence);
282+
const audio = new Audio(speechUrl!);
283283

284284
audioRef.current = audio;
285-
audio.addEventListener('ended', handleSpeachEnded);
285+
audio.addEventListener('ended', handleSpeechEnded);
286286
audio.play();
287287
}, [
288288
translatedSentence,
289-
synthesizeSpeach,
289+
synthesizeSpeech,
290290
audioRef,
291-
setIsSpeachPlaying,
292-
isSpeachPlaying,
293-
handleSpeachEnded,
294-
speachIsLoading,
291+
setIsSpeechPlaying,
292+
isSpeechPlaying,
293+
handleSpeechEnded,
294+
speechIsLoading,
295295
]);
296296

297297
return (
@@ -381,8 +381,8 @@ const TranslatePage: React.FC = () => {
381381
</div>
382382
)}
383383
<div className="flex w-full justify-end">
384-
<ButtonIcon onClick={startOrStopSpeach}>
385-
{isSpeachPlaying ? (
384+
<ButtonIcon onClick={startOrStopSpeech}>
385+
{isSpeechPlaying ? (
386386
<PiSpeakerSimpleHighFill />
387387
) : (
388388
<PiSpeakerSimpleHigh />

0 commit comments

Comments
 (0)