This may not be the correct forum to ask this question, but perhaps some have experience with implementing the DeepL API.
I make a Get request via Axios for a sample letter, containing paragraphs, however while the variable that is passed in contains the correct input, anything past a newline is not returned. I have adjusted the paramters for HTML tag handling, but this makes no difference. Any ideas?
It seems clear that the HTML tags are the issue here (it skips everything between the final paragraph tags.
const text = <p style="margin-left:0px;">Cher Julia,</p><p style="margin-left:0px;"> </p><p style="margin-left:0px;">J’ai le plaisir d’écrire cette lettre pour te décrire la ville où je suis allée pour mes vacances. Je pense que tout va bien à New York. Et tes parents, je pense qu’ils se portent bien.</p>
Returned Output:
<p style="margin-left:0px;">Cher Julia,</p><p style="margin-left:0px;">
Get Request:
returnTranslation(text, source_lang) {
axios.get(`https://api.deepl.com/v2/translate?auth_key=xxxxxxx&text=${text}&target_lang=${source_lang}&tag_handling=html`)
.then((response) => {
console.log(text, response.data)
const translated_text = response.data.translations[0].text;
return translated_text;
}).then((translated_text) => {
this.insertTranslation(translated_text)
})
}
PS: The tags are a byproduct of pulling comment info from a Zendesk client, when I re-insert this translation they are no longer present/an issue.