1.1.6 • Published 2 years ago

@shawnvogt/strapi-plugin-google-translate v1.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

This plugin is still a work in progress

Requirements

This plugin requires the following, in order to work correctly:

  • Strapi v4 (this plugin is not compatible with v3)
  • The plugin i18n installed and enabled (@strapi/plugin-i18n [npm])
  • The content type to have internationalization enabled (advanced settings in the content type builder)
  • In the internationalization settings at least two locales
  • In the config an apiKey defined (see Configuration)

Unless you have the previous set up, the field on the right where you can translate will not show up. Also it will not show up when editing the currently only available translation of an entry.

Installation

# with npm
$ npm install @shawnvogt/strapi-plugin-google-translate
# or with yarn
$ yarn add @shawnvogt/strapi-plugin-google-translate

After successful installation you have to build a fresh package that includes plugin UI:

# with npm
$ npm run build && npm run develop
# or with yarn
$ yarn build && yarn develop

Configuration

Configuration is currently only possible using the plugin config file config[/env]/plugins.js or environment variables

module.exports = {
  // ...
  deepl: {
    enabled: true,
    config: {
      // your Google Cloud Translation API key
      apiKey: 'key',
      // Which field types are translated (default string, text, richtext, components and dynamiczones)
      translatedFieldTypes: [
        'string',
        'text',
        'richtext',
        'component',
        'dynamiczone',
      ],
      // If relations should be translated (default true)
      translateRelations: true,
    },
  },
  // ...
}

or using the default environment variables:

  • GOOGLE_TRANSLATE_KEY - default null

Features

  • Fill in and translate any locale from another already defined locale
  • Translation is restricted by permissions to avoid misuse of api quota
  • Configure which field types are translated
    • standard text fields and nested components by default
    • uid fields are not translated by default because they might not result in the same translation as the attached field\ -> saving is prevented in the conent manager anyway until you change the slug again
  • Fields that are marked as not translated in the content-type settings will not be translated
  • Translation of relations by the followig schema:\ (The related objects are not translated directly, only the relation itself is translated)
    • the related content type is localized:
      • if a localization of the relation with the targetLocale exists\ -> it is used
      • else the relation is removed
    • the related content type is not localized:
      • the relation goes both ways and would be removed from another object or localization if it was used (the case with oneToOne or oneToMany)\ -> it is removed
      • otherwise the relation is kept

(Current) Limitations:

  • Only the google translate supported languages can be translated
  • Currently supports the basic google cloud translate api
  • Only super admins can translate. This is currently the case, since permissions were added to the translate endpoint. Probably you can change the permissions with an enterprise subscription but I am not sure. If you know how to do that also in the community edition please tell me or open a merge request!
  • Relations that do not have a translation of the desired locale will not be translated. To keep the relation you will need to translate both in succession (Behaviour for multi-relations has not yet been analyzed) a
1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago