2022-04-14 21:59:54 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import updateSpeechLocale from '../modifiers/updateSpeechLocale';
|
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
|
|
|
|
2022-04-28 22:06:19 +08:00
|
|
|
const LANGUAGES = Meteor.settings.public.app.audioCaptions.language.available;
|
2022-04-14 21:59:54 +08:00
|
|
|
|
2023-03-15 21:18:31 +08:00
|
|
|
export default async function setSpeechLocale(locale) {
|
2022-04-14 21:59:54 +08:00
|
|
|
try {
|
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
|
|
|
|
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
|
|
|
check(locale, String);
|
|
|
|
|
|
|
|
if (LANGUAGES.includes(locale) || locale === '') {
|
2023-03-15 21:18:31 +08:00
|
|
|
await updateSpeechLocale(meetingId, requesterUserId, locale);
|
2022-04-14 21:59:54 +08:00
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Exception while invoking method setSpeechLocale ${err.stack}`);
|
|
|
|
}
|
|
|
|
}
|