Fekide / strapi-plugin-translate

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

[BUG]: After translation html tags are turned to markdown #316

Open bobkataboo opened 11 months ago

bobkataboo commented 11 months ago

Describe the bug I am using strapi-provider-translate-deepl. After running the translations my html

<h2 id="1">
text
</h2>

is turned to markdown

## text

Expected behavior

<h2 id="1">
text
</h2>

remains html after translation

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: {
        // your API key - required and wil cause errors if not provided
        apiKey: env("DEEPL_API_KEY"),
        // use custom api url - optional
        tagHandling: "html",
        apiUrl: "https://api-free.deepl.com",
        // 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",
        },
        translatedFieldTypes: [
          "string",
          { type: "text", format: "plain" },
          { type: "richtext", format: "markdown" },
          "component",
          "dynamiczone",
        ],
        apiOptions: {
          // see <https://github.com/DeepLcom/deepl-node#text-translation-options> for supported options.
          // note that tagHandling Mode cannot be set this way.
          // use with caution, as non-default values may break translation of markdown
          tagHandling: "html",
          formality: "default",
          // ...
        },
      },
      // other options ...
    },
  },
}
bobkataboo commented 11 months ago

Please help me <3 I need this as it's stopping the releasing of our new websites

sargreal commented 11 months ago

Hi @bobkataboo and thank you for opening this issue!

As we are working voluntary here, we cannot provide you with a time frame on when we can fix this.

Also, because showdown, the tool we use currently to achieve the translation of markdown by translating the markdown to html and back, does not support this, it is not a trivial fix.

The easiest workaround for now could be to enable some kind of automatic id generation in your markdown to html converter in the frontend.