Skip to content

Text translation option "preserveFormatting" not working if no source lang is provided (auto-detect) #77

@JeremieHFR

Description

@JeremieHFR

Describe the bug
When setting the option "preserveFormatting" to true in the deeplClient.translateText method, if the sourceLang is provided it works as expected, but if the source lang is null (auto detect), then the option is ignored and the formatting is not preserved.

To Reproduce
Here is some text you can try :

Ich konnte die Migrationsvorhaben abklären
Terminmigration
Siehe Anhang

Medikations Migration
Muss ich vertrösten, da Experte abwesend bis 15.02.

Migration Allergien
Lieferung in CSV Format
• Pat. Nr.
• Fall Nr.
• Text als Allergie.
Allergien erscheinen als String Freitext im CAVE Formular

Try to call the translateText with preserveFormatting to true, and sourceLang to 'de'.
Everything is working as expected :

I was able to clarify the migration plans
Date migration
See attachment

Medication migration
I have to postpone, as expert is absent until 15.02.

Migration allergies
Delivery in CSV format
- Patient no.
- Case no.
- Text as allergy.
Allergies appear as string free text in the CAVE form

Then set the sourceLang to null, preserveFormatting is not respected anymore :

I was able to clarify the migration plans. Appointment migration See appendix Medication migration I have to postpone this, as the expert is away until February 15. Migration of allergies Delivery in CSV format • Patient no. • Case no. • Text as allergy. Allergies appear as free text strings in the CAVE form.

Expected behavior
It should preserve the formatting even if the source lang is null.

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome
  • Version: 1.24.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions