Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeepL: Allow formality option to be configured through config. #477

Merged

Conversation

kalleth
Copy link
Contributor

@kalleth kalleth commented Oct 13, 2022

DeepL has the concept of `formality for certain languages (https://www.deepl.com/docs-api/translate-text/translate-text/).

e.g:

  • English: How much time can you commit to playing?
  • German, formal: Wie viel Zeit können Sie zum Spielen aufwenden?
  • German, informal: Wie viel Zeit kannst du zum Spielen aufwenden?

However, the DeepL gem does not allow this to be configured globally, only on a per-call basis to the DeepL.translate call. I looked, but couldn't find a way to alter this in config.

By adding a deepl_options: key to the configuration, we allow some of these keys to be overridden (although keeping extra_options first in the merge chain means that explicitly set ignore_tags remains forced).

Had a look at the spec for the DeeplTranslator but couldn't see an easy way to assert this - feel free to let me know where I should add the spec!

DeepL allows formality to be optionally more or less formal for certain
languages
(https://www.deepl.com/docs-api/translate-text/translate-text/).
However, the DeepL gem does not allow this to be configured globally,
only on a per-call basis to the `DeepL.translate` call.

By adding a `deepl_options:` key to the configuration, we allow some of
these keys to be overridden.
@glebm glebm merged commit 84f6b71 into glebm:main Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants