Yii Framework Forum: Property "ProductController._locale" is not defined. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Property "ProductController._locale" is not defined. How to fix thix? Rate Topic: -----

#1 User is offline   MarcS 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 96
  • Joined: 05-July 09

Posted 27 July 2009 - 01:11 PM

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?
0

#2 User is offline   mbi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 604
  • Joined: 08-May 09

Posted 27 July 2009 - 01:27 PM

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'

?
0

#3 User is offline   MarcS 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 96
  • Joined: 05-July 09

Posted 27 July 2009 - 01:30 PM

View Postmbi, on 27 July 2009 - 01:27 PM, said:

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
0

#4 User is offline   knut 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 45
  • Joined: 10-October 08
  • Location:Notodden, NORWAY

Posted 27 July 2009 - 04:46 PM

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.
0

#5 User is offline   MarcS 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 96
  • Joined: 05-July 09

Posted 27 July 2009 - 04:51 PM

View Postknut, on 27 July 2009 - 04:46 PM, said:

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
0

#6 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,875
  • Joined: 04-October 08
  • Location:DC, USA

Posted 29 July 2009 - 04:18 PM

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

#7 User is offline   MarcS 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 96
  • Joined: 05-July 09

Posted 29 July 2009 - 04:27 PM

View Postqiang, on 29 July 2009 - 04:18 PM, said:

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
thanks
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users