npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@shawnvogt/strapi-plugin-google-translate

v1.1.6

Published

Strapi plugin for automated translation of content using Google Cloud Translation

Downloads

15

Readme

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