From 41e3c95659e6b6d94e607e6613512d58960aa09f Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 10 Oct 2020 14:53:34 +0530 Subject: [PATCH 001/187] 29217: Fixed - Prefix and Suffix Translation --- .../Customer/Block/Address/Renderer/DefaultRenderer.php | 3 +++ app/code/Magento/Customer/Helper/View.php | 4 ++-- app/code/Magento/Customer/Model/Address/AbstractAddress.php | 4 ++-- app/code/Magento/Customer/Model/Options.php | 2 +- .../Customer/view/frontend/templates/widget/name.phtml | 4 ++-- app/code/Magento/Sales/Model/Order/Address.php | 4 ++-- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php index c10ff421b7f92..097d911300fd9 100644 --- a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php @@ -189,6 +189,9 @@ public function renderArray($addressAttributes, $format = null) $data[$key] = $v; } } + if(in_array($attributeCode,['prefix','suffix'])) { + $value = __($value); + } $data[$attributeCode] = $value; } } 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; } 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; } diff --git a/app/code/Magento/Customer/Model/Options.php b/app/code/Magento/Customer/Model/Options.php index 4c9b9f97ad43a..446fc35fefd40 100644 --- a/app/code/Magento/Customer/Model/Options.php +++ b/app/code/Magento/Customer/Model/Options.php @@ -101,7 +101,7 @@ private function prepareNamePrefixSuffixOptions($options, $isOptional = false) $result = []; $options = explode(';', $options); foreach ($options as $value) { - $result[] = $this->escaper->escapeHtml(trim($value)) ?: ' '; + $result[] = $this->escaper->escapeHtml(trim(__($value))) ?: ' '; } if ($isOptional && trim(current($options))) { diff --git a/app/code/Magento/Customer/view/frontend/templates/widget/name.phtml b/app/code/Magento/Customer/view/frontend/templates/widget/name.phtml index 00c1f124bd263..de07fd2ae8fb6 100644 --- a/app/code/Magento/Customer/view/frontend/templates/widget/name.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/widget/name.phtml @@ -48,7 +48,7 @@ $suffix = $block->showSuffix(); title="escapeHtmlAttr($block->getStoreLabel('prefix')) ?>" class="escapeHtmlAttr($block->getAttributeValidationClass('prefix')) ?>" isPrefixRequired() ? ' data-validate="{required:true}"' : '' ?> > getPrefixOptions() as $_option) : ?> - @@ -106,7 +106,7 @@ $suffix = $block->showSuffix(); title="escapeHtmlAttr($block->getStoreLabel('suffix')) ?>" class="escapeHtmlAttr($block->getAttributeValidationClass('suffix')) ?>" isSuffixRequired() ? ' data-validate="{required:true}"' : '' ?>> getSuffixOptions() as $_option) : ?> - diff --git a/app/code/Magento/Sales/Model/Order/Address.php b/app/code/Magento/Sales/Model/Order/Address.php index 0fd4555238ed5..f46f1369d3539 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; } From 94f9919d179a4a83522f5cc3354b42e2d2120eec Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 12 Oct 2020 17:44:05 +0530 Subject: [PATCH 002/187] added indentation --- .../Address/Renderer/DefaultRenderer.php | 5 ++-- .../view/frontend/templates/widget/name.phtml | 26 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php index 097d911300fd9..f88b23f75ee16 100644 --- a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php @@ -189,9 +189,8 @@ public function renderArray($addressAttributes, $format = null) $data[$key] = $v; } } - if(in_array($attributeCode,['prefix','suffix'])) { - $value = __($value); - } + if (in_array($attributeCode, ['prefix','suffix'])) + $value = __($value); $data[$attributeCode] = $value; } } diff --git a/app/code/Magento/Customer/view/frontend/templates/widget/name.phtml b/app/code/Magento/Customer/view/frontend/templates/widget/name.phtml index de07fd2ae8fb6..b94ddbf617b32 100644 --- a/app/code/Magento/Customer/view/frontend/templates/widget/name.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/widget/name.phtml @@ -24,7 +24,7 @@ $prefix = $block->showPrefix(); $middle = $block->showMiddlename(); $suffix = $block->showSuffix(); ?> -getNoWrap()) : ?> +getNoWrap()): ?>
@@ -32,23 +32,23 @@ $suffix = $block->showSuffix();
- +
- getPrefixOptions() === false) : ?> + getPrefixOptions() === false): ?> isPrefixRequired() ? ' data-validate="{required:true}"' : '' ?>> - + isSuffixRequired() ? ' data-validate="{required:true}"' : '' ?>> - + isPrefixRequired() ? ' data-validate="{required:true}"' : '' ?>> + class="input-text + escapeHtmlAttr($block->getAttributeValidationClass('prefix')) ?>" + isPrefixRequired() ? ' data-validate="{required:true}"' : '' ?>> getAttributeValidationClass('firstname') == 'required-entry') ? ' data-validate="{required:true}"' : '' ?>> + class="input-text + escapeHtmlAttr($block->getAttributeValidationClass('firstname')) ?>" + getAttributeValidationClass('firstname') == 'required-entry') ? ' + data-validate="{required:true}"' : '' ?>>
isMiddlenameRequired(); ?>
- +
> + class="input-text + escapeHtmlAttr($block->getAttributeValidationClass('middlename')) ?>" + >
- +
getAttributeValidationClass('lastname') == 'required-entry') ? ' data-validate="{required:true}"' : '' ?>> + class="input-text + escapeHtmlAttr($block->getAttributeValidationClass('lastname')) ?>" + getAttributeValidationClass('lastname') == 'required-entry') ? ' + data-validate="{required:true}"' : '' ?>>
- +
getSuffixOptions() === false): ?> isSuffixRequired() ? ' data-validate="{required:true}"' : '' ?>> + class="input-text + escapeHtmlAttr($block->getAttributeValidationClass('suffix')) ?>" + isSuffixRequired() ? ' data-validate="{required:true}"' : '' ?>> + attr="id: ++ko.uid"> + attr="for: ko.uid">