Strapi plugin logo for DeepL

DeepL

Integration with the DeepL-API to provide quick automated translation of content fields

thumbnail for DeepL

Meilisearch-Strapi

Strapi v4 - DeepL plugin

Integration with the DeepL-API to provide quick automated translation of content fields.

GitHub package.json version Monthly download on NPM Build

This plugin is still a work in progress

plugin showcase

Requirements

This plugin requires the following, in order to work correctly:

  • Strapi v4 (this plugin is not compatible with v3)
  • The plugin i18n installed and enabled (@strapi/plugin-i18n [npm])
  • The content type to have internationalization enabled (advanced settings in the content type builder)
  • In the internationalization settings at least two locales
  • In the config an apiKey defined (see Configuration)

Unless you have the previous set up, the field on the right where you can translate will not show up. Also it will not show up when editing the currently only available translation of an entry.

Installation

# with npm
$ npm install strapi-plugin-deepl
# or with yarn
$ yarn add strapi-plugin-deepl

After successful installation you have to build a fresh package that includes plugin UI:

# with npm
$ npm run build && npm run develop
# or with yarn
$ yarn build && yarn develop

Configuration

Configuration is currently only possible using the plugin config file config[/env]/plugins.js or environment variables

module.exports = {
  // ...
  deepl: {
    enabled: true,
    config: {
      // your DeepL API key
      apiKey: 'key',
      // whether to use the free or paid api, default true
      freeApi: true,
      // Which field types are translated (default string, text, richtext, components and dynamiczones)
      translatedFieldTypes: [
        'string',
        'text',
        'richtext',
        'component',
        'dynamiczone',
      ],
      // If relations should be translated (default true)
      translateRelations: true,
      // You can define a custom glossary to be used here (see https://www.deepl.com/docs-api/managing-glossaries/)
      glossaryId: 'customGlossary',
    },
  },
  // ...
}

or using the default environment variables:

  • DEEPL_API_KEY - default null
  • DEEPL_API_FREE - default true

To get an API key, register for free at www.deepl.com/pro#developer.

Features

  • Fill in and translate any locale from another already defined locale
  • Translation is restricted by permissions to avoid misuse of api quota
  • Configure which field types are translated
    • standard text fields and nested components by default
    • uid fields are not translated by default because they might not result in the same translation as the attached field\ -> saving is prevented in the conent manager anyway until you change the slug again
  • Fields that are marked as not translated in the content-type settings will not be translated
  • Translation of relations by the followig schema:\ (The related objects are not translated directly, only the relation itself is translated)
    • the related content type is localized:
      • if a localization of the relation with the targetLocale exists\ -> it is used
      • else the relation is removed
    • the related content type is not localized:
      • the relation goes both ways and would be removed from another object or localization if it was used (the case with oneToOne or oneToMany)\ -> it is removed
      • otherwise the relation is kept

(Current) Limitations:

  • Only the deepl supported languages can be translated
  • The translation of Markdown using DeepL works relatively well but is not perfect. Watch out especially if you have links in Markdown that could be changed by translation
  • HTML in richtext created using a different WYSIWYG editor is not supported
  • Only super admins can translate. This is currently the case, since permissions were added to the translate endpoint. Probably you can change the permissions with an enterprise subscription but I am not sure. If you know how to do that also in the community edition please tell me or open a merge request!
  • Relations that do not have a translation of the desired locale will not be translated. To keep the relation you will need to translate both in succession (Behaviour for multi-relations has not yet been analyzed)
  • The API-Limits of DeepL (size and number of fields) should not be an issue, however if you have a very large entity you might be sending too many requests. Also if one field is larger than the reqest size limit, the content needs to be split and merged at some character, which may break the content layout!

Legal Disclaimer

Feki.de e.V. do not hold the copyright to the Logos of Strapi Inc. or DeepL SE. There is no cooperation or any other sort of affiliation between Feki.de e.V. and Strapi Inc. or DeepL SE. The Logos are used under fair use in order to not confuse Users as to what this plugin does.

Install now

npm install strapi-plugin-deepl

Last updated

18 days ago

Strapi Version

4.0 and above

Author

github profile image for Felix Haase
Felix Haase

Useful links

Create your own plugin

Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.