# mod\_translate\_deepl

Source: https://zotonic.com/docs/2761/mod_translate_deepl

URI: https://zotonic.com/id/2761

Language: en



Provides automatic text translation through DeepL as a translation service for Zotonic's `mod_translation` module.

Configuration
-------------

Enable `mod_translate_deepl` and set the `mod_translate_deepl.api_key` configuration value to the site's DeepL API key. The integration selects the free API endpoint when the key contains `:fx`; otherwise it uses the paid API endpoint. No separate endpoint setting is needed.

Grant `use.mod_translate_deepl` to the user groups allowed to request translations. The observer checks this permission before contacting DeepL. Translation requests send the supplied texts to the external DeepL service using the site's API key.

Translation service
-------------------

The module handles Zotonic's `translate` notification and delegates the source language, target language, and list of texts to `m_translate_deepl:translate/4`. This integrates with the translation option in the admin's add-language dialog.

Texts are sent with HTML tag handling enabled, and text inside `code` elements is excluded from translation. Omitting the source language requests automatic language detection. Supported language combinations depend on DeepL.

On success the observer returns `{ok, TranslatedTexts}`. If access is denied, the API key is missing, or the request fails, it returns `undefined`, leaving the notification available to other translation providers.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/2761?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/2761?language=en>)
