Skip to content

Commit

Permalink
feat(dynamic-branding) support setting transcription language
Browse files Browse the repository at this point in the history
It will be used as the default if specified.
  • Loading branch information
saghul committed Dec 9, 2024
1 parent f85d0e6 commit b418b95
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion react/features/base/conference/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ export function getConferenceOptions(stateful: IStateful) {

const config = state['features/base/config'];
const { locationURL } = state['features/base/connection'];
const { defaultTranscriptionLanguage } = state['features/dynamic-branding'];
const { tenant } = state['features/base/jwt'];
const { email, name: nick } = getLocalParticipant(state) ?? {};
const options: any = { ...config };
Expand All @@ -229,7 +230,8 @@ export function getConferenceOptions(stateful: IStateful) {
}

options.applicationName = getName();
options.transcriptionLanguage = determineTranscriptionLanguage(options);
options.transcriptionLanguage
= defaultTranscriptionLanguage ?? determineTranscriptionLanguage(options);

// Disable analytics, if requested.
if (options.disableThirdPartyRequests) {
Expand Down
13 changes: 13 additions & 0 deletions react/features/base/i18n/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { SET_DYNAMIC_BRANDING_DATA } from '../../dynamic-branding/actionTypes';
import { getConferenceState } from '../conference/functions';
import MiddlewareRegistry from '../redux/MiddlewareRegistry';

import { I18NEXT_INITIALIZED, LANGUAGE_CHANGED } from './actionTypes';
Expand Down Expand Up @@ -28,6 +29,18 @@ MiddlewareRegistry.register(store => next => action => {
logger.log('Error setting dynamic language bundle', err);
});
}

// Update transcription language, if applicable.
if (action.type === SET_DYNAMIC_BRANDING_DATA) {
const { defaultTranscriptionLanguage } = action.value;

if (typeof defaultTranscriptionLanguage !== 'undefined') {
const { conference } = getConferenceState(store.getState());

conference?.setTranscriptionLanguage(defaultTranscriptionLanguage);
}
}

break;
}
}
Expand Down
1 change: 1 addition & 0 deletions react/features/dynamic-branding/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export interface IDynamicBrandingState {
customizationFailed: boolean;
customizationReady: boolean;
defaultBranding: boolean;
defaultTranscriptionLanguage?: boolean;
didPageUrl: string;
inviteDomain: string;
labels: Object | null;
Expand Down

0 comments on commit b418b95

Please sign in to comment.