bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/methods/setSpeechLocale.js

27 lines
746 B
JavaScript
Raw Normal View History

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';
const LANGUAGES = [
'en-US',
'es-ES',
'pt-BR',
];
export default function setSpeechLocale(locale) {
try {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
check(meetingId, String);
check(requesterUserId, String);
check(locale, String);
if (LANGUAGES.includes(locale) || locale === '') {
updateSpeechLocale(meetingId, requesterUserId, locale);
}
} catch (err) {
Logger.error(`Exception while invoking method setSpeechLocale ${err.stack}`);
}
}