Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda