strapi-provider-translate-googleapi
v1.0.0
Published
Cloud Translate API Google integration for Strapi 4
Downloads
18
Maintainers
Readme
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.