【发布时间】:2011-10-10 11:57:24
【问题描述】:
我打算用magento写一个常见问题和一个最适合我的解决方案。
我已经在网上搜索并反映了几个小时的 magento 代码,以找到上述问题的解决方案。我希望匈牙利价格格式为 1 000 Ft 而不是 1 000,00 Ft
我已将值'precision' 替换为0,但没有成功。
这是我探索的列表:
-
app/code/core/Mage/Core/Model/Store.php
function formatPrice(){ $option = array('precison' => 2 ); ... } -
app/code/core/Mage/Directory/Model/Currency.php
function format() { $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets); }
在反映了代码之后,我意识到这一切的改变根本无关紧要,因为数字格式信息是基于 Zend 核心 API 提供的 locale 信息。
这是我找到的解决方案,希望价格格式将成为整个应用程序的标准。
您可以在 lib/Zend/Locale/Data/ 中找到您的 YY.xml 文件,其中 YY 是您所在国家/地区的语言环境代码。我的是 hu.xml
你找到了零件:
<currencyFormats>
<currencyFormatLength>
<currencyFormat>
<pattern>#,##0 ¤</pattern>
</currencyFormat>
</currencyFormatLength>
<unitPattern count="other">{0} {1}</unitPattern>
</currencyFormats>
关于格式字符串,您可以在http://framework.zend.com/manual/en/zend.locale.parsing.html找到一个完全没有用的信息
【问题讨论】:
-
格式字符串链接失效
标签: magento localization locale precision number-formatting