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.

7
  • You cannot create Magento/Customer extension inside code folder. Please create custom extension with your company and module name - mageplaza.com/magento-2-module-development And place the i18n folder inside your module Dec 25, 2019 at 9:00
  • I need to translate "Force Sign-In" button in magento admin customer section. Jan 9, 2020 at 6:23
  • @BhavinPethani you have checked admin language en_US or en_GB Jan 10, 2020 at 4:50
  • @RakeshDonga Let me try and update you. Jan 12, 2020 at 4:45
  • @BhavinPethani you have checked? Jan 13, 2020 at 5:47

1 Answer 1

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;
    }
    

    }

3
  • Using custom module translation is working for website front-end, but translation is not working for magento back-end text (admin penal) Dec 25, 2019 at 9:18
  • Check once with my given answer Dec 25, 2019 at 9:20
  • I am already try that using custom module, but it's not working for magento admin text translation. Dec 25, 2019 at 9:27

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.