locale... Still don't understand ;)
After AD7six comment. I'll do all right ;-) And I see how switch template: index.thtml (main-default) index_ua_ua.thtml, index_ru_ru.thtml - for other. But I don't understand one petit thing. How switch table? I thing, I needing two table Posts: id, title, body (english) RPosts: id, title, body (russian) UPosts: id, title, body (ukraine) But. Now, I write: in posts_controller: var $uses = 'Post'; and query looks like: $this-{$this-uses}-findAll And have no problem with default language (index.thtml). When I set debug level 3, I see 2 query: DESC posts, and SELECT All done. But, when I switch into other language, I see empty index (no foreach data). I understand, RPost or UPost - not setting up by me nowhere. But, index.thtml index_ru_ru.thtml - actually identical. So... Why I hadn't query (debug not display anything) and how switch table? Or better way to switch? Thanks! And sorry for bad english --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: locale... Still don't understand ;)
May be I write not so correct... So, I mean: when default language select: I get two request to DB Posts But when I select other lang, I don't see any mysql query ;-( I have: class PostsController var $uses = 'Post'; function index () { $this-set('data',$this-{$this-uses}-findAll()); } And I understand: when default, $this-uses = 'Post'. But when I select other language? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: locale... Still don't understand ;)
Hi Vlad, I don't quite undertstand, but: Switching tables would be something that you would do yourself - the locale package I wrote doesn't take care of this (note that for 1.2 it is planned to take care of translating db content). There is a 'feature' of the locale package which has existed since the beginning ( Perhaps I should make one last update) in that it does not run the controller method if there is an alternate language view file. If you want to run controller methods and use different view files I would suggest: 1) removing the line of code from the compoent that calls render and die 2) try some code like this in your app controller: function render($action = null, $layout = null, $file = null) { $action = $action?$action:$this-action; if (strpos($action,_)===false) { $action = $this-Inflector-underscore($action); } else { $action = low($action); } if (!$file) { $Code = $this-Locale-_getCode (false); if ($Code) { $i18nFile = VIEWS.$this-name.DS.$action._.$Code..thtml; if (is_file($i18nFile)) { $file = $i18nFile; } } } parent::render($action,$layout,$file); } With that you should at least make some progress. HTH, AD7six --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: locale... Still don't understand ;)
PS Fernando, That's quite a long way round ;). I wrote some starting out tips you can find here: http://www.noswad.me.uk/MiBlog/Blogs/View/CakePHPQuickTips. cheers, AD7six --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: locale... Still don't understand ;)
Strange, but when I switch to language other then default I got $this-uses == '' Then I think that locale switch tables, but unknown method for me (I look locale.php from first to last string and don't find anything about switching table... But when language switching, $this-{$this-uses}-findAll - doesn't work So I make conclusion: table switching (?) or something wrong with $this-uses ;-) But (look down) AD7six says about my mistake: no table switching... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: locale... Still don't understand ;)
at last I understand ;-) Thank's, AD7six for your patience ;) I understand ;-) Sorry for a lot question ;-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---