Skip to content

Array of sentences are not translated correctly. #63

@tomasz-kusy

Description

@tomasz-kusy

I have a strange problem. I haven't used the API for a few months, and suddenly I find that it doesn't work properly to translate more than one sentence at a time, that is, when the first argument of translateText() is an array.

Well, for example, I pass a table of 10 sentences and in the response “glued” translations.

I've enabled client debugging and I don't know what to think about it.

$translations = $this->deepl->translateText(
            [
                "This is the first sentence.",
                "This is the second sentence.",
                "This is the third sentence."
            ],
            'en',
            'DE',
            [
                'tag_handling' => 'xml',
                'ignore_tags' => ['mrk']
            ]
        );

Result:

array:1 [
  0 => DeepL\TextResult^ {#1429
    +text: "This is the first sentence.,This is the second sentence.,This is the third sentence."
    +detectedSourceLang: "en"
    +billedCharacters: 84
    +modelTypeUsed: null
  }
]

Logs:

[19-Mar-2025 21:55:13 Europe/Warsaw] [2025-03-19 21:55:13] medfile.INFO: Request to DeepL API POST https://api-free.deepl.com/v2/translate [] []
[19-Mar-2025 21:55:13 Europe/Warsaw] [2025-03-19 21:55:13] medfile.DEBUG: Request details: {"target_lang":"de","source_lang":"en","show_billed_characters":"1","text":["This is the first sentence.","This is the second sentence.","This is the third sentence."],"tag_handling":"xml","ignore_tags":"mrk"} [] []
[19-Mar-2025 21:55:13 Europe/Warsaw] [2025-03-19 21:55:13] medfile.INFO: DeepL API response POST https://api-free.deepl.com/v2/translate 200 [] []
[19-Mar-2025 21:55:13 Europe/Warsaw] [2025-03-19 21:55:13] medfile.DEBUG: Response details: {"translations":[{"detected_source_language":"EN","text":"Dies ist der erste Satz,,Dies ist der zweite Satz,,Dies ist der dritte Satz.","billed_characters":84}]} [] []

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