}
text={Locale.Chat.Send}
diff --git a/app/components/chat/speechRecorder.tsx b/app/components/chat/speechRecorder.tsx
index 9cc810bfd..33801b323 100644
--- a/app/components/chat/speechRecorder.tsx
+++ b/app/components/chat/speechRecorder.tsx
@@ -1,5 +1,6 @@
import React, { useState, useEffect } from "react";
-
+import VoiceIcon from "@/app/icons/voice.svg";
+import { getLang, formatLang } from "@/app/locales";
type SpeechRecognitionType =
| typeof window.SpeechRecognition
| typeof window.webkitSpeechRecognition;
@@ -22,29 +23,42 @@ export default function SpeechRecorder({
}
}, []);
return (
-
-
-
+ <>
+ {speechRecognition && (
+
+
+
+ )}
+ >
);
}
diff --git a/app/icons/voice.svg b/app/icons/voice.svg
new file mode 100644
index 000000000..eafcdd907
--- /dev/null
+++ b/app/icons/voice.svg
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/app/locales/index.ts b/app/locales/index.ts
index 6e8088a98..336c8e66f 100644
--- a/app/locales/index.ts
+++ b/app/locales/index.ts
@@ -70,6 +70,28 @@ export const ALL_LANG_OPTIONS: Record
= {
sk: "Slovensky",
};
+const LANG_CODE_MAPPING = {
+ cn: "zh-CN",
+ en: "en-US",
+ tw: "zh-TW",
+ pt: "pt-BR",
+ jp: "ja-JP",
+ ko: "ko-KR",
+ id: "id-ID",
+ fr: "fr-FR",
+ es: "es-ES",
+ it: "it-IT",
+ tr: "tr-TR",
+ de: "de-DE",
+ vi: "vi-VN",
+ ru: "ru-RU",
+ cs: "cs-CZ",
+ no: "nb-NO",
+ ar: "ar-SA",
+ bn: "bn-BD",
+ sk: "sk-SK",
+};
+
const LANG_KEY = "lang";
const DEFAULT_LANG = "en";
@@ -81,6 +103,13 @@ merge(fallbackLang, targetLang);
export default fallbackLang as LocaleType;
+export const formatLang = (languageCode: string) => {
+ return (
+ LANG_CODE_MAPPING[languageCode as keyof typeof LANG_CODE_MAPPING] ||
+ languageCode
+ );
+};
+
function getItem(key: string) {
try {
return localStorage.getItem(key);