Skip to content

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

chore(settings) Move language to general tab (#13405)

Horatiu Muresan804f9041a667
diff --git a/react/features/settings/actions.web.ts b/react/features/settings/actions.web.ts
index 1466be6239..cfc22606ce 100644
--- a/react/features/settings/actions.web.ts
+++ b/react/features/settings/actions.web.ts
@@ -106,6 +106,10 @@ export function submitMoreTab(newState: any) {
if (newState.hideSelfView !== currentState.hideSelfView) {
dispatch(updateSettings({ disableSelfView: newState.hideSelfView }));
}
+
+ if (newState.currentLanguage !== currentState.currentLanguage) {
+ i18next.changeLanguage(newState.currentLanguage);
+ }
};
}
@@ -156,10 +160,6 @@ export function submitProfileTab(newState: any) {
if (newState.email !== currentState.email) {
APP.conference.changeLocalEmail(newState.email);
}
-
- if (newState.currentLanguage !== currentState.currentLanguage) {
- i18next.changeLanguage(newState.currentLanguage);
- }
};
}
diff --git a/react/features/settings/components/web/MoreTab.tsx b/react/features/settings/components/web/MoreTab.tsx
index c8d6e2afd0..92fc42ca12 100644
--- a/react/features/settings/components/web/MoreTab.tsx
+++ b/react/features/settings/components/web/MoreTab.tsx
@@ -22,6 +22,12 @@ export interface IProps extends AbstractDialogTabProps, WithTranslation {
*/
classes: any;
+ /**
+ * The currently selected language to display in the language select
+ * dropdown.
+ */
+ currentLanguage: string;
+
/**
* Whether to show hide self view setting.
*/
@@ -42,11 +48,21 @@ export interface IProps extends AbstractDialogTabProps, WithTranslation {
*/
iAmVisitor: boolean;
+ /**
+ * All available languages to display in the language select dropdown.
+ */
+ languages: Array<string>;
+
/**
* The number of max participants to display on stage.
*/
maxStageParticipants: number;
+ /**
+ * Whether or not to display the language select dropdown.
+ */
+ showLanguageSettings: boolean;
+
/**
* Whether or not to display moderator-only settings.
*/
@@ -109,6 +125,7 @@ class MoreTab extends AbstractDialogTab<IProps, any> {
this._renderMaxStageParticipantsSelect = this._renderMaxStageParticipantsSelect.bind(this);
this._onMaxStageParticipantsSelect = this._onMaxStageParticipantsSelect.bind(this);
this._onHideSelfViewChanged = this._onHideSelfViewChanged.bind(this);
+ this._onLanguageItemSelect = this._onLanguageItemSelect.bind(this);
}
/**
@@ -118,7 +135,14 @@ class MoreTab extends AbstractDialogTab<IProps, any> {
* @returns {ReactElement}
*/
render() {
- const { showPrejoinSettings, classes, disableHideSelfView, iAmVisitor, hideSelfView, t } = this.props;
+ const {
+ showPrejoinSettings,
+ classes,
+ disableHideSelfView,
+ iAmVisitor,
+ hideSelfView,
+ showLanguageSettings,
+ t } = this.props;
return (
<div
@@ -137,6 +161,7 @@ class MoreTab extends AbstractDialogTab<IProps, any> {
name = 'hide-self-view'
onChange = { this._onHideSelfViewChanged } />
)}
+ {showLanguageSettings && this._renderLanguageSelect()}
</div>
);
}
@@ -177,6 +202,19 @@ class MoreTab extends AbstractDialogTab<IProps, any> {
super._onChange({ hideSelfView: checked });
}
+ /**
+ * Callback invoked to select a language from select dropdown.
+ *
+ * @param {Object} e - The key event to handle.
+ *
+ * @returns {void}
+ */
+ _onLanguageItemSelect(e: React.ChangeEvent<HTMLSelectElement>) {
+ const language = e.target.value;
+
+ super._onChange({ currentLanguage: language });
+ }
+
/**
* Returns the React Element for modifying prejoin screen settings.
*
@@ -222,6 +260,38 @@ class MoreTab extends AbstractDialogTab<IProps, any> {
value = { maxStageParticipants } />
);
}
+
+ /**
+ * Returns the menu item for changing displayed language.
+ *
+ * @private
+ * @returns {ReactElement}
+ */
+ _renderLanguageSelect() {
+ const {
+ classes,
+ currentLanguage,
+ languages,
+ t
+ } = this.props;
+
+ const languageItems
+ = languages.map((language: string) => {
+ return {
+ value: language,
+ label: t(`languages:${language}`)
+ };
+ });
+
+ return (
+ <Select
+ className = { classes.bottomMargin }
+ label = { t('settings.language') }
+ onChange = { this._onLanguageItemSelect }
+ options = { languageItems }
+ value = { currentLanguage } />
+ );
+ }
}
export default withStyles(styles)(translate(MoreTab));
diff --git a/react/features/settings/components/web/ProfileTab.tsx b/react/features/settings/components/web/ProfileTab.tsx
index ef1ac3b997..13b68fbffe 100644
--- a/react/features/settings/components/web/ProfileTab.tsx
+++ b/react/features/settings/components/web/ProfileTab.tsx
@@ -14,7 +14,6 @@ import { translate } from '../../../base/i18n/functions';
import { withPixelLineHeight } from '../../../base/styles/functions.web';
import Button from '../../../base/ui/components/web/Button';
import Input from '../../../base/ui/components/web/Input';
-import Select from '../../../base/ui/components/web/Select';
import { openLogoutDialog } from '../../actions';
/**
@@ -37,12 +36,6 @@ export interface IProps extends AbstractDialogTabProps, WithTranslation {
*/
classes: any;
- /**
- * The currently selected language to display in the language select
- * dropdown.
- */
- currentLanguage: string;
-
/**
* The display name to display for the local participant.
*/
@@ -63,20 +56,10 @@ export interface IProps extends AbstractDialogTabProps, WithTranslation {
*/
id: string;
- /**
- * All available languages to display in the language select dropdown.
- */
- languages: Array<string>;
-
/**
* If the display name is read only.
*/
readOnlyName: boolean;
-
- /**
- * Whether or not to display the language select dropdown.
- */
- showLanguageSettings: boolean;
}
const styles = (theme: Theme) => {
@@ -135,7 +118,6 @@ class ProfileTab extends AbstractDialogTab<IProps, any> {
this._onAuthToggle = this._onAuthToggle.bind(this);
this._onDisplayNameChange = this._onDisplayNameChange.bind(this);
this._onEmailChange = this._onEmailChange.bind(this);
- this._onLanguageItemSelect = this._onLanguageItemSelect.bind(this);
}
/**
@@ -160,51 +142,6 @@ class ProfileTab extends AbstractDialogTab<IProps, any> {
super._onChange({ email: value });
}
- /**
- * Callback invoked to select a language from select dropdown.
- *
- * @param {Object} e - The key event to handle.
- *
- * @returns {void}
- */
- _onLanguageItemSelect(e: React.ChangeEvent<HTMLSelectElement>) {
- const language = e.target.value;
-
- super._onChange({ currentLanguage: language });
- }
-
- /**
- * Returns the menu item for changing displayed language.
- *
- * @private
- * @returns {ReactElement}
- */
- _renderLanguageSelect() {
- const {
- classes,
- currentLanguage,
- languages,
- t
- } = this.props;
-
- const languageItems
- = languages.map((language: string) => {
- return {
- value: language,
- label: t(`languages:${language}`)
- };
- });
-
- return (
- <Select
- className = { classes.bottomMargin }
- label = { t('settings.language') }
- onChange = { this._onLanguageItemSelect }
- options = { languageItems }
- value = { currentLanguage } />
- );
- }
-
/**
* Implements React's {@link Component#render()}.
*
@@ -220,7 +157,6 @@ class ProfileTab extends AbstractDialogTab<IProps, any> {
hideEmailInSettings,
id,
readOnlyName,
- showLanguageSettings,
t
} = this.props;
@@ -252,7 +188,6 @@ class ProfileTab extends AbstractDialogTab<IProps, any> {
type = 'text'
value = { email } />
</div>}
- {showLanguageSettings && this._renderLanguageSelect()}
{ authEnabled && this._renderAuth() }
</div>
);
diff --git a/react/features/settings/functions.any.ts b/react/features/settings/functions.any.ts
index caf7ddab1b..6ebe162208 100644
--- a/react/features/settings/functions.any.ts
+++ b/react/features/settings/functions.any.ts
@@ -114,17 +114,22 @@ export function getNotificationsMap(stateful: IStateful) {
export function getMoreTabProps(stateful: IStateful) {
const state = toState(stateful);
const stageFilmstripEnabled = isStageFilmstripEnabled(state);
+ const language = i18next.language || DEFAULT_LANGUAGE;
+ const configuredTabs: string[] = interfaceConfig.SETTINGS_SECTIONS || [];
// when self view is controlled by the config we hide the settings
const { disableSelfView, disableSelfViewSettings } = state['features/base/config'];
return {
+ currentLanguage: language,
disableHideSelfView: disableSelfViewSettings || disableSelfView,
hideSelfView: getHideSelfView(state),
iAmVisitor: iAmVisitor(state),
+ languages: LANGUAGES,
+ maxStageParticipants: state['features/base/settings'].maxStageParticipants,
+ showLanguageSettings: configuredTabs.includes('language'),
showPrejoinPage: !state['features/base/settings'].userSelectedSkipPrejoin,
showPrejoinSettings: state['features/base/config'].prejoinConfig?.enabled,
- maxStageParticipants: state['features/base/settings'].maxStageParticipants,
stageFilmstripEnabled
};
}
@@ -195,20 +200,15 @@ export function getProfileTabProps(stateful: IStateful) {
} = state['features/base/conference'];
const { hideEmailInSettings } = state['features/base/config'];
const localParticipant = getLocalParticipant(state);
- const language = i18next.language || DEFAULT_LANGUAGE;
- const configuredTabs: string[] = interfaceConfig.SETTINGS_SECTIONS || [];
return {
authEnabled: Boolean(conference && authEnabled),
authLogin,
- currentLanguage: language,
displayName: localParticipant?.name,
email: localParticipant?.email,
hideEmailInSettings,
id: localParticipant?.id,
- languages: LANGUAGES,
- readOnlyName: isNameReadOnly(state),
- showLanguageSettings: configuredTabs.includes('language')
+ readOnlyName: isNameReadOnly(state)
};
}