My context ... If your working in english, everything is in english. UI and content. So I dont need to translate the content in 2 languages everytime i save some object. If the user switch to french, then he can translate the content to french.
With 1.4(doctrine and i18n) I used admin generator to build my backend and everyting is ok.
backend/config/settings.yml
- Code: Select all
i18n: on
default_culture: fr
schema.yml ...
- Code: Select all
Poll:
actAs:
Timestampable: ~
I18n:
fields: [ title, question ]
actAs:
Sluggable: { fields: [title], uniqueBy: [lang, title] }
columns:
title: { type: string(255), notnull: true }
question: { type: string(1000), notnull: true }
...
In my form class ...
- Code: Select all
class BackendPollForm extends BasePollForm
{
public function configure()
{
unset( $this['created_at'], $this['updated_at'] );
// Hardcoded for testing.
$this->embedI18n(array('fr'));
$this->widgetSchema->setLabel('fr', 'Français');
}
}
Everything work fine until I save...
Integrity constraint violation: 1062 Duplicate entry 'en-' for key 'poll_translation_sluggable_idx'
I have embeded only FR and it's always using both FR and EN. EN is empty so it will always save as null and generate the constraint error.
How do I embed-it so it only use the form related to "current language" and not both ?
Mart
