janvarev / OneRingTranslator

Simple local REST web service to translate texts. Plugins. Automatic calculate BLEU/COMET metrics of translation quality.
MIT License
110 stars 12 forks source link

Translated text keep new lines <br>? #9

Closed Jeffrey-Lang closed 9 months ago

Jeffrey-Lang commented 9 months ago

Hey,

Is there a way to keep new lines /
in the translated text?

Or did i miss something?

janvarev commented 9 months ago

Keeping new lines depends on translator engine. As I know, Google Translate usually keeps them, but Deepl not. That's not an responsibility of core engine for now.

Jeffrey-Lang commented 9 months ago

@janvarev Thanks for the reply, as i was testing it i found out that if you use the offline translator we can replace newlines with <br>'s and that will keep the text nice with the offline engine!.

So for anyone who is facing this issue just regex new lines and replace them with
then if you do not want <br> but new lines reverse the regex the translator will keep the<br>.