Skip to content

weescoelho/strapi-provider-translate-googleapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloud Translate API provider for Strapi Translate Plugin

💻 Prerequisites

Before you begin, make sure you've met the following requirements:

  • Strapi 4 (last tested version: 4.24.2)
  • Install plugin Strapi Plugin Translate
  • Enable Cloud Translation API on Google Cloud Console. (API & Services)
  • Generate Google service account

🚀 Installation

npm install strapi-provider-translate-googleapi

or:

yarn add strapi-provider-translate-googleapi

☕ Configuration

  • Set env variables on Strapi .env
STRAPI_GOOGLE_PROJECT_ID=
STRAPI_GOOGLE_PRIVATE_KEY_ID=
STRAPI_GOOGLE_PRIVATE_KEY=
STRAPI_GOOGLE_CLIENT_EMAIL=
STRAPI_GOOGLE_CLIENT_ID=
STRAPI_GOOGLE_CLIENT_X509_CERT_URL=,

Javascript:

  • Path: config/plugins.[t|j]s
module.exports = {
  //...
  translate: {
    enabled: true,
    config: {
      provider: "google",
      providerOptions: {
        project_id: env("STRAPI_GOOGLE_PROJECT_ID"),
        private_key_id: env("STRAPI_GOOGLE_PRIVATE_KEY_ID"),
        private_key: env("STRAPI_GOOGLE_PRIVATE_KEY"),
        client_email: env("STRAPI_GOOGLE_CLIENT_EMAIL"),
        client_id: env("STRAPI_GOOGLE_CLIENT_ID"),
        client_x509_cert_url: env("STRAPI_GOOGLE_CLIENT_X509_CERT_URL"),
        apiOptions: {
          //Cloud Translate API options ...
        },
      },
      translatedFieldTypes: [
        "string",
        { type: "text", format: "plain" },
        // Change format to markdown if default richtext field on Strapi
        { type: "richtext", format: "html" },
        "component",
        "dynamiczone",
      ],
      translateRelations: true,
    },
  },
  //...
};
  • Run commands
 npm run build && npm run develop

📝 Licença

This project is under license. See the LICENSE file for more details.

About

Cloud Translate API Google integration for Strapi 4

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published