Magento 2货币符号未显示

时间:2016-12-20 08:12:54

标签: magento2

我有2家商店英语和阿拉伯语。默认存储为阿拉伯语,默认货币为SAR。货币符号在英语商店中显示正常但在阿拉伯商店的任何地方都没有显示。它只显示产品列表页面和单个产品页面上的44这样的价格。

3 个答案:

答案 0 :(得分:1)

我修好了。 发布我的回答可能是它可以帮助某人。

编辑此文件。

vendor\magento\zendframework1\library\Zend\Locale\Data\ar_SA.xml

并删除以下代码。

<numbers>
<currencyFormats numberSystem="latn">
<currencyFormatLength>
<currencyFormat type="standard">
<pattern>¤#0.00</pattern>
</currencyFormat>
</currencyFormatLength>
</currencyFormats>
</numbers>

更新的答案========

我得到了更好的解决方案,而不是编辑核心文件,你可以用观察者来做。

供应商/模块的/ etc / events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="currency_display_options_forming">
        <observer name="change_currency_position" instance="Vendor\Module\Model\Observer\ChangeCurrencyPosition" />
    </event>
</config>

和观察者文件。

use Magento\Framework\Event\ObserverInterface;
class ChangeCurrencyPosition implements ObserverInterface
{
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $currencyOptions = $observer->getEvent()->getCurrencyOptions();
        $currencyOptions->setData('position', \Magento\Framework\Currency::RIGHT);
        return $this;
    }
}

需要将'位置'更改为右。

答案 1 :(得分:0)

如果@ Ask4Tec的解决方案无效

试试这个

从en.xml文件复制货币和数字块并将其粘贴到ar_SA.xml文件中 清理并刷新缓存 硬刷新后检查

答案 2 :(得分:0)

更新ar_SA.xml,如下所示:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd">
<!-- Copyright © 1991-2013 Unicode, Inc.
CLDR data files are interpreted according to the LDML specification (http://unicode.org/reports/tr35/)
For terms of use, see http://www.unicode.org/copyright.html
-->
<ldml>
    <identity>
        <version number="$Revision: 9287 $"/>
        <generation date="$Date: 2013-08-28 21:32:04 -0500 (Wed, 28 Aug 2013) $"/>
        <language type="ar"/>
        <territory type="SA"/>
    </identity>
    <dates>
        <calendars>
            <calendar type="islamic">
                <dateTimeFormats>
                    <availableFormats>
                        <dateFormatItem id="Md" draft="contributed">M/d</dateFormatItem>
                        <dateFormatItem id="MEd" draft="contributed">E, M/d</dateFormatItem>
                        <dateFormatItem id="MMMd" draft="contributed">MMM d</dateFormatItem>
                        <dateFormatItem id="MMMEd" draft="contributed">E, MMM d</dateFormatItem>
                    </availableFormats>
                </dateTimeFormats>
            </calendar>
        </calendars>
    </dates>
    <numbers>
        <symbols numberSystem="latn">
            <decimal>.</decimal>
            <group>,</group>
            <list>;</list>
            <percentSign>%</percentSign>
            <plusSign>+</plusSign>
            <minusSign>-</minusSign>
            <exponential>E</exponential>
            <superscriptingExponent>×</superscriptingExponent>
            <perMille>‰</perMille>
            <infinity>∞</infinity>
            <nan>NaN</nan>
        </symbols>
        <decimalFormats numberSystem="latn">
            <decimalFormatLength>
                <decimalFormat>
                    <pattern>#,##0.###</pattern>
                </decimalFormat>
            </decimalFormatLength>
        </decimalFormats>
        <currencyFormats numberSystem="latn">
            <currencyFormatLength>
                <currencyFormat type="standard">
                    <pattern>¤#,##0.00</pattern>
                </currencyFormat>
                <currencyFormat type="accounting">
                    <pattern>¤#,##0.00;(¤#,##0.00)</pattern>
                </currencyFormat>
            </currencyFormatLength>
            <unitPattern count="one">{0} {1}</unitPattern>
            <unitPattern count="other">{0} {1}</unitPattern>
        </currencyFormats>
        <currencies>
            <currency type="USD">
                <displayName>US Dollar</displayName>
                <displayName count="one">US dollar</displayName>
                <displayName count="other">US dollars</displayName>
                <symbol>$</symbol>
            </currency>
        </currencies>
    </numbers>
</ldml>
相关问题