Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

145
Visualizações
Issues with DeepL Api not translating past new line in Axios

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;">&nbsp;</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.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I am not sure what environment you are using, but if you are using Node.js the official DeepL Node.js client library may help simplify your work.

However, if you need to use Axios directly, regarding your example: I believe the problem is with your query. The text parameter is not URL-encoded, so the &nbsp part is interpreted as a new argument rather than a continuation of the text argument. You should URL-encode the text argument before inserting it into the query.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda