Tuesday, September 3, 2013

i18n Search for string in multiple translations

Hi there,

Im trying to set up a search function for a multilingual website. I'm using cake's (2.2) translation behavior and my translated fields are saved in a separate table (for example: I18n__titleTranslation)

Now i would like to search these records and their translations but the only way I seem to be able to do that is by looping through all the site languages (6 in my case) and setting $this->Model->locale = <lang> for every language before I do a find. To me this comes over as a bit expensive and in the process actually can result in duplicate results (keyword 'test' can be found on multiple translations). 

Does anyone have an idea of how to tackle this? 

--
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 cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: