5

I am override and added local en_US.csv file with below path

app/code/Magento/Customer/i18n with en_US.csv

Changed text "Force Sign-In" to "Force Login" and clear cache. The translation is not working.

Any help is highly appreciated.

Bhavin Pethani
  • 563
  • 2
  • 19

1 Answers1

1

Core Module translations will not be overridden in custom theme so you need to place the new translations in your custom module folder. Create an empty module or use your existing module.

Just Copy this file vendor\magento\module-customer\i18n\en_US.csv and paste it to any of your extension app\code\vendor\module\i18n

Alternate solutions

Create a sample module and override InvalidateTokenButton class,as below code

  1. Create file app/code/Stackexchange/MyTestModule/etc/di.xml

    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="\Magento\Customer\Block\Adminhtml\Edit\InvalidateTokenButton"
                type="\Stackexchange\MyTestModule\Block\Adminhtml\Edit\InvalidateTokenButton"/>
    </config>
    
  2. Create InvalidateTokenButton.php in app/code/Stackexchange/MyTestModule/Block/Adminhtml/Edit/InvalidateTokenButton.php

    <?php
    
    namespace Stackexchange\MyTestModule\Block\Adminhtml\Edit;
    
    
    class InvalidateTokenButton extends \Magento\Customer\Block\Adminhtml\Edit\InvalidateTokenButton
    {
    /**
     * Get button data.
     *
     * @return array
     */
    public function getButtonData()
    {
        $customerId = $this->getCustomerId();
        $data = [];
        if ($customerId) {
            $deleteConfirmMsg = __("Are you sure you want to revoke the customer's tokens?");
            $data = [
                'label' => __('Force Sign'),
                'class' => 'invalidate-token',
                'on_click' => 'deleteConfirm("' . $deleteConfirmMsg . '", "' . $this->getInvalidateTokenUrl() . '")',
                'sort_order' => 65,
                'aclResource' => 'Magento_Customer::invalidate_tokens',
            ];
        }
        return $data;
    }
    

    }

Supravat Mondal
  • 1,632
  • 1
  • 21
  • 29