Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(transcription): allow custom transcriber languages via config (#16984)

Nishant kumarc3c42b477b76
diff --git a/config.js b/config.js
index b050cc23ec..2724e41082 100644
--- a/config.js
+++ b/config.js
@@ -511,6 +511,15 @@ var config = {
// // ./src/react/features/transcribing/transcriber-langs.json.
// preferredLanguage: 'en-US',
+ // Allows extending the list of supported transcription languages.
+ // Useful for custom transcription backends (e.g. Vosk).
+ //
+ // Example:
+ // customLanguages: {
+ // 'hsb-DE': 'Upper Sorbian (Germany)',
+ // 'dsb-DE': 'Lower Sorbian (Germany)'
+ // },
+
// // Enables automatic turning on transcribing when recording is started
// autoTranscribeOnRecord: false,
diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.ts
index e13197f847..bef1742d5f 100644
--- a/react/features/base/config/configType.ts
+++ b/react/features/base/config/configType.ts
@@ -638,6 +638,7 @@ export interface IConfig {
transcription?: {
autoCaptionOnTranscribe?: boolean;
autoTranscribeOnRecord?: boolean;
+ customLanguages?: object;
disableClosedCaptions?: boolean;
enabled?: boolean;
preferredLanguage?: string;
diff --git a/react/features/transcribing/functions.ts b/react/features/transcribing/functions.ts
index a254f320dd..e597b0383e 100644
--- a/react/features/transcribing/functions.ts
+++ b/react/features/transcribing/functions.ts
@@ -25,6 +25,11 @@ export function determineTranscriptionLanguage(config: IConfig) {
return undefined;
}
+ const transcriberLangs = {
+ ...TRANSCRIBER_LANGS,
+ ...(transcription.customLanguages ?? {})
+ };
+
// Depending on the config either use the language that the app automatically detected or the hardcoded
// config BCP47 value.
// Jitsi language detections uses custom language tags, but the transcriber expects BCP-47 compliant tags,
@@ -34,7 +39,7 @@ export function determineTranscriptionLanguage(config: IConfig) {
: transcription?.preferredLanguage;
// Check if the obtained language is supported by the transcriber
- let safeBCP47Locale = TRANSCRIBER_LANGS[bcp47Locale as keyof typeof TRANSCRIBER_LANGS] && bcp47Locale;
+ let safeBCP47Locale = transcriberLangs[bcp47Locale as keyof typeof transcriberLangs] && bcp47Locale;
if (!safeBCP47Locale) {
safeBCP47Locale = DEFAULT_TRANSCRIBER_LANG;