Listener for the I18n behavior: try to reuse existing translations
If there is a multi-lingual text in the database that has the same strings for all the fields and languages we have, assign that id as our translation_id
This means that it is possible to save a text in just one language, and get translations in all other available languages 'for free'.
package | WebEnq4_I18n |
---|---|
author | Rolf Kleef |
preSave(\Doctrine_Event $event)
assignTranslationId(Object $data, integer $id)
Object
Object with translations
integer
Id to be assigned
findTranslation(Object $data) : mixed
Try to find a translation id where non of the fields is conflicting with the fields we have (that are non-empty strings)
todo | Add better ways to check for actual changes? |
---|---|
todo | Not possible to store a text without a translation for a field we want to keep empty? |
todo | Garbage collection? |
Object
Record that holds translations
mixed
Item id with translation to be reused or false if none foundnewTranslationId() : integer
integer
New id