【问题标题】:Change 'Create an Account' text on header.links?更改 header.links 上的“创建帐户”文本?
【发布时间】:2016-06-10 06:45:33
【问题描述】:

想将“创建帐户”文本更改为“注册”,并在文本前添加一个图像标签,但我无法通过以下修改来更新文本 Magento_Customer/layout/default.xml em>。

<referenceBlock name="register-link">
    <arguments>
        <argument name="label" xsi:type="string" translate="true">Register</argument>
    </arguments>
</referenceBlock>
<referenceBlock name="my-account-link" display="false" />
    <!--
    <move element="register-link" destination="header.links"/>
    <move element="header" destination="header.links" before="-"/>
    <move element="top.links" destination="customer"/>
    <move element="authorization-link" destination="top.links" after="-"/>
    -->


    <block
        class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link"
        template="account/link/authorization.phtml" before="register-link"/>
</referenceBlock>
<block class="Magento\Theme\Block\Html\Header" name="header" as="header">
    <!--
    <arguments>
        <argument name="show_part" xsi:type="string">welcome</argument>
    </arguments>
    -->
</block> 

我有什么错?

【问题讨论】:

    标签: layout magento2


    【解决方案1】:
    <referenceBlock name="register-link">
    <arguments>
    <argument name="label" xsi:type="string" translate="true">Register</argument></arguments>
    </referenceBlock>
    

    将以上代码放入/app/design/frontend/vendor/module/Magento_Theme/layout/default.xml

    刷新 Magento 缓存...

    【讨论】:

    • 应该使用什么名称参数来更改登录文本?
    • @Moax6629 请查看此 StackExchange 解决方案以将 Sign In 文本更改为 Register,因为它使用主题 i18n csv 文件:magento.stackexchange.com/a/251065/6014
    【解决方案2】:

    转到 app/design/frontend/vendor/module/Magento_Theme/layout/default.xml

    并放在下面的代码

    <?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <body>
            <referenceBlock name="register-link">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">Register</argument>
                </arguments>
            </referenceBlock>
        </body>
    </page>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-31
      • 2011-04-13
      • 1970-01-01
      • 1970-01-01
      • 2014-05-09
      • 2013-02-16
      • 1970-01-01
      • 2014-06-27
      相关资源
      最近更新 更多