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(subtitles): hide translation UI for both web and native

Calin-Teodor775cc52f6669
diff --git a/react/features/chat/components/AbstractClosedCaptions.tsx b/react/features/chat/components/AbstractClosedCaptions.tsx
index a02ebb51cc..8692a58aae 100644
--- a/react/features/chat/components/AbstractClosedCaptions.tsx
+++ b/react/features/chat/components/AbstractClosedCaptions.tsx
@@ -15,6 +15,7 @@ export type AbstractProps = {
canStartSubtitles: boolean;
filteredSubtitles: ISubtitle[];
groupedSubtitles: IMessageGroup<ISubtitle>[];
+ isAsyncTranscriptionEnabled: boolean | undefined;
isButtonPressed: boolean;
isTranscribing: boolean;
startClosedCaptions: () => void;
@@ -101,6 +102,7 @@ const AbstractClosedCaptions = (Component: ComponentType<AbstractProps>) => () =
canStartSubtitles = { _canStartSubtitles }
filteredSubtitles = { filteredSubtitles }
groupedSubtitles = { groupedSubtitles }
+ isAsyncTranscriptionEnabled = { isAsyncTranscriptionEnabled }
isButtonPressed = { isButtonPressed }
isTranscribing = { _isTranscribing }
startClosedCaptions = { startClosedCaptions } />
diff --git a/react/features/chat/components/native/ClosedCaptions.tsx b/react/features/chat/components/native/ClosedCaptions.tsx
index 855c1beeb1..fd9dc772bd 100644
--- a/react/features/chat/components/native/ClosedCaptions.tsx
+++ b/react/features/chat/components/native/ClosedCaptions.tsx
@@ -31,6 +31,7 @@ const ClosedCaptions = ({
canStartSubtitles,
filteredSubtitles,
groupedSubtitles,
+ isAsyncTranscriptionEnabled,
isButtonPressed,
isTranscribing,
startClosedCaptions
@@ -91,17 +92,20 @@ const ClosedCaptions = ({
return (
<>
- <View style = { closedCaptionsStyles.languageButtonContainer as ViewStyle }>
- <Text style = { closedCaptionsStyles.languageButtonText }>{ t('transcribing.translateTo') }:</Text>
- <TouchableHighlight onPress = { navigateToLanguageSelect }>
- <View style = { closedCaptionsStyles.languageButtonContent as ViewStyle }>
- <Text style = { closedCaptionsStyles.languageButtonText }>{ t(selectedLanguage ?? 'transcribing.subtitlesOff') }</Text>
- <Icon
- size = { 24 }
- src = { IconArrowRight } />
- </View>
- </TouchableHighlight>
- </View>
+ {
+ // Hide the "Translate to" option when asyncTranscription is enabled
+ !isAsyncTranscriptionEnabled && <View style = { closedCaptionsStyles.languageButtonContainer as ViewStyle }>
+ <Text style = { closedCaptionsStyles.languageButtonText }>{ t('transcribing.translateTo') }:</Text>
+ <TouchableHighlight onPress = { navigateToLanguageSelect }>
+ <View style = { closedCaptionsStyles.languageButtonContent as ViewStyle }>
+ <Text style = { closedCaptionsStyles.languageButtonText }>{ t(selectedLanguage ?? 'transcribing.subtitlesOff') }</Text>
+ <Icon
+ size = { 24 }
+ src = { IconArrowRight } />
+ </View>
+ </TouchableHighlight>
+ </View>
+ }
<View style = { closedCaptionsStyles.messagesContainer as ViewStyle }>
<SubtitlesMessagesContainer
groups = { groupedSubtitles }
diff --git a/react/features/chat/components/web/ClosedCaptionsTab.tsx b/react/features/chat/components/web/ClosedCaptionsTab.tsx
index a0c763d5a3..5a05255234 100644
--- a/react/features/chat/components/web/ClosedCaptionsTab.tsx
+++ b/react/features/chat/components/web/ClosedCaptionsTab.tsx
@@ -76,6 +76,7 @@ const ClosedCaptionsTab = ({
canStartSubtitles,
filteredSubtitles,
groupedSubtitles,
+ isAsyncTranscriptionEnabled,
isButtonPressed,
isTranscribing,
startClosedCaptions
@@ -114,7 +115,7 @@ const ClosedCaptionsTab = ({
return (
<div className = { classes.container }>
- <LanguageSelector />
+ <LanguageSelector isAsyncTranscriptionEnabled = { isAsyncTranscriptionEnabled } />
<div className = { classes.messagesContainer }>
<SubtitlesMessagesContainer
groups = { groupedSubtitles }
diff --git a/react/features/subtitles/components/web/LanguageSelector.tsx b/react/features/subtitles/components/web/LanguageSelector.tsx
index 0d55a2f1bf..7906382ccf 100644
--- a/react/features/subtitles/components/web/LanguageSelector.tsx
+++ b/react/features/subtitles/components/web/LanguageSelector.tsx
@@ -8,6 +8,10 @@ import Select from '../../../base/ui/components/web/Select';
import { setRequestingSubtitles } from '../../actions.any';
import { getAvailableSubtitlesLanguages } from '../../functions.any';
+interface IProps {
+ isAsyncTranscriptionEnabled: boolean | undefined;
+}
+
/**
* The styles for the LanguageSelector component.
*
@@ -42,7 +46,7 @@ const useStyles = makeStyles()(theme => {
* @param {IProps} props - The component props.
* @returns {JSX.Element} - The rendered component.
*/
-function LanguageSelector() {
+function LanguageSelector({ isAsyncTranscriptionEnabled }: IProps) {
const { t } = useTranslation();
const { classes } = useStyles();
const dispatch = useDispatch();
@@ -51,8 +55,6 @@ function LanguageSelector() {
state,
selectedLanguage?.replace('translation-languages:', '')
));
- const isAsyncTranscriptionEnabled = useSelector((state: IReduxState) =>
- state['features/base/conference'].conference?.getMetadataHandler()?.getMetadata()?.asyncTranscription);
// Hide the "Translate to" option when asyncTranscription is enabled
if (isAsyncTranscriptionEnabled) {