From f3a8cc85232b6172c3b61caba78042703307ad1c Mon Sep 17 00:00:00 2001 From: lucasferreiralimax Date: Tue, 12 Nov 2024 21:21:23 -0300 Subject: [PATCH 1/4] feat: clipboard in example --- src/App.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/App.vue b/src/App.vue index 75c77f4..59ec689 100755 --- a/src/App.vue +++ b/src/App.vue @@ -62,6 +62,7 @@ function returnVoiceTranscript(transcript) { :status="isVoiceCaptureExample" :lang="langSelect" :mode="modeSelect" + :clipboard="true" @voiceTranscript="returnVoiceTranscript" @onStatus="statusVoiceCapture" /> From 58c33296625aa7c715202204473f8ae684105862 Mon Sep 17 00:00:00 2001 From: lucasferreiralimax Date: Tue, 12 Nov 2024 21:21:40 -0300 Subject: [PATCH 2/4] feat: add clipboard in voicecapture --- src/components/VoiceCapture.vue | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/components/VoiceCapture.vue b/src/components/VoiceCapture.vue index eb8b8c6..eeb87e4 100755 --- a/src/components/VoiceCapture.vue +++ b/src/components/VoiceCapture.vue @@ -41,6 +41,10 @@ export default { type: String, default: 'fullscreen', }, + clipboard: { + type: Boolean, + default: false, + }, }, emits: ['voiceTranscript', 'onStatus'], setup(props, { emit }) { @@ -123,6 +127,16 @@ export default { translatedText.value = interimTranscript || finalTranscript.value; if (finalTranscript.value) { + if(props.clipboard) { + navigator.clipboard.writeText(finalTranscript.value).then( + () => { + console.log('Text copied to clipboard'); + }, + (err) => { + console.error('Could not copy text to clipboard', err); + } + ); + } emit('voiceTranscript', finalTranscript.value); deactivateVoice(); } From b1285d7f7972bee9d6e5d2898905f4ef386c46c1 Mon Sep 17 00:00:00 2001 From: lucasferreiralimax Date: Tue, 12 Nov 2024 21:29:06 -0300 Subject: [PATCH 3/4] fix: update translate --- src/components/VoiceCapture.translate.ts | 130 ++++++++++++++--------- 1 file changed, 78 insertions(+), 52 deletions(-) diff --git a/src/components/VoiceCapture.translate.ts b/src/components/VoiceCapture.translate.ts index 384f17e..d2fe513 100644 --- a/src/components/VoiceCapture.translate.ts +++ b/src/components/VoiceCapture.translate.ts @@ -1,80 +1,106 @@ export const translates = { en: { - speakNow: 'Speak now', - noSpeech: 'No speech detected.', - audioCapture: 'Audio capture problem.', - enableMicrophone: 'Enable the microphone', + speakNow: "Speak now", + noSpeech: "No speech detected.", + audioCapture: "Audio capture problem.", + enableMicrophone: "Enable the microphone", + close: "Close voice capture", + open: "Start voice capture", }, pt: { - speakNow: 'Fale agora', - noSpeech: 'Nenhuma fala detectada.', - audioCapture: 'Problema na captura de áudio.', - enableMicrophone: 'Ative o microfone', + speakNow: "Fale agora", + noSpeech: "Nenhuma fala detectada.", + audioCapture: "Problema na captura de áudio.", + enableMicrophone: "Ative o microfone", + close: "Fechar captura de voz", + open: "Iniciar captura de voz", }, es: { - speakNow: 'Habla ahora', - noSpeech: 'No se detectó voz.', - audioCapture: 'Problema en la captura de audio.', - enableMicrophone: 'Activa el micrófono', + speakNow: "Habla ahora", + noSpeech: "No se detectó voz.", + audioCapture: "Problema en la captura de audio.", + enableMicrophone: "Activa el micrófono", + close: "Cerrar captura de voz", + open: "Iniciar captura de voz", }, fr: { - speakNow: 'Parlez maintenant', - noSpeech: 'Aucune parole détectée.', - audioCapture: 'Problème de capture audio.', - enableMicrophone: 'Activez le microphone', + speakNow: "Parlez maintenant", + noSpeech: "Aucune parole détectée.", + audioCapture: "Problème de capture audio.", + enableMicrophone: "Activez le microphone", + close: "Fermer la capture vocale", + open: "Démarrer la capture vocale", }, de: { - speakNow: 'Sprich jetzt', - noSpeech: 'Keine Sprache erkannt.', - audioCapture: 'Audioproblem.', - enableMicrophone: 'Aktivieren Sie das Mikrofon', + speakNow: "Sprich jetzt", + noSpeech: "Keine Sprache erkannt.", + audioCapture: "Audioproblem.", + enableMicrophone: "Aktivieren Sie das Mikrofon", + close: "Spracherfassung schließen", + open: "Spracherfassung starten", }, it: { - speakNow: 'Parla ora', - noSpeech: 'Nessuna parola rilevata.', - audioCapture: 'Problema con la cattura audio.', - enableMicrophone: 'Abilita il microfono', + speakNow: "Parla ora", + noSpeech: "Nessuna parola rilevata.", + audioCapture: "Problema con la cattura audio.", + enableMicrophone: "Abilita il microfono", + close: "Chiudere la cattura vocale", + open: "Avviare la cattura vocale", }, ja: { - speakNow: '今話してください', - noSpeech: '音声が検出されませんでした。', - audioCapture: 'オーディオキャプチャの問題。', - enableMicrophone: 'マイクを有効にしてください', + speakNow: "今話してください", + noSpeech: "音声が検出されませんでした。", + audioCapture: "オーディオキャプチャの問題。", + enableMicrophone: "マイクを有効にしてください", + close: "音声キャプチャを閉じる", + open: "音声キャプチャを開始", }, zh: { - speakNow: '现在说话', - noSpeech: '没有检测到语音。', - audioCapture: '音频捕获问题。', - enableMicrophone: '启用麦克风', + speakNow: "现在说话", + noSpeech: "没有检测到语音。", + audioCapture: "音频捕获问题。", + enableMicrophone: "启用麦克风", + close: "关闭语音捕捉", + open: "开始语音捕捉", }, ru: { - speakNow: 'Говорите сейчас', - noSpeech: 'Речь не обнаружена.', - audioCapture: 'Проблема с захватом звука.', - enableMicrophone: 'Включите микрофон', + speakNow: "Говорите сейчас", + noSpeech: "Речь не обнаружена.", + audioCapture: "Проблема с захватом звука.", + enableMicrophone: "Включите микрофон", + close: "Закрыть захват голоса", + open: "Начать захват голоса", }, ar: { - speakNow: 'تحدث الآن', - noSpeech: 'لم يتم اكتشاف الكلام.', - audioCapture: 'مشكلة في التقاط الصوت.', - enableMicrophone: 'قم بتمكين الميكروفون', + speakNow: "تحدث الآن", + noSpeech: "لم يتم اكتشاف الكلام.", + audioCapture: "مشكلة في التقاط الصوت.", + enableMicrophone: "قم بتمكين الميكروفون", + close: "إغلاق التقاط الصوت", + open: "بدء التقاط الصوت", }, ko: { - speakNow: '지금 말하세요', - noSpeech: '음성이 감지되지 않았습니다.', - audioCapture: '오디오 캡처 문제.', - enableMicrophone: '마이크를 활성화하세요', + speakNow: "지금 말하세요", + noSpeech: "음성이 감지되지 않았습니다.", + audioCapture: "오디오 캡처 문제.", + enableMicrophone: "마이크를 활성화하세요", + close: "음성 캡처 닫기", + open: "음성 캡처 시작", }, nl: { - speakNow: 'Spreek nu', - noSpeech: 'Geen spraak gedetecteerd.', - audioCapture: 'Probleem met audiovangst.', - enableMicrophone: 'Activeer de microfoon', + speakNow: "Spreek nu", + noSpeech: "Geen spraak gedetecteerd.", + audioCapture: "Probleem met audiovangst.", + enableMicrophone: "Activeer de microfoon", + close: "Stemopname sluiten", + open: "Stemopname starten", }, sv: { - speakNow: 'Tala nu', - noSpeech: 'Ingen tal upptäckt.', - audioCapture: 'Problem med ljudinspelning.', - enableMicrophone: 'Aktivera mikrofonen', + speakNow: "Tala nu", + noSpeech: "Ingen tal upptäckt.", + audioCapture: "Problem med ljudinspelning.", + enableMicrophone: "Aktivera mikrofonen", + close: "Stäng röstinspelning", + open: "Starta röstinspelning", }, }; From f9a9f4f564381f2e3d99c07bc88a8c8b978db397 Mon Sep 17 00:00:00 2001 From: lucasferreiralimax Date: Tue, 12 Nov 2024 21:29:32 -0300 Subject: [PATCH 4/4] feat: improvement a11y and translate --- src/components/VoiceCapture.vue | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/components/VoiceCapture.vue b/src/components/VoiceCapture.vue index eeb87e4..830312b 100755 --- a/src/components/VoiceCapture.vue +++ b/src/components/VoiceCapture.vue @@ -3,17 +3,26 @@ class="voicecapture" :class="{ active: status, [mode]: mode }" @click="deactivateVoice" + aria-modal="true" + role="dialog" + :aria-expanded="status ? 'true' : 'false'" > - -

{{ translatedText }}

+

{{ translatedText }}