Skip to content

Upgrade instructions

Yannick Lang edited this page Mar 27, 2023 · 2 revisions

Some version changes might require changes to the config.

Upgrading from strapi-plugin-deepl to strapi-plugin-translate

First you need to remove the old plugin and install the new plugin including the provider:

# Using yarn
yarn remove strapi-plugin-deepl & yarn add strapi-plugin-translate strapi-provider-translate-deepl
# Or using npm
npm uninstall strapi-plugin-deepl & npm add strapi-plugin-translate strapi-provider-translate-deepl

The config currently should look like this:

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',
    },
  },
  // ...
}

You need to add the provider deepl and move all options regarding the deepl api to the property providerOptions:

module.exports = {
  // ...
  translate: {
    enabled: true,
    config: {
      // Add the name of your provider here (for example 'deepl' for strapi-provider-translate-deepl or the full package name)
      provider: 'deepl',
      providerOptions: {
        // your API key - required and wil cause errors if not provided
        apiKey: 'key',
        // use custom api url - optional
        apiUrl: 'https://api-free.deepl.com',
      },
      // Which field types are translated (default string, text, richtext, components and dynamiczones)
      // Either string or object with type and format
      // Possible formats: plain, markdown, html (default plain)
      translatedFieldTypes: [
        'string',
        { type: 'text', format: 'plain' },
        { type: 'richtext', format: 'markdown' },
        'component',
        'dynamiczone',
      ],
      // If relations should be translated (default true)
      translateRelations: true,
    },
  },
  // ...
}

If you use html for the richtext fields for example by using a custom richtext editor, you should also change the format of the richtext field to html under translatedFieldTypes

Clone this wiki locally