I'm using the Symfony2 country Field Type, it works well and country names are translated. I am storing the two-digit country code in the column country
of my entity.
How can I display the full, translated country name? This is how I added the field to the form:
$builder
->add('country', 'country', array(
'label' => 'Paese', 'preferred_choices' => array('IT')
));
And then in my controller:
$user = $this->getDoctrine()->getRepository('AcmeHelloBundle:User');
$countryCode = $user->getCountry();
$countryName = null; // Get translated country name from code
Or in my twig template:
{# Output the country code and name #}
{{ user.country }}
{# translated country name from code #}