51eeb092b3
Move the language collection to the HTML settings file. This data defines the available languages available for the speech API. These language tags are used to filter SpeechSynthesis' API `getVoices` result. Tags must use BCP 47 format. https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisVoice/lang
23 lines
769 B
JavaScript
23 lines
769 B
JavaScript
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 = Meteor.settings.public.app.audioCaptions.language.available;
|
|
|
|
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}`);
|
|
}
|
|
}
|