Skip to content

Conversation

@asieraduriz
Copy link

@asieraduriz asieraduriz commented Jan 9, 2025

Situation

Currently, there is no way to stop receiving the texts from the richText field. This PR checks for translatorSkip property for the richText fields.

Collection config

...
{
    name: 'content',
    type: 'richText',
    required: true,
    localized: true,
    custom: {
      translatorSkip: true,
    },
    editor: lexicalEditor(),
},
...

Translator resolver

const myResolver: TranslateResolver = {
  key: 'translator-key',
  resolve: async ({localeTo, texts}) => {
    console.log("Args.texts", texts);
    const transformed = texts.map((each) => `${each} - ${localeTo}`);
    return {
      success: true,
      translatedTexts: transformed,
    };
  },
};

How it looks in CMS UI

For english locale
image

What the logs show

Args.texts [
  'RichText translatorSkip',
  'Summary',
  'Any content not to be translated'
]

With this PR rich texts will also be skipped

@asieraduriz asieraduriz changed the title RichText Skip translations for RichText Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant