Property "ProductController._locale" is not defined.

Hi everyone

I’m trying to use the number formater and I’m getting the following exception:

Property "ProductController._locale" is not defined.

how can I set this?

the constructor of numberformatter needs a locale id.

dont know, what about simply add a

public $_locale = 'de_DE';

or instantiate the numberformatter with ‘de_DE’


I figured that this is something that ought to be some sort of a global (session) setting somewhere so it doesn’t have to be set manually all the time

As long as you have defined source language with CApplication::sourceLanguage and default locale with CApplication::language in your application config file you should be fine.

I’m having this

‘language’ => ‘en’,

‘sourceLanguage’ => ‘en’,

in my main.php config file and I’m getting the error

You should use Yii::app()->numberFomatter rather than $this->numberFormatter (assuming $this refers to your controller).

thanks qiang

It’s really obvious actually … no idea why I did it wrong in the first place