From b16415d2c628381de1efb51f3d4ac86a975c96b3 Mon Sep 17 00:00:00 2001 From: Martina Lindenhofer <68067510+MLindenhofer@users.noreply.github.com> Date: Mon, 23 Oct 2023 13:26:14 +0200 Subject: [PATCH] Update AddressBook.php - Fix as $this->addresstype only returns the hardcoded string in english language. There is now a variable which holds the translated string for each type --- src/Checkout/Component/AddressBook.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Checkout/Component/AddressBook.php b/src/Checkout/Component/AddressBook.php index 3915f774..7294191b 100644 --- a/src/Checkout/Component/AddressBook.php +++ b/src/Checkout/Component/AddressBook.php @@ -72,10 +72,19 @@ public function getExistingAddressFields() $member = Security::getCurrentUser(); if ($member && $member->AddressBook()->exists()) { $addressoptions = $member->AddressBook()->sort('Created', 'DESC')->map('ID', 'toString')->toArray(); - $addressoptions['newaddress'] = _t('SilverShop\Model\Address.CreateNewAddress', 'Create new {AddressType} address', '', ["AddressType" => $this->addresstype]); + + $translatedAddressType = $this->addresstype; + if ($this->addresstype === 'Billing'){ + $translatedAddressType = _t('SilverShop\Model\Address.BillingAddress', $this->addresstype); + } + if ($this->addresstype === 'Shipping'){ + $translatedAddressType = _t('SilverShop\Model\Address.ShippingAddress', $this->addresstype); + } + + $addressoptions['newaddress'] = _t('SilverShop\Model\Address.CreateNewAddress', 'Create new {AddressType} address', '', ["AddressType" => $translatedAddressType]); $fieldtype = count($addressoptions) > 3 ? DropdownField::class : OptionsetField::class; - $label = _t("SilverShop\Model\Address.Existing{$this->addresstype}Address", "Existing {$this->addresstype} Address"); + $label = _t("SilverShop\Model\Address.Existing{$this->addresstype}Address", "Existing {$translatedAddressType} Address"); return FieldList::create( $fieldtype::create(