> Question: Why App.locales is better place for locales? I get it why
> Config.language is a bad place. But is App.locales because there's
> some convention I don't know about? Or maybe just Your ideaof place to
> store this stuff?

App.locales is not used by CakePHP core and just sounds reasonable/
self-explainable to me.

> Now I did sth. like this:
> ...
>       Configure::write('App.locales',
>                         array_unique(
>                            array_merge(Configure::read('App.locales'),
>                                        array(Configure::read
> ('Config.language') )
>                                        )
>                                      )
>                         );
> It's not to elegant but does what I need to be done: App.locales is an
> array for sure, firs locale in App.localse array is the same as
> Config.language (language which is current application language)

Once again: language and locale are different things and you should
not mix language and locale codes together like that. Language is 2
characters string from Configure/Session 'Config.language',
initialized by autodetection or forced by application code. Locale
identifier used by TranslateBehavior is longer, see L10n::
$__l10nCatalog (keys locale/localeFallback) and
TranslateBehavior::_getLocale().

> > In AppModel::beforeFind() would be useful to check
>
> > $this->Behaviors->attached('Translate') &&
> > $this->Behaviors->enabled('Translate')
>
> Can You tell me why I should do that?

Nothing important, just to initialize $locale property on models only
if necessary by this snippet of code. One never knows when things like
that could start biting in large applications.

> I don't think that beforeFind is a good place to set the locale field,
> because ...
>                 $pages = $this->ArticleVersion->ArticlePage->find('all',
>                                 array( 'conditions' => array
> ( 'ArticlePage.article_version_id'=> $article_version_id ),
>                                        'order' => 'ArticlePage.id')
>                                 );
> ArticlePage seemed to have string in a locale field and no translation
> problem occured once again.
>
> Does it have something to do with model chain?

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?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to