diff --git a/config/datocms/migrations/1706200000_init.ts b/config/datocms/migrations/1706200000_init.ts index 22319c1e..972d0056 100644 --- a/config/datocms/migrations/1706200000_init.ts +++ b/config/datocms/migrations/1706200000_init.ts @@ -16,4 +16,18 @@ export default async function (client: Client) { await client.plugins.create({ package_name: 'datocms-plugin-oembed', }); + + console.log('Install plugin "Translate"'); + const translatePlugin = await client.plugins.create({ + package_name: 'datocms-plugin-translate-fields', + }); + if (process.env.DEEPL_API_KEY) { + await client.plugins.update(translatePlugin.id, { + parameters: { + autoApply: true, + deeplApiKey: process.env.DEEPL_API_KEY, + translationService: { label: 'DeepL API Pro', value: 'deepl' } + }, + }); + } } diff --git a/docs/cms-translation-plugin-setup.md b/docs/cms-translation-plugin-setup.md deleted file mode 100644 index d1a1930a..00000000 --- a/docs/cms-translation-plugin-setup.md +++ /dev/null @@ -1,20 +0,0 @@ -# CMS translation plugin setup - -## Add plugin to DatoCMS project - -- Go to the DatoCMS project. -- Go to configuration > Plugins. -- Click the `Add a new plugin` button on the bottom of the panel. -- Click `From Marketplace`. -- Search for `datocms-plugin-translate-fields`. -- Open it and click `Install plugin!`. - -## Apply to fields - -- Turn on `Auto apply to fields`. - -## Add a translation service - -- Choose a translation service. -- Add the API key. -- (optional) Fill in additional fields. diff --git a/docs/getting-started.md b/docs/getting-started.md index 6eed7e17..51b7d345 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -41,6 +41,13 @@ DATOCMS_READONLY_API_TOKEN=copy-read-only-token DATOCMS_API_TOKEN=copy-full-access-token ``` +- (optional) If you have a DeepL API key, you can add it to your `.env` file as well. + +```dotenv +# .env +DEEPL_API_KEY=copy-deepl-api-key +``` + - Add all models and settings in to your new CMS by running our [migrations](../config/datocms/migrations/) in a new [environment](https://www.datocms.com/docs/scripting-migrations/introduction) called `start` using the DatoCMS CLI: `npx datocms migrations:run --destination=start --fast-fork`. - Promote the new `start` environment to primary environment: `npx datocms environments:promote start` Alternatively you can go to Project Settings > Environments (`/project_settings/environments`) and 'Promote' the `start` environment to primary. - In your CMS, you can now safely remove the original environment via Project Settings > Environments (`/project_settings/environments`).