This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » eZ Publish 5 Platform » Translate countries in fieldtype
expandshrink

Translate countries in fieldtype

Translate countries in fieldtype

Friday 23 January 2015 9:14:42 am - 5 replies

Hello,

I use the fieldType ezcountry but the display of the country, the name is in English.

I would like to be able to specify the local as on the other FieldTypes.

I did this:

{{ez_render_field (address, 'country', 'fre-FR')}}

But I do not think he gets the fre-fr.ini file in the legacy.

Do you have any idea?
I have a second problem:

In addition, we realized that countries were slightly different for a field of type "Country" Symfony form and a type field "Country" eZ. Is this normal?

Thank you in advance

Saturday 24 January 2015 12:52:38 am

Hello Jonathan,

In legacy the Country datatype fetches the list of countries from the current siteaccess settings override of country.ini

In new stack (which I'm still learning) it seems this information is stored here: https://github.com/ezsystems/ezpu...ish/Core/settings/fieldtypes.yml#L28

I'd imagine you would need to override this fieldtypes.yml configuration to customize the list of countries (translate them).

I'm sorry I can't (yet) guide you through how to actually do this but perhaps someone else can chime in here.

I hope this helps!

Cheers,
Heath 

Reference: https://doc.ez.no/eZ-Publish/Tech...nual/4.x/Reference/Datatypes/Country

Sunday 25 January 2015 6:29:07 pm

Hello // Heath,

You understood my problem well  happy.gif Emoticon

I hope someone (from eZ Systems team can be : p) can help me.

Thanks.

Tuesday 27 January 2015 11:26:33 am

Hi,

I have the same problem. Do you have an idea maybe @jvieilledent ?

 

Tkx

Thursday 05 February 2015 11:17:48 am

Hello,

 

Is anyone has got an idea for this problem ?

 

Tkx for your help

Tuesday 24 February 2015 10:00:43 am

Hello,

Here my solution:

I override the ezcountry_field block in the content_fields.html.twig and add an trans filter to the name output:

 {{ country['Name']|trans( {}, 'countries' }}

So it is possible to translate the name by Resources/translations/countries.fr.xliff

Symfony documentation for translation: http://symfony.com/doc/current/book/translation.html

Modified on Tuesday 24 February 2015 10:01:21 am by Sebastian Blank

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from