0

I want to rename text "Sign in" to "Login" in my header top.

Please refer attached file.

enter image description here

0

You can override this Block in your custom module with getLabel() function.

vendor/magento/module-customer/Block/Account/AuthorizationLink.php

here

app/code/Vendor/Module/Block/Account/AuthorizationLink.php

Content for this file is..

<?php

namespace Vendor\Module\Block\Account;

class AuthorizationLink extends \Magento\Customer\Block\Account\AuthorizationLink
{
    public function getLabel()
    {
        return $this->isLoggedIn() ? __('Logout') : __('Login'); // Custom Labels
        // return $this->isLoggedIn() ? __('Sign Out') : __('Sign In'); // Default Magento labels
    }
}

Hope this will help you!

0

app\code\Vender\Module\view\frontend\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">
    <referenceBlock name="authorization-link-login">
                <action method="setTemplate">
                    <argument name="template" xsi:type="string">Vender_Module::authorization.phtml</argument>
                </action>
    </referenceBlock>
</page>

app\code\Vender\Module\view\frontend\templates\authorization.phtml

<?php
/** @var $block \Magento\Customer\Block\Account\AuthorizationLink */
$dataPostParam = '';
$customClass = "demo-login";
if ($block->isLoggedIn()) {
    $dataPostParam = sprintf(" data-post='%s'", $block->getPostParams());
    $customClass = "logoutajax";
}
?>
<li class="authorization-link" data-label="<?php echo $block->escapeHtml(__('or')); ?>">
    <a <?php /* @escapeNotVerified */ echo $block->getLinkAttributes(); ?><?php /* @escapeNotVerified */ echo $dataPostParam; ?> class="<?php echo $customClass ?>">
        <?php echo $block->escapeHtml($block->getLabel());
        ?>
    </a>
</li>

I hope this will help you!!!!

0

Have you tried using the translation csv? https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/translations/translate_practice.html

  • I tried this but not working. – Priya Oct 21 at 4:34
0

The simple way is to add default text with your text into app/design/frontend/Custom/default/i18n/en_US.csv

like

"Sign In","Login"

clear cache after that

php bin/magento cache:clean && php bin/magento cache:flush
  • i tried above method, but still showing "Sign In" in top header – Priya Oct 21 at 10:13
  • try to static content deploy(s:s:d) command – Rk Rathod Oct 21 at 10:22
  • i tried. but doesn't change any thing – Priya Oct 21 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.