Question

I'm using a2lix_translation_form tabs in my form. It has the feature, that it allows you to edit several translations to one property in one form. I have it configured like this:

a2lix_translation_form:
    locales: [sk, en, de]       # [1]
    default_required: false ... # further as default

In the form I have following 3 Tabs where I can edit one property (Description)

|SK [Default] | En | DE |

It worked fine (stored things in database and so on), until I turned on the translatable in stof_doctrine_extensions. Here is the config:

stof_doctrine_extensions:
default_locale: sk
orm:
    default:
        translatable: true # not needed: listeners are not enabled by default

I also use jms_i18n_routing:

jms_i18n_routing:
    default_locale: sk
    locales: [sk, de, en]
    strategy: prefix_except_default

When I acess

localhost/app_dev.php/product/1/edit

then everything looks fine, but when I access

localhost/en/app_dev.php/en/company/11/edit

the Sk [Default] contains En description.

When I set the translatable in stof_doctrine_extensions to false the form is displayed correctly. But I need to have it ON, because I need it for other components. What can I do?

Was it helpful?

Solution

You are in a specific case, that I don't advice henceforth. You will have some difficulties with you database if you change your default locale in the future.

I've updated the doc (I have still some work..), see the end of http://a2lix.fr/bundles/translation-form/#bundle-advanced. You can use annotation as explaned in the doc or add at the beginning of yours edit/create methods:

   $translatableListener = $this->get('stof_doctrine_extensions.listener.translatable');
   $translatableListener->setTranslatableLocale($translatableListener->getDefaultLocale());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top