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

feat(plugin): add ability to define a condition to globals/collections #143

Merged
merged 5 commits into from
Dec 21, 2023

Conversation

thompsonsj
Copy link
Owner

@thompsonsj thompsonsj commented Dec 21, 2023

Add the ability to configure a collection to only translate documents through Crowdin that meet a condition based on the document data.

Includes:

  • updates to docs including restoring docs from feat(*): migrate to nx monorepo #125.
  • configuration of the Payload dev installation for testing with a Crowdin project.
  • tabbedUI fix for the Payload dev installation.

Example

Add a checkbox field within your Payload CMS config such as:

{
  name: "translateWithCrowdin",
  type: "checkbox",
}

In your config, dictate that Crowdin translation should only occur if this checkbox is checked.

collections: [
  {
    slug: 'posts',
    condition: ({ doc }) => doc.translateWithCrowdin,
  },
]

Crowdin logic is run in an afterChange hook. The doc parameter is what is passed to this condition.

@thompsonsj thompsonsj merged commit 5cc577a into main Dec 21, 2023
1 check passed
@thompsonsj thompsonsj mentioned this pull request Dec 21, 2023
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