I want to rename text "Sign in" to "Login" in my header top.
Please refer attached file.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityYou 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!
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!!!!
Have you tried using the translation csv? https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/translations/translate_practice.html
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
You can use the Translate Inline tool: