i18n find in associated model with cakephp
I have two models (Posts and Categories), those two model have i18n properties. I need to do something like this:
$posts->find('al开发者_开发问答l')
and return the Post with Category both translated. How can I achieve this on cakephp 1.3?
How are you storing the properties? That would help answer.
If you do not have a lot, you could create a translator component that stores the key value pairs and then pass your data to a function in the component after you have retrieved your data.
$posts = $this->Post->find('all');
$posts = $this->Translator->translatePost($post, 'language');
Unless you are storing the translations within the Model data, then this is probably a better solution so that you don't break the MVC paradigm.
There are tons of ways to do it, but you need to be more specific with your question in order to hone in on the issue.
精彩评论