From c978cfbeba55bfccaaa2b62b174816501ec5d879 Mon Sep 17 00:00:00 2001 From: Jitendra Kumar Singh Date: Sat, 10 Oct 2020 14:26:47 +0530 Subject: [PATCH 1/6] Fix #29217 Fix prefix & suffix translation --- app/code/Magento/Customer/Helper/View.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Customer/Helper/View.php b/app/code/Magento/Customer/Helper/View.php index a47930abb6d0e..4fcb9cf7552f4 100644 --- a/app/code/Magento/Customer/Helper/View.php +++ b/app/code/Magento/Customer/Helper/View.php @@ -41,7 +41,7 @@ public function getCustomerName(CustomerInterface $customerData) $name = ''; $prefixMetadata = $this->_customerMetadataService->getAttributeMetadata('prefix'); if ($prefixMetadata->isVisible() && $customerData->getPrefix()) { - $name .= $customerData->getPrefix() . ' '; + $name .= __($customerData->getPrefix()) . ' '; } $name .= $customerData->getFirstname(); @@ -55,7 +55,7 @@ public function getCustomerName(CustomerInterface $customerData) $suffixMetadata = $this->_customerMetadataService->getAttributeMetadata('suffix'); if ($suffixMetadata->isVisible() && $customerData->getSuffix()) { - $name .= ' ' . $customerData->getSuffix(); + $name .= ' ' . __($customerData->getSuffix()); } return $name; } From 4346a5840cd99b006a0f63bfc1d4f86f46ff01d9 Mon Sep 17 00:00:00 2001 From: Jitendra Kumar Singh Date: Sat, 10 Oct 2020 14:32:11 +0530 Subject: [PATCH 2/6] Fix #29217 Fix #29217 --- .../Magento/Customer/Block/Address/Renderer/DefaultRenderer.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php index c10ff421b7f92..949e5e0a08f51 100644 --- a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php @@ -189,6 +189,8 @@ public function renderArray($addressAttributes, $format = null) $data[$key] = $v; } } + if (in_array($attributeCode, ['prefix', 'suffix'])) + $value = __($value); $data[$attributeCode] = $value; } } From 7fe920b64af5bf956e32ab1899b97cbf371ef04a Mon Sep 17 00:00:00 2001 From: Jitendra Kumar Singh Date: Sat, 10 Oct 2020 14:35:09 +0530 Subject: [PATCH 3/6] Fix #29217 --- app/code/Magento/Customer/Model/Options.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Model/Options.php b/app/code/Magento/Customer/Model/Options.php index 4c9b9f97ad43a..3f2fa1bb5cf9d 100644 --- a/app/code/Magento/Customer/Model/Options.php +++ b/app/code/Magento/Customer/Model/Options.php @@ -101,7 +101,8 @@ private function prepareNamePrefixSuffixOptions($options, $isOptional = false) $result = []; $options = explode(';', $options); foreach ($options as $value) { - $result[] = $this->escaper->escapeHtml(trim($value)) ?: ' '; + $value = $this->escaper->escapeHtml(trim($value)) ?: ' '; + $result[] = __($value); } if ($isOptional && trim(current($options))) { From 306b65357a103ae943329b14195d75f7c619c272 Mon Sep 17 00:00:00 2001 From: Jitendra Kumar Singh Date: Sat, 10 Oct 2020 14:37:46 +0530 Subject: [PATCH 4/6] fix #29217 --- app/code/Magento/Customer/Model/Address/AbstractAddress.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Customer/Model/Address/AbstractAddress.php b/app/code/Magento/Customer/Model/Address/AbstractAddress.php index 8421fc92f8c4a..9d7465f8ed5bf 100644 --- a/app/code/Magento/Customer/Model/Address/AbstractAddress.php +++ b/app/code/Magento/Customer/Model/Address/AbstractAddress.php @@ -194,7 +194,7 @@ public function getName() { $name = ''; if ($this->_eavConfig->getAttribute('customer_address', 'prefix')->getIsVisible() && $this->getPrefix()) { - $name .= $this->getPrefix() . ' '; + $name .= __($this->getPrefix()) . ' '; } $name .= $this->getFirstname(); $middleName = $this->_eavConfig->getAttribute('customer_address', 'middlename'); @@ -203,7 +203,7 @@ public function getName() } $name .= ' ' . $this->getLastname(); if ($this->_eavConfig->getAttribute('customer_address', 'suffix')->getIsVisible() && $this->getSuffix()) { - $name .= ' ' . $this->getSuffix(); + $name .= ' ' . __($this->getSuffix()); } return $name; } From bb2a46342fea9df1cdc95d38c6c984b36a85d89a Mon Sep 17 00:00:00 2001 From: Jitendra Kumar Singh Date: Sat, 10 Oct 2020 14:41:56 +0530 Subject: [PATCH 5/6] Fix #29217 --- app/code/Magento/Sales/Model/Order/Address.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Address.php b/app/code/Magento/Sales/Model/Order/Address.php index 0fd4555238ed5..90b4f02352414 100644 --- a/app/code/Magento/Sales/Model/Order/Address.php +++ b/app/code/Magento/Sales/Model/Order/Address.php @@ -142,7 +142,7 @@ public function getName() { $name = ''; if ($this->getPrefix()) { - $name .= $this->getPrefix() . ' '; + $name .= __($this->getPrefix()) . ' '; } $name .= $this->getFirstname(); if ($this->getMiddlename()) { @@ -150,7 +150,7 @@ public function getName() } $name .= ' ' . $this->getLastname(); if ($this->getSuffix()) { - $name .= ' ' . $this->getSuffix(); + $name .= ' ' . __($this->getSuffix()); } return $name; } @@ -412,7 +412,7 @@ public function getPostcode() * Returns prefix * * @return string - */ + */n public function getPrefix() { return $this->getData(OrderAddressInterface::PREFIX); @@ -465,7 +465,7 @@ public function getTelephone() */ public function getVatId() { - return $this->getData(OrderAddressInterface::VAT_ID); + return $this->getData(OrderAddressInterface::VAT_ID);n } /** @@ -521,7 +521,7 @@ public function setParentId($id) */ public function setCustomerAddressId($id) { - return $this->setData(OrderAddressInterface::CUSTOMER_ADDRESS_ID, $id); + return $this->setData(OrderAddressInterface::CUSTOMER_ADDRESS_ID, $id);n } /** @@ -593,7 +593,7 @@ public function setCity($city) */ public function setEmail($email) { - return $this->setData(OrderAddressInterface::EMAIL, $email); + return $this->setData(OrderAddressInterface::EMAIL, $email);n } /** @@ -666,7 +666,7 @@ public function setCompany($company) public function setVatId($id) { return $this->setData(OrderAddressInterface::VAT_ID, $id); - } + }n /** * @inheritdoc @@ -728,7 +728,7 @@ public function getExtensionAttributes() public function setExtensionAttributes(\Magento\Sales\Api\Data\OrderAddressExtensionInterface $extensionAttributes) { return $this->_setExtensionAttributes($extensionAttributes); - } + }n /** * @inheritdoc From 3b5726232f8b5ed187a97f7e4dd4c6376e839c15 Mon Sep 17 00:00:00 2001 From: Jitendra Kumar Singh Date: Sat, 10 Oct 2020 14:59:19 +0530 Subject: [PATCH 6/6] fix #29217 & updated my commit --- app/code/Magento/Sales/Model/Order/Address.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Address.php b/app/code/Magento/Sales/Model/Order/Address.php index 90b4f02352414..f46f1369d3539 100644 --- a/app/code/Magento/Sales/Model/Order/Address.php +++ b/app/code/Magento/Sales/Model/Order/Address.php @@ -412,7 +412,7 @@ public function getPostcode() * Returns prefix * * @return string - */n + */ public function getPrefix() { return $this->getData(OrderAddressInterface::PREFIX); @@ -465,7 +465,7 @@ public function getTelephone() */ public function getVatId() { - return $this->getData(OrderAddressInterface::VAT_ID);n + return $this->getData(OrderAddressInterface::VAT_ID); } /** @@ -521,7 +521,7 @@ public function setParentId($id) */ public function setCustomerAddressId($id) { - return $this->setData(OrderAddressInterface::CUSTOMER_ADDRESS_ID, $id);n + return $this->setData(OrderAddressInterface::CUSTOMER_ADDRESS_ID, $id); } /** @@ -593,7 +593,7 @@ public function setCity($city) */ public function setEmail($email) { - return $this->setData(OrderAddressInterface::EMAIL, $email);n + return $this->setData(OrderAddressInterface::EMAIL, $email); } /** @@ -666,7 +666,7 @@ public function setCompany($company) public function setVatId($id) { return $this->setData(OrderAddressInterface::VAT_ID, $id); - }n + } /** * @inheritdoc @@ -728,7 +728,7 @@ public function getExtensionAttributes() public function setExtensionAttributes(\Magento\Sales\Api\Data\OrderAddressExtensionInterface $extensionAttributes) { return $this->_setExtensionAttributes($extensionAttributes); - }n + } /** * @inheritdoc