Skip to content

Commit

Permalink
Fix an issue related to the translation of country names
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Jan 27, 2024
1 parent 5d80405 commit 03150db
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Field/Configurator/CountryConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 03150db

Please sign in to comment.