Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

Commit

Permalink
Lint autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
markstur committed Sep 20, 2022
1 parent 7e8422a commit 770e4e4
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,24 +133,23 @@ if (languageTranslator) {
console.log('error: ', err);
});
} else if (altLanguageTranslator) {
let getLanguagesUrl = altLTUrl + '/get-languages'
console.log('GET MODELS FROM: ', getLanguagesUrl);
const getLanguagesUrl = `${altLTUrl}/get-languages`;
console.log('GET MODELS FROM: ', getLanguagesUrl);

axios.get(getLanguagesUrl)
.then(function (response) {
console.log('GET LANGUAGES RESPONSE: ', response.data);
let langs = new Set()
axios.get(getLanguagesUrl).then(function(response) {
console.log('GET LANGUAGES RESPONSE: ', response.data);
let langs = new Set();
for (const l in response.data) { // eslint-disable-line
console.log('LANG: ', response.data[l]);
langs.add(response.data[l].code_alpha_1) // collect list of langs
}
langs = Array.from(langs)
console.log('LANG: ', response.data[l]);
langs.add(response.data[l].code_alpha_1); // collect list of langs
}
langs = Array.from(langs);
for (const l in response.data) { // eslint-disable-line
modelMap[response.data[l].code_alpha_1] = langs // anything-to-anything
altLangs[response.data[l].code_alpha_1] = response.data[l].codeName;
}
console.log("MODEL MAP: ", modelMap);
});
modelMap[response.data[l].code_alpha_1] = langs; // anything-to-anything
altLangs[response.data[l].code_alpha_1] = response.data[l].codeName;
}
console.log('MODEL MAP: ', modelMap);
});
}

// Get supported source language for Speech to Text
Expand Down Expand Up @@ -242,7 +241,7 @@ app.get('/api/v1/translate', async (req, res) => {
const body = ltParams;
const response = await axios({
method: 'post',
url: altLTUrl + '/translate',
url: `${altLTUrl}/translate`,
data: body,
headers: { accept: 'application/json', 'content-type': 'application/json' }
});
Expand Down Expand Up @@ -305,19 +304,17 @@ app.get('/api/v1/synthesize', async (req, res, next) => {
// Return the models, voices, and supported translations.
app.get('/api/v1/voices', async (req, res, next) => {
try {

// Add languages w/o voices (specifically for alternate translators)
for (const i in altLangs) { // eslint-disable-line
if (voices.filter(voice => i === voice.language.substring(0,2)).length < 1) {
// if this alt lang is not in voices, add a voice-less entry.
voices.push(
{
name: i,
description: altLangs[i] + " translation without voice.",
language: i,
url: '' // NO TTS URL!
})
}
if (voices.filter(voice => i === voice.language.substring(0, 2)).length < 1) {
// if this alt lang is not in voices, add a voice-less entry.
voices.push({
name: i,
description: `${altLangs[i]} translation without voice.`,
language: i,
url: '' // NO TTS URL!
});
}
}

res.json({
Expand Down

0 comments on commit 770e4e4

Please sign in to comment.