0

How to rewrite below code to fix version 2.0

$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);

//Dealing with uninitialized translator!
Mage::app()->getTranslator()->init('frontend', true);

Thank you.

1
  • Please create object in your controller for \Magento\Framework\TranslateInterface & access it. File path magento\vendor\magento\framework\TranslateInterface.php
    – Jackson
    Commented Dec 12, 2016 at 2:43

1 Answer 1

0
 /* * @var \Magento\Store\Model\App\Emulation $_appEmulation **/

$this->_appEmulation->startEnvironmentEmulation(
                                    $storeId, 
                                    \Magento\Framework\App\Area::AREA_FRONTEND
                                    );

Take a look more detail: vendor/magento/module-store/Model/App/Emulation.php

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.