0

There are plain strings i.e. in view/adminhtml/ui_component/product_listing.xml and I am wondering how they get translated into other languages.
Also what is the correct way of using translations in PHP code (Blocks, Models etc.) or template files? In Magento 1 it was like $this->__('asd');.

1

The correct way to use the translation is __('text here'). Simple as that. no $this or any other object. Just __ function.
the fact that you see plain texts in xml files should not be a problem.
the xml files are used by at least one php script. And the php script knows the structure of the xml files including what needs to be translated or not.

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.