diff --git a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php index c10ff421b7f92..3282157f8948c 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..a994097e071d3 100644 --- a/app/code/Magento/Customer/Helper/View.php +++ b/app/code/Magento/Customer/Helper/View.php @@ -34,14 +34,14 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ 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..c725665547721 100644 --- a/app/code/Magento/Customer/view/frontend/templates/widget/name.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/widget/name.phtml @@ -24,31 +24,40 @@ $prefix = $block->showPrefix(); $middle = $block->showMiddlename(); $suffix = $block->showSuffix(); ?> -getNoWrap()) : ?> +getNoWrap()): ?>
- +
- +
- +
- getPrefixOptions() === false) : ?> + getPrefixOptions() === false): ?> 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) : ?> + getSuffixOptions() === false): ?> isSuffixRequired() ? ' data-validate="{required:true}"' : '' ?>> - + class="input-text + escapeHtmlAttr($block->getAttributeValidationClass('suffix')) ?>" + isSuffixRequired() ? ' data-validate="{required:true}"' : '' ?>> +