Is this a magento bug or is something I am doing it working

I had created my translation file in my module i18n. For testing purpose I just modified few text.


"Do you want to remove the item from cart?","Just Remove?"
"Login","Sign In"

In My JS File I have this piece of code which I need to translate

        deleteItem: function (data) {
            var self = this;
                content: $t('Do you want to remove the item from cart?'),
                actions: {
                    confirm: function () {
                    always: function (event) {


But the translation for the code does not work. When I deploy static content it does not adds the translation in js-translation.json file.

Does any one have a workaround?


2 Answers 2


It may be due to Magento bug. In vendor/magento/module-translation/Model/Json/PreProcessor.php

$area = $this->areaList->getArea($areaCode);

needs to be:

$area = $this->areaList->getArea($areaCode);



Please clear cache and check while cleaning cache it will flush translate cache as well. In Magento 2 there is mage/translate js library and that you can require in your js and use it like

$.mage.__("your text here");

You will get translated text.

  • yes mage/translate has already been defined and I have tried clearing cache and re deploy static content. But my JS translation does not appears in pub/static/js-translation.json file.
    – Priyank
    Dec 28, 2017 at 5:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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