Re: Help with TranslateBehavior needed.

2008-09-29 Thread jitka (poLK)

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
-~--~~~~--~~--~--~---



Re: Help with TranslateBehavior needed.

2008-09-29 Thread Linas

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.

2008-09-29 Thread jitka (poLK)

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
-~--~~~~--~~--~--~---