Skip to content

Feat: Add Toggle Button to Translate All Fields#55

Closed
RickHeuvel wants to merge 4 commits into
voorhoede:mainfrom
RickHeuvel:feat/toggle-translate-all-btn
Closed

Feat: Add Toggle Button to Translate All Fields#55
RickHeuvel wants to merge 4 commits into
voorhoede:mainfrom
RickHeuvel:feat/toggle-translate-all-btn

Conversation

@RickHeuvel

Copy link
Copy Markdown

The purpose of this feature is to give DatoCMS administrators more control over the translation process, by allowing them to enable or disable the option for content editors to translate all locales at once. This can help ensure content editors focus on translating a single locale at a time, rather than mass-generating translations.

@netlify

netlify Bot commented Sep 24, 2024

Copy link
Copy Markdown

Deploy Preview for datocms-plugin-translate-fields ready!

Name Link
🔨 Latest commit bb7909c
🔍 Latest deploy log https://app.netlify.com/sites/datocms-plugin-translate-fields/deploys/670e5700ea8fb60008a53716
😎 Deploy Preview https://deploy-preview-55--datocms-plugin-translate-fields.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@velomovies velomovies left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the wait, but thanks a lot for the PR! Looks great.

I have a few comments. I hope you can fix them, if not let me know then I will implement this feature myself!

</Canvas>
)
}
return <></>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can return null here

Comment thread src/lib/types.ts

export interface GlobalParameters extends Parameters {
autoApply?: boolean
showTranslateAll?: boolean

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this shouldn't be a global setting only

Comment thread .gitignore
build
coverage No newline at end of file
coverage
.idea

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There shouldn't be local development folders in the .gitignore. My preference would be to put this in your global .gitignore. https://sebastiandedeyne.com/setting-up-a-global-gitignore-file/

type="submit"
rightIcon={isTranslating ? <Spinner size={24} /> : null}
disabled={isTranslating}
if (pluginGlobalParameters?.showTranslateAll) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should be able to have this option as a global parameter ánd a field parameter.

const showTranslateAll =
    pluginParameters?.showTranslateAll ??
    pluginGlobalParameters?.showTranslateAll ??
    defaultShowTranslate

defaultShowTranslate should be true for backwards compatibility

id="showTranslateAll"
label="Show translate to all languages button"
hint="If disabled it will not show the Translate to all languages button."
value={Boolean(pluginParameters?.showTranslateAll)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you implement the global parameter ánd a field parameter you should use:

const showTranslateAll =
    pluginParameters?.showTranslateAll ??
    pluginGlobalParameters?.showTranslateAll ??
    defaultShowTranslate

@velomovies

Copy link
Copy Markdown
Contributor

I close this PR since it's implemented in #69

@velomovies velomovies closed this Aug 7, 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.

2 participants