Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Translating with nested components containing JSON field does not work. #403

Open
Discountrobot opened this issue May 2, 2024 · 0 comments

Comments

@Discountrobot
Copy link

Describe the bug
When you have a entity with a repeatable component, that itself contains the JSON field type, translation will fail to save - even if the component is marked as non-translatable.

To Reproduce

  1. create a reusable component with a json field
    Screenshot 2024-05-02 at 14 44 25

  2. create a entity that uses the reusable compoinent

  3. fill out the original entity

  4. create a new locale

  5. try to translate the entity after saving.

  6. observe the following error

TypeError: (i.doc || "").split is not a function
    at na.create (main.1c8cf574.js:3702:27812)
    at main.1c8cf574.js:3711:66977
    at Li (main.1c8cf574.js:1102:25330)
    at Kf (main.1c8cf574.js:1102:44207)
    at mh (main.1c8cf574.js:1102:42943)
    at Vf (main.1c8cf574.js:1102:41960)
    at d4 (main.1c8cf574.js:1102:38431)
    at Hl (main.1c8cf574.js:1100:3311)
    at main.1c8cf574.js:1102:35725

Expected behavior

It looks like it is an issue with mapping to the component structure, naturally the translation should succeed.

Screenshots
If applicable, add screenshots to help explain your problem.

System (please complete the following information):

  • OS: [e.g. Linux]
  • Browser brave
  • Versions:
    • strapi: 4.24.0
    • strapi-plugin-translate: 1.2.4
    • provider: strapi-provider-translate-deepl@1.1.2

Plugin config
Please add your plugin config here, e.g.

module.exports = {
  translate: {
    enabled: true,
    config: {
      // Choose one of the available providers
      provider: "deepl",
      // Pass credentials and other options to the provider
      providerOptions: {
        // use custom locale mapping (for example 'en' locale is deprecated so need to choose between 'EN-GB' and 'EN-US')
        localeMap: {
          // use uppercase here!
          EN: "EN-US",
        },
        apiOptions: {
          formality: "default",
        },
      },
      translatedFieldTypes: [
        "string",
        { type: "json", format: "plain" },
        { type: "text", format: "plain" },
        { type: "richtext", format: "markdown" },
        "component",
        "dynamiczone",
      ],
      translateRelations: true,
    },
}

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant