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

fix(i18n): allow to store the new entry in the draft after a pre save #7227

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jmfiaschi
Copy link

@jmfiaschi jmfiaschi commented Jun 5, 2024

Summary

fixex #4729 : Today it's not possible for example to translate empty fields with external APIs with the preSave because the preSave expect to return only a datathat not contain i18n values.

With this kind of code, we should be able to update the i18n values :

CMS.registerEventListener({
  name: 'preSave',
  handler: async ({ entry }) => {
      return entry.setIn(["i18n", "it", "data", "title"], "my translated title for IT");
  }
});

The change has no regression. PreSave can return data/entry modifications.

Test plan

Done

Checklist

Please add a x inside each checkbox:

A picture of a cute animal (not mandatory but encouraged)

@jmfiaschi jmfiaschi requested a review from a team as a code owner June 5, 2024 08:57
@jmfiaschi
Copy link
Author

if someone can review

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.

None yet

1 participant