manishkatyan / strapi-google-translator

Translate Strapi collections into multiple languages using Google Cloud Translation
10 stars 8 forks source link
stripe payment title

Strapi Translator

Easily translate your Strapi content into 100+ languages.

With one-click, this free plugin translates your Strapi collections into 100+ languages using Google Cloud Translate. It supports multiple translation strategies including Text, HTML, String and Skip. In addition, you can specify Glossaries, such as brand name, that should not get translated.


GitHub package.json version Monthly download on NPM synk


Translator-gif



Google Cloud Translate

Google Cloud Translate makes your content multilingual with fast, dynamic machine translation.

Why should you bother translating your content? Well, there are several reasons for you to translate your content:

  1. Reach global markets through internationalization of your products
  2. Engage your audience with compelling localization of your content
  3. Deliver seamless user experience with real-time translation

Google Cloud Translate Benefits

Strapi is the leading open-source headless Content Management System. It’s 100% JavaScript, fully customizable and developer-first.

Overview: Easily translate your content

Translator plugin enables you to translate your Strapi content into 100+ languages.

Setting up the plugin is super easy and can be completed within 10 minutes.

  1. Enter your enviornment variables in .env file.
  2. Add the list of languages, that you want to translate into, in Strapi Settings.
  3. Enable localization for the content type that you want to translate.
  4. Go to Content Manager, select the collection type that you want to translate, select the languages and click on translate.



✨ Features

  1. Quick installation and setup.
  2. Easily translate your content to 100+ languages.
  3. Confugurable translation strategy schema for each field of a given content type.

Translation Strategies

Following are the supported translation strategies:

  1. String: translated as simple string, Glossary should work
  2. Text: translated as simple string, Glossary should work
  3. HTML: should be transformed to html first, translated and then converted back to markdown. Glossary should work.
  4. Skip: should be skipped for translation, but still moved as is; It could be used for field types such as image and file



🖐 Requirements

The requirements to install the Translator plugin is the same as those to install Strapi.

Please refer to the official Strapi installation requirement doc here: Installation Requirements.

Minimum environment requirements

We are following the official Node.js releases timelines.

Supported Strapi versions:

The Translator plugin is designed for Strapi v4.x. It won't work with Strapi v3.x.



⏳ Installation

Use npm to install this plugin within your Strapi project.

Refer to this doc to install npm

npm i strapi

After successful installation please add the below enviornment variables in .env files

STRAPI_BACKEND_URL=http://localhost:1337
STRAPI_GOOGLE_TRANSLATE_API_TOKEN=your strapi api token
GOOGLE_TRANSLATE_JSON={"type":"service_account","project_id":"your project_id","private_key_id":"your private key id","private_key":"-----BEGIN PRIVATE KEY-----\your private key\n-----END PRIVATE KEY-----\n","client_email": "your client email","client_id": "your client id","auth_uri": "your auth uri","token_uri": "your token uri","auth_provider_x509_cert_url": "your provider secret","client_x509_cert_url": "your client"}

Please make sure to add your Google Service Account JSON in a single sentence as shown above.

Also to create Strapi api token, Go to Settingd > API Tokens > Create new Api Tokens > Enter API name, Select Token duration Unlimited , Select Token type Full Access > Save > Copy the API Token and Add in your .env file.

After adding enviornment variables .env files, goto Config > plugins.js > Add the following code snippet.

module.exports = ({ env }) => ({

  "strapi-google-translator": {
    enabled: true,
    config: {
      backendUrl: env("STRAPI_BACKEND_URL"),
      apiToken: env("STRAPI_GOOGLE_TRANSLATE_API_TOKEN"),
      googleJson: env("GOOGLE_TRANSLATE_JSON"),
    },
  },
});

Afterwards, you would need to build a fresh package that includes the Translator plugin. For it, please execute the commands below:

# with npm (option 1)
$ npm run build
$ npm run develop

# with npx (option 2)
$ npx strapi  build
$ npx strapi  develop

The Translator plugin should appear in the Plugins section of the Strapi sidebar after you run the app again.



🔧 Configuration

You can easily configure the Stripe Translator plugin.


📝 License

MIT License

Copyright © 2021 AsyncWeb Technology