#5886: translate behaviour defaut locale error
---------------------------+------------------------------------------------
    Reporter:  hipolitogb  |         Owner:         
        Type:  Bug         |        Status:  new    
    Priority:  Medium      |     Milestone:  1.2.x.x
   Component:  General     |       Version:  RC2    
    Severity:  Normal      |    Resolution:         
    Keywords:              |   Php_version:  n/a    
Cake_version:              |  
---------------------------+------------------------------------------------
Old description:

> Hi
> After a few minutes of debuggin, I tried to set the default language at
> the translate behaviour. I use different methods, but I decided for this:
>  Configure::write('Config.language', "es_ar");
>
> The translate.php file (cake/libs/models/behaviors/translate.php) at line
> 337 first get the i10n default language:
> $I18n->l10n->get(Configure::read('Config.language'));
>
> But then, the translate behaviour read the default var of l10n.php at
> line 339:
>  $model->locale = $I18n->l10n->locale;
>

> I change this to:
>

>         function _getLocale(&$model) {
>                 if (!isset($model->locale) || is_null($model->locale)) {
>                         if (!class_exists('I18n')) {
>                                 App::import('Core', 'i18n');
>                         }
>                         $I18n =& I18n::getInstance();
>                         $lang =
> $I18n->l10n->get(Configure::read('Config.language'));
>
>                         //$model->locale = $I18n->l10n->locale;
>                         $model->locale = $lang;
>                 }
>                 return $model->locale;
>         }

New description:

 Hi
 After a few minutes of debuggin, I tried to set the default language at
 the translate behaviour. I use different methods, but I decided for this:
  {{{ Configure::write('Config.language', "es_ar"); }}}

 The translate.php file (cake/libs/models/behaviors/translate.php) at line
 337 first get the i10n default language:
 {{{ $I18n->l10n->get(Configure::read('Config.language')); }}}

 But then, the translate behaviour read the default var of l10n.php at line
 339:
  {{{ $model->locale = $I18n->l10n->locale; }}}


 I change this to:

 {{{
         function _getLocale(&$model) {
                 if (!isset($model->locale) || is_null($model->locale)) {
                         if (!class_exists('I18n')) {
                                 App::import('Core', 'i18n');
                         }
                         $I18n =& I18n::getInstance();
                         $lang =
 $I18n->l10n->get(Configure::read('Config.language'));

                         //$model->locale = $I18n->l10n->locale;
                         $model->locale = $lang;
                 }
                 return $model->locale;
         }
 }}}

Comment (by mark_story):

 fixing formatting.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5886#comment:1>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets 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/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to