I can't deal without this script which copies contents to i18n table, though. It's because when I leave those original fields - they have "higest priority", and they're the same as last saved translation ;) So I just need to copy them, and drop those fields. Needed to experience lot's of pain before I got certain that is the best way :D
Thanks for Your time Jitka, a lot of time I suppose. And I hope my questions didn't make You bang Your head against a desk, or any other hard surface ;) Greg On 9 Cze, 15:33, Grzegorz Pawlik <[email protected]> wrote: > And I'm fairly sure I don't need to do that trick in save method ;) > > On 9 Cze, 15:30, Grzegorz Pawlik <[email protected]> wrote: > > > Ok, I'll suppress my 'general why questions compulsive behaviour' ;) > > > About not existing callback - just a mistake. I meant beforeFind of > > course. But it's not the point. > > I Talk about ArticleVersion and ArticlePage, because those two models > > I want to have translatable, but that is not the problem either. > > > I think my problem is that Translate::beforeFind is running **before** > > AppModel::beforeFind, so setting an array to > > $this->locale in it is useless. That's why it was working in > > constructor, but when it's in constructor - I can't manage the > > language changes in > > AppController::beforeFilter. > > > I can do this for "primary model", like that: > > $this->{$this->modelClass}->locale = Configure::read('App.locales'); > > > But relationship models still get locale from (default) Configure::read > > ('Config.language'); and it's string not an array. > > > So If my desired model behavior is to have the fallback language, and > > find translations when not every field has been tranlsated - I need to > > put that line: > > $this->ArticleVersion->locale = Configure::read('App.locales'); > > before every find (or at least before first find in specific method), > > or make a find method wrapper: > > function find($conditions = null, $fields = array(), $order = null, > > $recursive = null) { > > $this->locale = Configure::read('App.locales'); > > return parent::find($conditions, $fields, $order, $recursive); > > } > > either app-wide (in AppModel::find()) or Model-wide( ie > > ArticleVersion::find()) > > > On 5 Cze, 15:57, "jitka (poLK)" <[email protected]> wrote: > > > > > If so - why it's like that? Is it some backward compatibility? Because > > > > it's seems a little bit weird. > > > > I am not The One who rules whole world, my friend. And I don't like > > > general 'why' questions too :) because I am not mindreader to be sure > > > why it seems weird to you. > > > > Names of subfolders in app/locale folder are also not language > > > shortcuts. If you will read my previous post carefully, you will > > > notice word localeFallback in there - one of things which will be > > > adressed by future releases of CakePHP, so stay tuned. > > > > > > > $pages = > > > > > > $this->ArticleVersion->ArticlePage->find('all', > > > > > > It sounds to me like you are doing it in ArticleVersion::beforeFind() > > > > > instead of AppModel::beforeFind(), or your custom > > > > > ArticlePage::beforeFind() is not calling parent::beforeFind(). Could > > > > > you confirm that? > > > > > I definitely have this AppModel::beforeFilter and have no beforeFilter > > > > in ArticleVersion now (tried with explicit call parent::beforeFilter > > > > in ArticleVersion::beforeFilter but it was no difference). > > > > Please, read my answer thoroughly. You are calling find() method of > > > ArticlePage model, but still talking about changes in ArticleVersion > > > model. And even worse: about not existing model's callback. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
