From 03150dbe12c8ece2fbb3a4c858c7425b87a854d7 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 27 Jan 2024 19:58:51 +0100 Subject: [PATCH] Fix an issue related to the translation of country names --- src/Field/Configurator/CountryConfigurator.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Field/Configurator/CountryConfigurator.php b/src/Field/Configurator/CountryConfigurator.php index 64dac6cf1c..f7b63ef984 100644 --- a/src/Field/Configurator/CountryConfigurator.php +++ b/src/Field/Configurator/CountryConfigurator.php @@ -41,6 +41,8 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c } if (\in_array($context->getCrud()->getCurrentPage(), [Crud::PAGE_EDIT, Crud::PAGE_NEW], true)) { + // country names passed to the form are already translated, so don't translate them again in the template + $field->setFormTypeOptionIfNotSet('choice_translation_domain', false); $field->setFormTypeOption('choices', $this->generateFormTypeChoices($countryCodeFormat, $field->getCustomOption(CountryField::OPTION_COUNTRY_CODES_TO_KEEP), $field->getCustomOption(CountryField::OPTION_COUNTRY_CODES_TO_REMOVE))); // the value of this form option must be a string to properly propagate it as an HTML attribute value