I was created simple custom module in magento 2.1. And it's working fine in magento 2.1.9.
But today I tried to installe in magento 2.2 and it's shows this error:
1 exception(s): Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'item', attribute 'translate': The attribute 'translate' is not allowed. Line: 1920
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'item', attribute 'translate': The attribute 'translate' is not allowed. Line: 1920
Here is file where generate this error
<referenceBlock name="checkout.root">
 <arguments>
 ...
 ...
 <item name="fee" xsi:type="array">
 <item name="component" xsi:type="string">Vendor_Module/js/view/checkout/cart/totals/myfile</item>
 <item name="config" xsi:type="array">
 <item name="title" xsi:type="helper" translate="true" helper="Vendor\Module\Helper\Data::getCustomText"/>
 </item>
 </item>
 ...
 ... 
 </arguments>
</referenceBlock>
1 Answer 1
You are not allowed to use translate attributes for <item> nodes that have xsi:type anything else other than string.
Just remove translate="true" from this line 
<item name="title" xsi:type="helper" translate="true" helper="Vendor\Module\Helper\Data::getCustomText"/>
- 
 Thanks for replay. It's working if I remove translate="true". But it's working translation in multilanguage?Rahul– Rahul2017年11月03日 11:01:21 +00:00Commented Nov 3, 2017 at 11:01
- 
 you should include the translation in your helper class. So this line of xml just returns the result ofVendor\Module\Helper\Data::getCustomText. use__('Text here')inside yourgetCustomTextmethod and the text will be translated without the need of thetranslatetag,Marius– Marius2017年11月03日 12:07:35 +00:00Commented Nov 3, 2017 at 12:07