- 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.