Re: Help with TranslateBehavior needed.
Nice hint :-) It is not intended behavior by design, it is just way how current implementation works. Anyway - you're not first one who brought this question up, so I think we will keep it working this way (related test case will be added soon), so you can rely on it without worries. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Help with TranslateBehavior needed.
Thank your for your quick reply. I've seen your other posts and they were really helpful :) > var $actsAs = array('Translate' => array( > 'title' => 'Titles', > 'abstract' => 'Abstracts', > 'text' => 'Texts' > )); OK, maybe that's worth it, but I'd loose that appreciated abstraction. :) Actually, I noticed that I can make it behave the way I want. Here's how: If I specify locale as, say, $this->Service->locale = 'lit', and there's no translation for 'lit', then the record is not returned. But if I specify it as $this->Service->locale = array('lit'), then the record gets fetched with missing fields as empty strings. That is good news for me. But is this intended behavior? I guess I'm going to rely on it for this little project. Linas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Help with TranslateBehavior needed.
It is price for performance and as simple db query as possible. If you need to know (with multiple preferred locales set) which translatios are missed, you will have to bind hasMany associations for translated fields, like var $actsAs = array('Translate' => array( 'title' => 'Titles', 'abstract' => 'Abstracts', 'text' => 'Texts' )); or $this->Service->bindTranslation(array( 'title' => 'Titles', 'abstract' => 'Abstracts', 'text' => 'Texts' ), false); and then explore returned data for these associations. Better would be validate translated data before saving (to have all fields translated, or saved with empty|default string), off course. Fact that record with missed translation is not returned (when single locale is set) is intended behavior. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Help with TranslateBehavior needed.
Hello, I'm trying to use TranslateBehavior for my project. I describe my model like that: class Service extends AppModel { var $name = 'Service'; var $actsAs = array('Translate' => array('title', 'abstract', 'text')); // table services also has fields like id, parent_id, order, created, etc. } These virtual fields (title, abstract, text) are great abstraction and I was very happy thinking how easy it will be to provide content management in various languages. Then I found out that model would not load Service from DB if some field in specified locale was missing. Is there any simple way to change this behavior so that Service with null fields would be loaded? As far as I understand, I can specify an array of preferred locales, but how do I recognize which locale was actually loaded? Thanks. Linas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---