This is long-term issue from Magento 1.x and still is in Magento 2.
Surely, you can translate product attribute labels manually by editing attributes: typing new labels and saving them to Magento database.
But it is inconvenient because:
- you must do it manullay for each new Magento installation and for each of 43 standard product attributes: a lot of work!
- attribute labels will not react to the current admin locale.
The bug is similar to 73
My fix (with 3 plugins)
Plugin №1
See 73
Plugin №2
<type name='\Magento\Eav\Model\Resource\Entity\Attribute'>
<plugin
name='Df\Eav\Model\Resource\Entity\AttributePlugin'
type='Df\Eav\Model\Resource\Entity\AttributePlugin'
sortOrder='100'
/>
</type>
namespace Df\Eav\Model\Resource\Entity;
use Magento\Eav\Model\Resource\Entity\Attribute;
class AttributePlugin {
/**
* @see Attribute::load()
* @param Attribute $subject
* @param \Closure $proceed
* @param \Magento\Eav\Model\Entity\Attribute $object
* @param mixed $value
* @param string|null $field [optional]
* @return Attribute
*/
public function aroundLoad(
Attribute $subject
, \Closure $proceed
, \Magento\Eav\Model\Entity\Attribute $object
, $value
, $field = null
) {
$proceed($object, $value, $field);
$object['frontend_label'] = __($object['frontend_label']);
return $subject;
}
}
Plugin №3
<type name='\Magento\Eav\Model\Resource\Entity\Attribute\Collection'>
<plugin
name='Df\Eav\Model\Resource\Entity\Attribute\CollectionPlugin'
type='Df\Eav\Model\Resource\Entity\Attribute\CollectionPlugin'
sortOrder='100'
/>
</type>
namespace Df\Eav\Model\Resource\Entity\Attribute;
use \Magento\Eav\Model\Entity\Attribute;
use \Magento\Eav\Model\Resource\Entity\Attribute\Collection;
class CollectionPlugin {
/**
* @param Collection $subject
* @param Attribute $item
* @return array(Attribute)
*/
public function beforeAddItem(Collection $subject, Attribute $item) {
$item['frontend_label'] = __($item['frontend_label']);
return [$item];
}
}
So now the product attributes are translatable:
GitHub issue: 1983