Ok... Maybe I don't understand the correct way to do this, but...
I have a (translatable) entity (entity1) with a entity_reference field embed by code (declared with baseFieldDefinitions method). This field is not translatable.
The field embed another type of entity (entity2), which is translatable too.
I create two "entity2" entities in french, and translate only one. These two entities are attached to the field previously defined in entity1.
When displaying my instance of entity1 :
- In french, it display the two sub-entities in french
- In english, it display one sub-entity in english (the translated one) and the second in french (the not translated).
I tried to install entity_language_fallback without success, I tried some configuration without success too...
How to set my display showing ONLY existing sub-items switch language ?? I tried the same implementation with nodes (my node type embed an entity-reference field that can reference same type of nodes) and I have the same result... Is my logic wrong ? In d7, I remember that when a translation didn't exists, field display showed a "translation unavailable" for admin and didn't show any information for anonymous users...
Must I create a new entity-reference formatter and override the "getEntitiesToView" method to filter on language ?? I don't see other way actually, and I'm a little disappointed that the entity-reference field (and core itself) doesn't take care on language behavior.
If anyone has a suggestion it would be helpful.
Thanks in advance.