Skip to content

Commit

Permalink
fix: change crowdin machine translation to google translate
Browse files Browse the repository at this point in the history
  • Loading branch information
mikasackermn committed Nov 2, 2024
1 parent 80e6032 commit 73e9d56
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 73e9d56

Please sign in to comment.