Skip to content

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

fix(subtitles): display source-language subtitles on stage

damencho83d0bed57bd9
diff --git a/react/features/subtitles/middleware.ts b/react/features/subtitles/middleware.ts
index 8cc0c40243..9d6e2e1e42 100644
--- a/react/features/subtitles/middleware.ts
+++ b/react/features/subtitles/middleware.ts
@@ -284,11 +284,13 @@ function _endpointMessageReceived(store: IStore, next: Function, action: AnyActi
return next(action);
}
- // If the user is not requesting transcriptions just bail.
- // Regex to filter out all possible country codes after language code:
- // this should catch all notations like 'en-GB' 'en_GB' and 'enGB'
- // and be independent of the country code length
- if (!language || (_getPrimaryLanguageCode(json.language) !== _getPrimaryLanguageCode(language))) {
+ // Only display transcription results when the local user is showing subtitles and either
+ // wants the source language (no translation language selected) or the transcription's
+ // language matches the selected one.
+ // The primary language code comparison catches all country-code notations like 'en-GB',
+ // 'en_GB' and 'enGB' independent of the country code length.
+ if (!state['features/subtitles']._requestingSubtitles
+ || (language && _getPrimaryLanguageCode(json.language) !== _getPrimaryLanguageCode(language))) {
return next(action);
}