【发布时间】:2021-02-17 13:27:38
【问题描述】:
const sentenc = this.colocation[0][i].examples;
sentenc.forEach((item,index) => {
var colAction = this.colocation[0][i].examples[index];
const strippedString = colAction.replace(/(<([^>]+)>)/gi, "");
this.examplesEN.push(strippedString)
axios.get('https://www.googleapis.com/language/translate/v2?key={apikey}='+strippedString+'&source=en&target=tr')
.then((response) =>{
const exTranslet = response.data.data.translations[0].translatedText;
this.examplesTR.push(exTranslet);
})
})
我正在使用 2 个不同的 API 构建翻译器。当我将英语托管推向阵列时,不能将土耳其托管推向另一个阵列以相同的索引号。我该如何解决?
【问题讨论】: