Zend_Locale

7 messages Options
Embed this post
Permalink
asagala

Zend_Locale

Reply Threaded More More options
Print post
Permalink
Hi,

I am currently having an issue with Zend_Locale. I am initializing the default in my bootstrap like this

        protected function _initLocale()
        {
                $locale = new Zend_Locale('en_US');
                Zend_Registry::set('Zend_Locale', $locale);
               
            return $locale;
        }  

and this works fine. However when I try and change the value of the locale in my controllers the initial value is not overwritten. Here is how I am writting the new value to the Zend_Locale key in my controllers

Zend_Registry::set('Zend_Locale','fr_CA');

Anyone have a clue?
asagala

Re: Zend_Locale

Reply Threaded More More options
Print post
Permalink


Also tried this
                        $locale = new Zend_Locale('fr_CA');
                        Zend_Registry::set('Zend_Locale', 'fr_CA');


asagala wrote:

>
> Hi,
>
> I am currently having an issue with Zend_Locale. I am initializing the
> default in my bootstrap like this
>
> protected function _initLocale()
> {
> $locale = new Zend_Locale('en_US');
> Zend_Registry::set('Zend_Locale', $locale);
>      
>    return $locale;
> }  
>
> and this works fine. However when I try and change the value of the locale
> in my controllers the initial value is not overwritten. Here is how I am
> writting the new value to the Zend_Locale key in my controllers
>
> Zend_Registry::set('Zend_Locale','fr_CA');
>
> Anyone have a clue?
>

--
View this message in context: http://old.nabble.com/Zend_Locale-tp26230812p26230819.html
Sent from the Zend Framework mailing list archive at Nabble.com.

asagala

Re: Zend_Locale

Reply Threaded More More options
Print post
Permalink
In reply to this post by asagala

Also tried this
                        $locale = new Zend_Locale('fr_CA');
                        Zend_Registry::set('Zend_Locale', $locale);

asagala wrote:
Hi,

I am currently having an issue with Zend_Locale. I am initializing the default in my bootstrap like this

        protected function _initLocale()
        {
                $locale = new Zend_Locale('en_US');
                Zend_Registry::set('Zend_Locale', $locale);
               
            return $locale;
        }  

and this works fine. However when I try and change the value of the locale in my controllers the initial value is not overwritten. Here is how I am writting the new value to the Zend_Locale key in my controllers

Zend_Registry::set('Zend_Locale','fr_CA');

Anyone have a clue?
thomasW

Re: Zend_Locale

Reply Threaded More More options
Print post
Permalink
In reply to this post by asagala
According to manual the registry key 'Zend_Locale' has to be an instance of
Zend_Locale.
'fr_CA' may be a locale, but it's not an instance of Zend_Locale.

So when you want to change the application wide locale afterwards you need
to change the instance and not the registry content.

$locale = Zend_Registry::get('Zend_Locale');
$locale->setLocale('fr_CA');
Zend_Registry::set('Zend_Locale', $locale);

Because giving a string does not overwrite the content of the set instance.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com


----- Original Message -----
From: "asagala" <[hidden email]>
To: <[hidden email]>
Sent: Friday, November 06, 2009 5:32 PM
Subject: Re: [fw-general] Zend_Locale


>
>
> Also tried this
> $locale = new Zend_Locale('fr_CA');
> Zend_Registry::set('Zend_Locale', 'fr_CA');
>
>
> asagala wrote:
>>
>> Hi,
>>
>> I am currently having an issue with Zend_Locale. I am initializing the
>> default in my bootstrap like this
>>
>> protected function _initLocale()
>> {
>> $locale = new Zend_Locale('en_US');
>> Zend_Registry::set('Zend_Locale', $locale);
>>
>>     return $locale;
>> }
>>
>> and this works fine. However when I try and change the value of the
>> locale
>> in my controllers the initial value is not overwritten. Here is how I am
>> writting the new value to the Zend_Locale key in my controllers
>>
>> Zend_Registry::set('Zend_Locale','fr_CA');
>>
>> Anyone have a clue?
>>
>
> --
> View this message in context:
> http://old.nabble.com/Zend_Locale-tp26230812p26230819.html
> Sent from the Zend Framework mailing list archive at Nabble.com.

asagala

Re: Zend_Locale

Reply Threaded More More options
Print post
Permalink

That still doesnt work.

thomasW wrote:
According to manual the registry key 'Zend_Locale' has to be an instance of
Zend_Locale.
'fr_CA' may be a locale, but it's not an instance of Zend_Locale.

So when you want to change the application wide locale afterwards you need
to change the instance and not the registry content.

$locale = Zend_Registry::get('Zend_Locale');
$locale->setLocale('fr_CA');
Zend_Registry::set('Zend_Locale', $locale);

Because giving a string does not overwrite the content of the set instance.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com


----- Original Message -----
From: "asagala" <asagala@gmail.com>
To: <fw-general@lists.zend.com>
Sent: Friday, November 06, 2009 5:32 PM
Subject: Re: [fw-general] Zend_Locale


>
>
> Also tried this
> $locale = new Zend_Locale('fr_CA');
> Zend_Registry::set('Zend_Locale', 'fr_CA');
>
>
> asagala wrote:
>>
>> Hi,
>>
>> I am currently having an issue with Zend_Locale. I am initializing the
>> default in my bootstrap like this
>>
>> protected function _initLocale()
>> {
>> $locale = new Zend_Locale('en_US');
>> Zend_Registry::set('Zend_Locale', $locale);
>>
>>     return $locale;
>> }
>>
>> and this works fine. However when I try and change the value of the
>> locale
>> in my controllers the initial value is not overwritten. Here is how I am
>> writting the new value to the Zend_Locale key in my controllers
>>
>> Zend_Registry::set('Zend_Locale','fr_CA');
>>
>> Anyone have a clue?
>>
>
> --
> View this message in context:
> http://old.nabble.com/Zend_Locale-tp26230812p26230819.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
asagala

Re: Zend_Locale

Reply Threaded More More options
Print post
Permalink

By the way you can set the locale string in the constructor. This works in the bootstrap file

                $locale = new Zend_Locale('en_US');
                Zend_Registry::set('Zend_Locale', $locale);

I get the issue when I try to overwrite the value in my controllers

asagala wrote:
That still doesnt work.

thomasW wrote:
According to manual the registry key 'Zend_Locale' has to be an instance of
Zend_Locale.
'fr_CA' may be a locale, but it's not an instance of Zend_Locale.

So when you want to change the application wide locale afterwards you need
to change the instance and not the registry content.

$locale = Zend_Registry::get('Zend_Locale');
$locale->setLocale('fr_CA');
Zend_Registry::set('Zend_Locale', $locale);

Because giving a string does not overwrite the content of the set instance.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com


----- Original Message -----
From: "asagala" <asagala@gmail.com>
To: <fw-general@lists.zend.com>
Sent: Friday, November 06, 2009 5:32 PM
Subject: Re: [fw-general] Zend_Locale


>
>
> Also tried this
> $locale = new Zend_Locale('fr_CA');
> Zend_Registry::set('Zend_Locale', 'fr_CA');
>
>
> asagala wrote:
>>
>> Hi,
>>
>> I am currently having an issue with Zend_Locale. I am initializing the
>> default in my bootstrap like this
>>
>> protected function _initLocale()
>> {
>> $locale = new Zend_Locale('en_US');
>> Zend_Registry::set('Zend_Locale', $locale);
>>
>>     return $locale;
>> }
>>
>> and this works fine. However when I try and change the value of the
>> locale
>> in my controllers the initial value is not overwritten. Here is how I am
>> writting the new value to the Zend_Locale key in my controllers
>>
>> Zend_Registry::set('Zend_Locale','fr_CA');
>>
>> Anyone have a clue?
>>
>
> --
> View this message in context:
> http://old.nabble.com/Zend_Locale-tp26230812p26230819.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
asagala

Re: Zend_Locale

Reply Threaded More More options
Print post
Permalink
Still havent figured this out anyone have a clue?



asagala wrote:
By the way you can set the locale string in the constructor. This works in the bootstrap file

                $locale = new Zend_Locale('en_US');
                Zend_Registry::set('Zend_Locale', $locale);

I get the issue when I try to overwrite the value in my controllers

asagala wrote:
That still doesnt work.

thomasW wrote:
According to manual the registry key 'Zend_Locale' has to be an instance of
Zend_Locale.
'fr_CA' may be a locale, but it's not an instance of Zend_Locale.

So when you want to change the application wide locale afterwards you need
to change the instance and not the registry content.

$locale = Zend_Registry::get('Zend_Locale');
$locale->setLocale('fr_CA');
Zend_Registry::set('Zend_Locale', $locale);

Because giving a string does not overwrite the content of the set instance.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com


----- Original Message -----
From: "asagala" <asagala@gmail.com>
To: <fw-general@lists.zend.com>
Sent: Friday, November 06, 2009 5:32 PM
Subject: Re: [fw-general] Zend_Locale


>
>
> Also tried this
> $locale = new Zend_Locale('fr_CA');
> Zend_Registry::set('Zend_Locale', 'fr_CA');
>
>
> asagala wrote:
>>
>> Hi,
>>
>> I am currently having an issue with Zend_Locale. I am initializing the
>> default in my bootstrap like this
>>
>> protected function _initLocale()
>> {
>> $locale = new Zend_Locale('en_US');
>> Zend_Registry::set('Zend_Locale', $locale);
>>
>>     return $locale;
>> }
>>
>> and this works fine. However when I try and change the value of the
>> locale
>> in my controllers the initial value is not overwritten. Here is how I am
>> writting the new value to the Zend_Locale key in my controllers
>>
>> Zend_Registry::set('Zend_Locale','fr_CA');
>>
>> Anyone have a clue?
>>
>
> --
> View this message in context:
> http://old.nabble.com/Zend_Locale-tp26230812p26230819.html
> Sent from the Zend Framework mailing list archive at Nabble.com.