You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know why this happens, but when I try to get the source language of a small snippet of text, it always gives me an innacurate source language code.
To Reproduce
const { Translator } = require('deepl-node');
const apiKey = process.env.DEEPL_API_KEY;
const translator = apiKey ? new Translator(apiKey) : null;
// Assume text === "Paso uno", source language is Spanish ('es')
async function getSourceLanguage(text) {
if (!translator) {
return 'en';
}
try {
const translation = await translator.translateText(text, null, target_lang='EN-GB');
return translation.detectedSourceLang; // Got Italian ('it') as the detected source language
} catch (error) {
console.error('DeepL API error: ', error);
}
}
Expected behavior
The function should return 'es' for the assumed input
Additional context
Library version "^1.14.0"
The text was updated successfully, but these errors were encountered:
I don't know why this happens, but when I try to get the source language of a small snippet of text, it always gives me an innacurate source language code.
To Reproduce
Expected behavior
The function should return
'es'
for the assumed inputAdditional context
Library version
"^1.14.0"
The text was updated successfully, but these errors were encountered: