开发者

PHP > Zend Framework > Zend_Money

I've used Zend_Money to format currency as follow

$currency = new Zend_Currency(array('value' => $mon开发者_如何学运维ey,
                                    'currency' => 'CAN', 
                                    'format' => 'fr'));

// output -> 100,00 $

Which display normally on my local development system (wamp on windows)

But when i put it online on my testing server (apache on windows (not my choice and i can't change it :( ), the code output becomes

// output -> 100,00 €

I would like to know if someone has ever encountered such issue and where i need to look to find the solution

Thanks


Zend_Currency is locale aware. Try to pass in 'locale' => 'fr' to see if it makes a difference:

locale: Defines a locale for this currency. It will be used for detecting the default values when other settings are omitted. Note that when you don't set a locale yourself, it will be detected automatically which could lead to problems.


Thanks a lot it goes in the same direction as the solution I choose. I've put a new key in my config file

variable.locale = "fr_CA"

Which is then initiated in the bootstrap as the global locale for the whole application

protected function _initLocale(){
    $variables = Zend_Registry::get('config')->variable;
    $locale = new Zend_Locale($variables->locale);
    Zend_Registry::set('Zend_Locale', $locale);
}

I already have a config key initiated from a previous method in the bootstrap

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜