snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
Some checks failed
Prosody Plugin Tests / test (push) Failing after 10m11s
Close stale issues and PRs / stale (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-15 15:56:32 +05:00
commit 1d2bfcac0c
3159 changed files with 464524 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
import { connect } from 'react-redux';
import { IReduxState } from '../../../app/types';
import { openDialog } from '../../../base/dialog/actions';
import { translate } from '../../../base/i18n/functions';
import { IconTranslate } from '../../../base/icons/svg';
import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import AudioTranslationDialog from './AudioTranslationDialog';
interface IProps extends AbstractButtonProps {
/**
* The target language remote audio is currently translated into, or null.
*/
_language: string | null;
}
/**
* A toolbar button that opens the AI audio-translation language selector.
*/
class AudioTranslationButton extends AbstractButton<IProps> {
override accessibilityLabel = 'toolbar.accessibilityLabel.audioTranslation';
override icon = IconTranslate;
override label = 'toolbar.audioTranslation';
override tooltip = 'toolbar.audioTranslation';
/**
* Handles clicking the button by opening the language selector dialog.
*
* @override
* @returns {void}
*/
override _handleClick() {
this.props.dispatch(openDialog('AudioTranslationDialog', AudioTranslationDialog));
}
/**
* Indicates whether this button is in the toggled (translation-on) state.
*
* @override
* @returns {boolean}
*/
override _isToggled() {
return Boolean(this.props._language);
}
}
/**
* Maps (parts of) the redux state to the button's props.
*
* @param {IReduxState} state - The redux state.
* @returns {Object}
*/
function _mapStateToProps(state: IReduxState) {
return {
_language: state['features/audio-translation'].language
};
}
export default translate(connect(_mapStateToProps)(AudioTranslationButton));

View File

@@ -0,0 +1,89 @@
import React, { useCallback } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { makeStyles } from 'tss-react/mui';
import { IReduxState } from '../../../app/types';
import { hideDialog } from '../../../base/dialog/actions';
import { translate } from '../../../base/i18n/functions';
import Dialog from '../../../base/ui/components/web/Dialog';
import { setAudioTranslationLanguage, setParticipantAudioTranslationLanguage } from '../../actions';
import { SUPPORTED_TRANSLATION_LANGUAGES } from '../../constants';
import AudioTranslationLanguageItem from './AudioTranslationLanguageItem';
interface IProps {
/**
* When set, the dialog targets this single participant (overriding the default); otherwise it sets the
* default language for every speaker.
*/
participantId?: string;
/**
* Invoked to obtain translated strings.
*/
t: (key: string) => string;
}
const useStyles = makeStyles()(() => {
return {
list: {
display: 'flex',
flexDirection: 'column'
}
};
});
/**
* A dialog for selecting the AI audio-translation target language (or off).
*
* @param {IProps} props - The component's props.
* @returns {ReactElement}
*/
const AudioTranslationDialog = ({ participantId, t }: IProps) => {
const dispatch = useDispatch();
const { classes: styles } = useStyles();
const defaultLanguage = useSelector((state: IReduxState) => state['features/audio-translation'].language);
const participantLanguages
= useSelector((state: IReduxState) => state['features/audio-translation'].participantLanguages);
// Highlight the effective language for the target: the per-participant override if one is set, else the
// default. (For the conference-wide dialog there is no participantId, so this is just the default.)
const language = participantId && participantId in participantLanguages
? participantLanguages[participantId]
: defaultLanguage;
const onSelect = useCallback((code: string | null) => {
if (participantId) {
dispatch(setParticipantAudioTranslationLanguage(participantId, code));
} else {
dispatch(setAudioTranslationLanguage(code));
}
dispatch(hideDialog());
}, [ dispatch, participantId ]);
return (
<Dialog
cancel = {{ hidden: true }}
ok = {{ hidden: true }}
titleKey = 'toolbar.audioTranslation'>
<div className = { styles.list }>
<AudioTranslationLanguageItem
code = { null }
label = { t('toolbar.audioTranslationOff') }
onSelect = { onSelect }
selected = { !language } />
{ SUPPORTED_TRANSLATION_LANGUAGES.map(({ code, label }) => (
<AudioTranslationLanguageItem
code = { code }
key = { code }
label = { label }
onSelect = { onSelect }
selected = { language === code } />
)) }
</div>
</Dialog>
);
};
export default translate(AudioTranslationDialog);

View File

@@ -0,0 +1,71 @@
import React, { useCallback } from 'react';
import { makeStyles } from 'tss-react/mui';
interface IProps {
/**
* The target language code, or null for the "off" option.
*/
code: string | null;
/**
* The label to display.
*/
label: string;
/**
* Called with this item's code when it is selected.
*/
onSelect: (code: string | null) => void;
/**
* Whether this item is the currently-selected option.
*/
selected: boolean;
}
const useStyles = makeStyles()(theme => {
return {
item: {
display: 'flex',
alignItems: 'center',
padding: '12px 16px',
cursor: 'pointer',
border: 'none',
background: 'none',
textAlign: 'left',
fontSize: '0.875rem',
color: theme.palette.text01,
borderRadius: `${theme.shape.borderRadius}px`,
'&:hover': {
backgroundColor: theme.palette.ui02
}
},
selected: {
fontWeight: 700,
color: theme.palette.link01
}
};
});
/**
* A single selectable language row in the audio-translation dialog.
*
* @param {IProps} props - The component's props.
* @returns {ReactElement}
*/
const AudioTranslationLanguageItem = ({ code, label, onSelect, selected }: IProps) => {
const { classes: styles, cx } = useStyles();
const onClick = useCallback(() => onSelect(code), [ code, onSelect ]);
return (
<button
className = { cx(styles.item, selected && styles.selected) }
onClick = { onClick }
type = 'button'>
{ label }
</button>
);
};
export default AudioTranslationLanguageItem;

View File

@@ -0,0 +1,47 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import { makeStyles } from 'tss-react/mui';
import { IconTranslate } from '../../../base/icons/svg';
import Label from '../../../base/label/components/web/Label';
import Tooltip from '../../../base/tooltip/components/Tooltip';
import { isAudioTranslationActiveInMeeting } from '../../functions';
const useStyles = makeStyles()(theme => {
return {
translation: {
background: theme.palette.action01
}
};
});
/**
* Conference-header label shown while audio translation is active in the meeting.
*
* @returns {ReactElement|null}
*/
const TranslationLabel = () => {
const { classes: styles } = useStyles();
const { t } = useTranslation();
const active = useSelector(isAudioTranslationActiveInMeeting);
if (!active) {
return null;
}
const content = t('audioTranslation.labelTooltip');
return (
<Tooltip
content = { content }
position = { 'bottom' }>
<Label
accessibilityText = { content }
className = { styles.translation }
icon = { IconTranslate } />
</Tooltip>
);
};
export default TranslationLabel;