On Oct 11, 4:43 am, oth <[email protected]> wrote:
> Hello,
>
> Is there a way to implement this scenario:
>
> Post is written in locale EN, if locale FR is selected, and there is
> no FR translation available for the Post, return nothing.
> Currently it returns the default fields found in the posts table.
>
> I'd guess that first, there should be a way to specify the locale of
> the post upon saving. Consider that done.
> How would it go about telling cake not to grab the default fields and
> just return nothing ?
> of course one would loop through the result and do some tests then
> unset() the record, and alter paging params accordingly but this is a
> waste of cycles.
>
> Any thoughts are  welcome

In that circumstance does the translate behavior actually help you
(from your description it sounds like you are using it), it's designed
to do exactly what you don't want?

My recommendation would be to at least consider either:

* use two fields for each translated field
  This would let you easily set the contents in both langauges without
any "magic"

* use two tables and switch between them with setSource based on the
locale
  Sounds most appropriate from your description.

If you have more than 2 languages or want to use the translate
behavior for other reasons - you'll probably need to modify how the
joins are made so that it does not include the default language.

AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to