manishkatyan / strapi-google-translator

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

Error unexpected token u in JSON at Position 0 #18

Closed pcc01 closed 1 year ago

pcc01 commented 1 year ago

I suspect this error is a newbie error, but please let me know what I'm doing wrong.

I have created an API Key within strapi and used used the API key from strapi in the
STRAPI_GOOGLE_TRANSLATE_API_TOKEN= location and added the google translate services api key as one line after GOOGLE_TRANSLATE_JSON=
Translator was successfully added to the UI but it does not appear on the collection when I try and translate I get an error as shown in the first image image Strapi_translate issue . I note that localization appears in the fields but not in the content types. Any suggestions?

Collection Field_in_collection
nishekh-e-r commented 1 year ago

Hi, @pcc01. After adding env did You follow the below step?

After adding environment variables .env files, go to 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"),
    },
  },
});