CakePHP 2.x translation fallback

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

CakePHP 2.x translation fallback

Zbigniew Ledwoń
I need to have fallback in translation.

If I have 2 translations ex.: 'eng' and 'es'
Some records have both translations and some only one or none.
I hoped that if I do it this way:

$this->Post->locale = ['es', 'eng'];
$results = $this->Post->find('first', array(
    'conditions' => array('Post.id' => $id)
));
I'll get 'es' translation and if 'es' is not available I'll get 'eng'.
but this does not seem to work. If I set 'locale' to a single value 'eng' or 'es' it works fine, but when I set $this->locale = ['es', 'eng'];
It seems to be ignored and no translation is taken into the result, just data from model table.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.