manishkatyan / strapi-google-translator

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

[Does Not Work V4.5.3] Unable to get response from google cloud translation : replaceString.replace is not a function #12

Closed z0lo13 closed 1 year ago

z0lo13 commented 1 year ago

Cannot Make it work. The following error when clicking translate:

image

TypeError: replaceString.replace is not a function
    at Object.preProcessGlossary (~/node_modules/strapi-google-translator/server/services/translationServiceGoogle.js:206:39)
    at Object.translateText (~/node_modules/strapi-google-translator/server/services/translationServiceGoogle.js:171:31)
    at Object.getTranslationStrategy (~/node_modules/strapi-google-translator/server/services/translationServiceGoogle.js:140:25)
    at Object.doTranslation (~/node_modules/strapi-google-translator/server/services/translationServiceGoogle.js:46:35)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.doTranslation (~/node_modules/strapi-google-translator/server/services/translateService.js:131:28)
    at async Object.translate (~/node_modules/strapi-google-translator/server/services/translateService.js:42:34)
    at async Object.translate (~/node_modules/strapi-google-translator/server/controllers/translateController.js:19:24)
    at async returnBodyMiddleware (~/node_modules/@strapi/strapi/lib/services/server/compose-endpoint.js:52:18)
    at async policiesMiddleware (~/node_modules/@strapi/strapi/lib/services/server/policy.js:24:5)
    at async ~/node_modules/@strapi/strapi/lib/middlewares/body.js:58:9
    at async ~/node_modules/@strapi/strapi/lib/middlewares/logger.js:25:5
    at async ~/node_modules/@strapi/strapi/lib/middlewares/powered-by.js:16:5
    at async cors (~/node_modules/@koa/cors/index.js:107:16)
    at async ~/node_modules/@strapi/strapi/lib/middlewares/errors.js:13:7
ApplicationError: Unable to get response from google cloud translation : replaceString.replace is not a function
    at Object.doTranslation (~/node_modules/strapi-google-translator/server/services/translationServiceGoogle.js:83:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.doTranslation (~/node_modules/strapi-google-translator/server/services/translateService.js:131:28)
    at async Object.translate (~/node_modules/strapi-google-translator/server/services/translateService.js:42:34)
    at async Object.translate (~/node_modules/strapi-google-translator/server/controllers/translateController.js:19:24)
    at async returnBodyMiddleware (~/node_modules/@strapi/strapi/lib/services/server/compose-endpoint.js:52:18)
    at async policiesMiddleware (~/node_modules/@strapi/strapi/lib/services/server/policy.js:24:5)
    at async ~/node_modules/@strapi/strapi/lib/middlewares/body.js:58:9
    at async ~/node_modules/@strapi/strapi/lib/middlewares/logger.js:25:5
    at async ~/node_modules/@strapi/strapi/lib/middlewares/powered-by.js:16:5
    at async cors (~/node_modules/@koa/cors/index.js:107:16)
    at async ~/node_modules/@strapi/strapi/lib/middlewares/errors.js:13:7
    at async session (~/node_modules/koa-session/index.js:41:7)
    at async ~/node_modules/@strapi/strapi/lib/services/metrics/middleware.js:29:5 {
  details: {}
}
ApplicationError: Unable to get response from google cloud translation : replaceString.replace is not a function
    at Object.doTranslation (~/node_modules/strapi-google-translator/server/services/translationServiceGoogle.js:83:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.doTranslation (~/node_modules/strapi-google-translator/server/services/translateService.js:131:28)
    at async Object.translate (~/node_modules/strapi-google-translator/server/services/translateService.js:42:34)
    at async Object.translate (~/node_modules/strapi-google-translator/server/controllers/translateController.js:19:24)
    at async returnBodyMiddleware (~/node_modules/@strapi/strapi/lib/services/server/compose-endpoint.js:52:18)
    at async policiesMiddleware (~/node_modules/@strapi/strapi/lib/services/server/policy.js:24:5)
    at async ~/node_modules/@strapi/strapi/lib/middlewares/body.js:58:9
    at async ~/node_modules/@strapi/strapi/lib/middlewares/logger.js:25:5
    at async ~/node_modules/@strapi/strapi/lib/middlewares/powered-by.js:16:5
    at async cors (~/node_modules/@koa/cors/index.js:107:16)
    at async ~/node_modules/@strapi/strapi/lib/middlewares/errors.js:13:7
    at async session (~/node_modules/koa-session/index.js:41:7)
    at async ~/node_modules/@strapi/strapi/lib/services/metrics/middleware.js:29:5 {
  details: {}
}

"dependencies": { "@bn-digital/strapi-plugin-field-uuid": "^1.1.7", "@notum-cz/strapi-plugin-content-versioning": "^0.4.4", "@strapi/plugin-graphql": "^4.5.3", "@strapi/plugin-i18n": "4.5.3", "@strapi/plugin-seo": "^1.7.7", "@strapi/plugin-users-permissions": "4.5.3", "@strapi/provider-upload-cloudinary": "^4.5.3", "@strapi/strapi": "4.5.3", "moment": "^2.29.4", "mysql": "2.18.1", "sharp": "^0.31.2", "strapi-google-translator": "^1.0.7", "strapi-plugin-fast-content": "^1.0.0", "strapi-plugin-fuzzy-search": "^1.10.2", "strapi-plugin-import-export-entries": "^1.18.0", "strapi-plugin-menus": "^1.1.0", "strapi-plugin-placeholder": "^4.3.6", "strapi-plugin-sitemap": "boazpoolman/strapi-plugin-sitemap#beta" },

nishekh-e-r commented 1 year ago

@z0lo13 Hi, I have tested the plugin with the latest strapi v4.5.3, and it's working fine, take a look at the attached image. Also can you please provide more information on which test case scenarios the above error occurs?

google-translate1

google-translator2

google-translator3

google-translator4