- Issue created by @jonathan_hunt
- 🇳🇿New Zealand jonathan_hunt
Here's a patch for discussion, that aims to avoid generating a translation if the field value is empty.
1. InaddLanguageElements()
when a new language field is added, the value is defaulted to null (perhaps this should look at the default value for the field rather than defaulting in value from site default language).
2.entityBuilder()
is refactored a little to attempt to detect a non-empty field value and only add a translation if field value is non-empty. This means I can have a site with 8 possible languages, but if the user only submits values for 3 languages, only 3 translations are generated. It allows an empty value to be saved when editing a translated value, but a translation needs to be manually deleted if no values exist.Perhaps an improvement would be to delete a translation if no values are different to the original language entity.
This patch works for a translated textarea field; that is sufficient for my use-case. It hasn't been tested on other field types.
- 🇬🇧United Kingdom alexpott 🇪🇺🌍
This would be great to fix - I think though that we need to add test coverage for this.
- 🇬🇧United Kingdom Driskell
Likely it would be best to have an “Add translation” button / drop button underneath so it’s optin. It would also greatly simplify and prevent needing to know if a field is empty or not and even prevent assuming that empty fields means you didn’t want a translation (maybe you want an empty one)
Easiest likely is a tickbox at the top of the non default language tabs that is “Add this translation” and all fields have a state that enables them if ticked. Just need to be sure all widgets support this as I know CKEditor one used to have issues with enable state but either way it hopefully clear enough to users.