Skip to content

Commit fbe667e

Browse files
committed
Translate attribute label with default translation helper function
Adds the translation function to customer attribute labels in Magento admin. This gives a chance to translate a label in the locale of a backend user.
1 parent 14eeea2 commit fbe667e

File tree

2 files changed

+8
-8
lines changed
  • app/code/Magento/Catalog
    • Test/Unit/Ui/DataProvider/Product/Form/Modifier
    • Ui/DataProvider/Product/Form/Modifier

2 files changed

+8
-8
lines changed

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class EavTest extends AbstractModifierTest
187187
* @var ObjectManager
188188
*/
189189
protected $objectManager;
190-
190+
191191
/**
192192
* @var Eav
193193
*/
@@ -324,7 +324,7 @@ protected function setUp()
324324
$this->eavAttributeMock->expects($this->any())
325325
->method('load')
326326
->willReturnSelf();
327-
327+
328328
$this->eav =$this->getModel();
329329
$this->objectManager->setBackwardCompatibleProperty(
330330
$this->eav,
@@ -561,7 +561,7 @@ private function defaultNullProdNotNewAndRequired()
561561
'required' => true,
562562
'notice' => null,
563563
'default' => null,
564-
'label' => null,
564+
'label' => new Phrase(''),
565565
'code' => 'code',
566566
'source' => 'product-details',
567567
'scopeLabel' => '',
@@ -588,7 +588,7 @@ private function defaultNullProdNotNewAndNotRequired()
588588
'required' => false,
589589
'notice' => null,
590590
'default' => null,
591-
'label' => null,
591+
'label' => new Phrase(''),
592592
'code' => 'code',
593593
'source' => 'product-details',
594594
'scopeLabel' => '',
@@ -615,7 +615,7 @@ private function defaultNullProdNewAndNotRequired()
615615
'required' => false,
616616
'notice' => null,
617617
'default' => 'required_value',
618-
'label' => null,
618+
'label' => new Phrase(''),
619619
'code' => 'code',
620620
'source' => 'product-details',
621621
'scopeLabel' => '',
@@ -642,7 +642,7 @@ private function defaultNullProdNewAndRequired()
642642
'required' => false,
643643
'notice' => null,
644644
'default' => 'required_value',
645-
'label' => null,
645+
'label' => new Phrase(''),
646646
'code' => 'code',
647647
'source' => 'product-details',
648648
'scopeLabel' => '',
@@ -669,7 +669,7 @@ private function defaultNullProdNewAndRequiredAndFilledNotice()
669669
'required' => false,
670670
'notice' => __('example notice'),
671671
'default' => 'required_value',
672-
'label' => null,
672+
'label' => new Phrase(''),
673673
'code' => 'code',
674674
'source' => 'product-details',
675675
'scopeLabel' => '',

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ public function setupAttributeMeta(ProductAttributeInterface $attribute, $groupC
580580
'required' => $attribute->getIsRequired(),
581581
'notice' => $attribute->getNote() === null ? null : __($attribute->getNote()),
582582
'default' => (!$this->isProductExists()) ? $attribute->getDefaultValue() : null,
583-
'label' => $attribute->getDefaultFrontendLabel(),
583+
'label' => __($attribute->getDefaultFrontendLabel()),
584584
'code' => $attribute->getAttributeCode(),
585585
'source' => $groupCode,
586586
'scopeLabel' => $this->getScopeLabel($attribute),

0 commit comments

Comments
 (0)