Skip to content

Auto translate on Strapi #512

@ngoctuan776

Description

@ngoctuan776

I'm using Strapi for a project on which I need to implement an auto-translate functionnality on some Collection.

To do so I install the strapi-plugin-translate and I follow the process as indicated using the provider strapi-provider-translate-deepl. Next I create a free account on deepl website to get an API key enter image description here

However when I go to the collection and I choose translate from another local. The text is just copy from this local but not translate.

I check that the checkbox field "Enable localization for this field" is check and that the field "Configure automated translation for this field?" is at "Translate".

What trigger me as something wrong is that the API call is made to the endpoint "localhost:1337/translate/translate" when I click the "Translate from another locale" button.

Here is a copy of my config/plugin.js file (I replace each API key letter by a X):

module.exports = ({ env }) => ({
translate: {
enabled: true,
config: {
// Add the name of your provider here (for example 'deepl' for or the full package name)
provider: 'deepl',
providerOptions: {
// your API key - required and wil cause errors if not provided
apiKey: 'XXXXXXXX-XXX-XXXX-XXXX-XXXXXXXXXXXX:fx',
// use custom api url - optional
apiUrl: 'https://api-free.deepl.com',
// use custom locale mapping (for example 'en' locale is deprecated so need to choose between 'EN-GB' and 'EN-US')
localeMap: {
// use uppercase here!
EN: 'EN-US',
},
},
apiOptions: {
// see https://github.com/DeepLcom/deepl-node#text-translation-options for supported options.
// note that tagHandling Mode cannot be set this way.
// use with caution, as non-default values may break translation of markdown
formality: 'default',
// ...
},
// 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,
}
},
// enable a custom plugin
'drag-drop-content-types': {
// my-plugin is going to be the internal name used for this plugin
enabled: true
}
});

"@strapi/strapi": "^4.25.15",
"strapi-plugin-translate": "^1.3.2",
"strapi-provider-translate-deepl": "^1.2.3"

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