From c356f43df594f0e2837aad2911d6fd10f727503a Mon Sep 17 00:00:00 2001 From: Piaoyang Cui Date: Sat, 29 Jul 2023 14:52:00 -0700 Subject: [PATCH] Add 6 more languages (#223) --- .../rac/Welcome/Settings/SettingsView.swift | 26 ++++++++++++++++++- client/web/src/components/Languages/index.jsx | 5 ++-- client/web/src/hooks/languageCode.js | 6 +++-- .../audio/speech_to_text/whisper.py | 6 +++++ realtime_ai_character/websocket_routes.py | 6 +++++ 5 files changed, 44 insertions(+), 5 deletions(-) diff --git a/client/mobile/ios/rac/rac/Welcome/Settings/SettingsView.swift b/client/mobile/ios/rac/rac/Welcome/Settings/SettingsView.swift index b3f3594c3..ee9091803 100644 --- a/client/mobile/ios/rac/rac/Welcome/Settings/SettingsView.swift +++ b/client/mobile/ios/rac/rac/Welcome/Settings/SettingsView.swift @@ -49,7 +49,7 @@ enum LlmOption: RawRepresentable, Hashable, CaseIterable, Identifiable, Codable enum LanguageOption: RawRepresentable, Hashable, CaseIterable, Identifiable, Codable { - case english, spanish + case english, spanish, french, german, italian, portuguese, polish, hindi init?(rawValue: String) { for option in LanguageOption.allCases { @@ -68,6 +68,18 @@ enum LanguageOption: RawRepresentable, Hashable, CaseIterable, Identifiable, Cod return "en-US" case .spanish: return "es-ES" + case .french: + return "fr-FR" + case .german: + return "de-DE" + case .italian: + return "it-IT" + case .portuguese: + return "pt-PT" + case .polish: + return "pl-PL" + case .hindi: + return "hi-IN" } } @@ -77,6 +89,18 @@ enum LanguageOption: RawRepresentable, Hashable, CaseIterable, Identifiable, Cod return "English" case .spanish: return "Spanish" + case .french: + return "French" + case .german: + return "German" + case .italian: + return "Italian" + case .portuguese: + return "Portuguese" + case .polish: + return "Polish" + case .hindi: + return "Hindi" } } diff --git a/client/web/src/components/Languages/index.jsx b/client/web/src/components/Languages/index.jsx index 6d0c76970..ae49f4f11 100644 --- a/client/web/src/components/Languages/index.jsx +++ b/client/web/src/components/Languages/index.jsx @@ -8,8 +8,9 @@ import React from 'react'; import './style.css' -const Languages = ({preferredLanguage, setPreferredLanguage}) => { - const languages = ["English", "Spanish"]; +const Languages = ({ preferredLanguage, setPreferredLanguage }) => { + const languages = ["English", "Spanish", "French", "German", "Hindi", "Italian", "Polish", + "Portuguese"]; return (
diff --git a/client/web/src/hooks/languageCode.js b/client/web/src/hooks/languageCode.js index c19b4c7eb..982d4e762 100644 --- a/client/web/src/hooks/languageCode.js +++ b/client/web/src/hooks/languageCode.js @@ -16,5 +16,7 @@ export const languageCode = { "Korean": "ko-KR", "Portuguese": "pt-PT", "Russian": "ru-RU", - "Spanish": "es-ES" -} \ No newline at end of file + "Spanish": "es-ES", + "Indian": "hi-IN", + "Polish": "pl-PL" +} diff --git a/realtime_ai_character/audio/speech_to_text/whisper.py b/realtime_ai_character/audio/speech_to_text/whisper.py index 18fdf7f49..e4db17cdd 100644 --- a/realtime_ai_character/audio/speech_to_text/whisper.py +++ b/realtime_ai_character/audio/speech_to_text/whisper.py @@ -24,6 +24,12 @@ WHISPER_LANGUAGE_CODE_MAPPING = { "en-US": "en", "es-ES": "es", + "fr-FR": "fr", + "de-DE": "de", + "it-IT": "it", + "pt-PT": "pt", + "hi-IN": "hi", + "pl-PL": "pl", } class Whisper(Singleton, SpeechToText): diff --git a/realtime_ai_character/websocket_routes.py b/realtime_ai_character/websocket_routes.py index 3e5e38435..552b0bb5f 100644 --- a/realtime_ai_character/websocket_routes.py +++ b/realtime_ai_character/websocket_routes.py @@ -31,6 +31,12 @@ GREETING_TXT_MAP = { "en-US": "Hi, my friend, what brings you here today?", "es-ES": "Hola, mi amigo, ¿qué te trae por aquí hoy?", + "fr-FR": "Salut mon ami, qu'est-ce qui t'amène ici aujourd'hui?", + "de-DE": "Hallo mein Freund, was bringt dich heute hierher?", + "it-IT": "Ciao amico mio, cosa ti porta qui oggi?", + "pt-PT": "Olá meu amigo, o que te traz aqui hoje?", + "hi-IN": "नमस्ते मेरे दोस्त, आज आपको यहां क्या लाया है?", + "pl-PL": "Cześć mój przyjacielu, co cię tu dziś przynosi?", }