Skip to content

Commit

Permalink
Merge pull request #920 from rango-exchange/chore/rf-1864-change-tran…
Browse files Browse the repository at this point in the history
…slation-machine

fix: change crowdin machine translation to google translate
  • Loading branch information
nikaaru authored Nov 3, 2024
2 parents 1d4be4d + 73e9d56 commit 2cadeb1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/crowdin/pretranslate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ import {
} from "./constants.mjs";


export const getMachineTranslationEngineID = async () =>{
export const getMachineTranslationEngineID = async () => {
const responseData = await fetchDataWithAuthorization(MACHINE_TRANSLATE_API);
if(!responseData.data || !responseData.data.length){

if (!responseData.data || !responseData.data.length) {
throw new CrowdinError('No data received for machine translation');
}
return responseData.data[0].data.id;
const data = responseData.data;
const googleMachine = data.find(item => item.data.type === 'google');
return googleMachine ? googleMachine.data.id : data[0].data.id;
}

export const getLanguageIds = async () => {
Expand Down

0 comments on commit 2cadeb1

Please sign in to comment.