Define 'currencyFormat' in config file

The current version does not seem to have any way to define a global currency format, instead, we have to define it every time a piece of currency is outputted.

I believe it would make sense to define the locale once in the config file, then all other locale-related functions will automatically convert based on that defined locale.

Try this formatCurrency

That works, but you have to define the type of currency on every instance you use it.

You can extend CNumberFormatter and modify this method.

Alright I can do that.

I believe this should be put into consideration for future Yii releases. As I said before, if you are going to display the language in en_US, you will probably want the currency defined there as well.

Hi,

I’ve tried to extend CNumberFormatter but i did not succeded :(

Perhaps can’t be extended as a common component?

Did you successfuly extended CNumberFormatter?

How?,

Where?

When?

Hi Chuntley,

Yes, CNumberFormatter may be tricky to extend - cause of private properties, though I needed not formatCurrency() updates.

I’m extending CNumberFormatter putting NumberFormatter class to components directory and having probably all the parent class code copied into a child. It’s kinda ugly solution, but I couldn’t find the better one for my needs yet.