Problem/Motivation
If there are identical machine names in different entity types, the array_merge in Auto Translation Settings overwrites them, so that only one is left in the Auto Translation Settings form.
As a consequence, only one of them can be auto translated.
Steps to reproduce
Create for example a node type and a taxonomy and give them the same id. Open the Auto Translation Settings and only one of them will be listed.
If this one is marked and saved, only this entity type can be automatically translated.
Proposed resolution
Do you happen to work on this already?
If not, I could give it a shot. It is probably best to have a separate input field in the settings form for each entity type. I see two possible ways to handle this.
First, the scheme in auto_translation.schema.yml is extended and gets a new field for each entity type. In this case all of them must be checked in Utility.php for the auto translatable entity types.
Second all the entity specific arrays can be pulled together into one multidimensional array before saving. One sub - array per entity type. Then no change in the scheme is necessary. In this case, this multidimensional array must be pulled apart again in Utility.php to check for the auto translatable entity types.
In either of this two approaches, a migration from the old settings will be useful.
What do you think about this?
Comments
Comment #2
bigbabertComment #5
bigbabertComment #6
bigbabertComment #7
martin mayer commentedThank you for the changes. I started testing the new version.
Now the prefixes in 1.4.36 keep Taxonomy terms from being translated. The prefix is set to 'taxonomy_vocabulary' in AutoTranslatorSettingsForm.php
When I try to translate a taxonomy term, $entity_type is set to 'taxonomy_term' in Utlilty.php line 631. Therefore the term is not recognized as enabled content type in line 639.
It works again if I change the set prefixes in AutoTranslatorSettingsForm.php lines 149 and 150 to 'taxonomy_term'.
I wonder, wouldn't it be an easier solution to check for the bundle rather than the entity type in Utlilty.php line 639. Then the prefixes might not be necessary.
Comment #8
bigbabertHi @martin mayer,
thanks to test and for feedbacks, i'll update changing the prefix for taxonomy to make it consistent, about the check on the bundles, it still will need the bundle stored in the settings, i'll evaluate if there is a better way to achive the result in 1.5.x meanwhile later today will push the fix only changing the prefix, needs also double check on other bundles prefix.
Best regards
Comment #9
bigbabertMaybe i can use the bundle name as prefix to make it more consistent.
Comment #13
bigbabertComment #14
martin mayer commentedI testet this in several different variations and it worked well.
Comment #15
bigbabertComment #16
bigbabertComment #17
bigbabert