Skip to content

Param 'glossary_id' should also be accepted instead of just 'glossary' #68

@brunobaudry

Description

@brunobaudry

Current behaviour:
Adding $options['glossary_id']='0000-000etc.' as per the main docs, does not pass the glossary_id as expected.

Expected behaviour:
When I call ->translateText and pass $options, I expect the options to match the API as documented https://developers.deepl.com/api-reference/translate/request-translation#body-target-lang
Hence I should be able to do $options['glossary_id']='0000-000etc.'

I read that that it is in the Github doc, but wouldn't it make sense to work as per main doc ?
I get it that one can also pass a GlossaryInfo but at least be warned by the library that I should use 'glossary' instead.

An easy fix could be to replace in the Translator

$options[TranslateTextOptions::GLOSSARY] ?? null with something like
$options[TranslateTextOptions::GLOSSARY] ?? $options[TranslateTextOptions::GLOSSARY_ID] ?? null

Should I do a PR ?

Cheers

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