Fekide / strapi-plugin-translate

Strapi plugin for automated translations using different Translate Providers
https://market.strapi.io/plugins/strapi-plugin-translate
MIT License
46 stars 18 forks source link

[BUG]: getRequestUrl no longer available #285

Closed thijsbrouwers closed 1 year ago

thijsbrouwers commented 1 year ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch strapi-plugin-translate@1.2.0 for the project I'm working on.

Since strapi v4.12.1 the getRequestUrl method is dropped (https://github.com/strapi/strapi/pull/17437). This breaks the plugin when trying to translate contenttypes with relations.

Here is the diff that solved my problem:

diff --git a/node_modules/strapi-plugin-translate/admin/src/components/CMEditViewTranslateLocale/utils/parse-relations.js b/node_modules/strapi-plugin-translate/admin/src/components/CMEditViewTranslateLocale/utils/parse-relations.js
index 828928d..2fbb8c3 100644
--- a/node_modules/strapi-plugin-translate/admin/src/components/CMEditViewTranslateLocale/utils/parse-relations.js
+++ b/node_modules/strapi-plugin-translate/admin/src/components/CMEditViewTranslateLocale/utils/parse-relations.js
@@ -1,5 +1,4 @@
 import _ from 'lodash'
-import { getRequestUrl } from '@strapi/admin/admin/src/content-manager/utils'

 export const PUBLICATION_STATES = {
   DRAFT: 'draft',
@@ -14,7 +13,7 @@ export const PUBLICATION_STATES = {
  * @returns
  */
 export function getRelationLink(targetModel, id) {
-  return `${getRequestUrl(`collectionType/${targetModel}/${id ?? ''}`)}`
+  return `/content-manager/collectionType/${targetModel}/${id ?? ''}`
 }

 /**

This issue body was partially generated by patch-package.

fekide-bot commented 1 year ago

:tada: This issue has been resolved in version 1.0.8 :tada:

The release is available on npm package (@latest dist-tag)

Your semantic-release bot :package::rocket:

fekide-bot commented 1 year ago

:tada: This issue has been resolved in version 1.2.1 :tada:

The release is available on npm package (@latest dist-tag)

Your semantic-release bot :package::rocket:

fekide-bot commented 1 year ago

:tada: This issue has been resolved in version 1.1.9 :tada:

The release is available on npm package (@latest dist-tag)

Your semantic-release bot :package::rocket: