0

When I add translate="true" to my XML declarations of my own custom module, will Magento translate them automagically (given that I have the proper i18n CSV files for this)? Or is it only served as a flag for the bin/magento i18n:collect-phrases-command?

For example: I have the following XML file:

<type name="Example\Foo\Model\Foo">
    <arguments>
        <argument name="stuff" xsi:type="array">
            <item name="hello" xsi:type="string" translate="true">Hello World!</item>
        </argument>
    </arguments>
</type>

And the following class:

namespace Example\Foo\Model;

class Foo {
    public function __construct(array $stuff = [])
    {
        var_dump($stuff);
    }
}

Will $stuff['hello'] contain the translated string? Or do I still need to implement my own translation logic and is translate="true" merely a flag used by the collect-phrases-command?

1

If you have proper i18n then you should set true for translate attribute in XML, (translate="true") else always set false.

  • This doesn't really answer my question. My question is: Does translate="true" automatically translate the string for me, or is it merely a flag used by the collect-phrases-scraper? – Giel Berkers Jun 23 '17 at 7:33
  • 1
    No, it will not translate automatically – Mohammad Rashid Hussain Jun 24 '17 at 15:58

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.