StofDoctrineExtensionsBundle
StofDoctrineExtensionsBundle copied to clipboard
[Translation] Default Translation not loaded
Hi,
I'm using a AbstractPersonalTranslation and the translatable form as described in the doc.
When in twig I try to get {{ entity.description }} that is translatable, if the session's locale is set to the default locale ( 'en') , nothing is displayed. A request is still done :
SELECT t0.id AS id1, t0.locale AS locale2, t0.field AS field3, t0.content AS content4, t0.object_id AS object_id5 FROM translations t0 WHERE t0.object_id = ?
Parameters: [45]
The default translation is stored as I can see it in my sql tables. And any other translation is displayed.
But if I set
stof_doctrine_extensions:
default_locale: 'cacahuete' # instead of %locale% ( 'en' )
translation_fallback: true
persist_default_translation: true
When I {{ entity.description }} with session.locale in 'en' it works.
I'm pretty sure I missed something but I can't figure out what...
Okay, it took time (no internet home yet...) but I got it. So the default locale is to set in the actual description field. So when you get the description in the default language no query should be done but any untranslated one will fall back to that.
The only problem is that my form looks bad now.
It would be great if something could magically put any translated field in the default language inside the actual field.
Any Ideas ?
Maybe you have a look at https://github.com/a2lix/DemoTranslationBundle