/translate

Primary LanguageJavaScript

Translation extension

https://www.contentful.com is a content management platform for web applications, mobile apps and connected devices. It allows you to create, edit & manage content in the cloud and publish it anywhere via powerful API. Contentful offers tools for managing editorial teams and enabling cooperation between organizations.

translate-widget

This extension translates text from the default locale to other locales in a space using the Yandex translation API.

Installation and usage

Check you have the requirements needed to use our extensions.

Install the dependencies

npm install

Create the extension:

contentful extension create --space-id <yourSpaceId>

Serve on http://localhost:3000:

npm start

You can provide a value for the PORT environment variable to start the server on a custom port. If you do, remember to update the src property in extension.json.

export PORT=<custom-port>
npm start

Your extension will now be accessible in the Contentful web app. To use the extension, create a content type with a field of type 'Symbol' or 'Text'. You will need to enable localization on the field to use the translation feature.

The same constraints apply to loading unsafe scripts.

Upload extension

If you want to inline all dependencies and upload the extension to Contentful, run the following command:

contentful extension create --srcdoc ./dist/index.all.html --space-id <space-id> --force

And to update the extension:

contentful extension update --srcdoc ./dist/index.all.html --space-id <space-id> --force