Bug: the dropdown «Page Layout» on admin category page is untranslatable (and my fix)

localization
bug-fix
layouts-xml

(Dmitry Fedyuk) #1

The dropdown «Page Layout» on admin category page is untranslatable due to Magento 2 core bug:

The options are defined in

The wrong code is:

It totally ignores translate attribute of label tag.
My fix is replace the wrong line with the code:

/** @var string $label */
$label = trim($layout->nodeValue);
if ('true' === (string)simplexml_import_dom($layout)->{'label'}['translate']) {
	$label = __($label);
}
$result[$layout->getAttribute('id')] = $label;