Feat: Add Toggle Button to Translate All Fields#55
Conversation
✅ Deploy Preview for datocms-plugin-translate-fields ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
velomovies
left a comment
There was a problem hiding this comment.
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 <></> |
There was a problem hiding this comment.
You can return null here
|
|
||
| export interface GlobalParameters extends Parameters { | ||
| autoApply?: boolean | ||
| showTranslateAll?: boolean |
There was a problem hiding this comment.
I think this shouldn't be a global setting only
| build | ||
| coverage No newline at end of file | ||
| coverage | ||
| .idea |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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)} |
There was a problem hiding this comment.
If you implement the global parameter ánd a field parameter you should use:
const showTranslateAll =
pluginParameters?.showTranslateAll ??
pluginGlobalParameters?.showTranslateAll ??
defaultShowTranslate
|
I close this PR since it's implemented in #69 |
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.