eZ Community » Forums » eZ Publish 5 Platform » How to get i18n field label?
expandshrink

How to get i18n field label?

How to get i18n field label?

Tuesday 26 November 2013 12:54:58 pm - 7 replies

Hi,

I'm wondering what is the easiest way to get the i18n label from a field definition of a content type? I'm not sure how to handle this in twig template.

I wish there was something similar to the ez_field_value() twig helper but for field label with i18n support happy.gif Emoticon

{{ ez_field_label( content, 'country' ) }} => Country (en) / Pays (fr)

Tuesday 26 August 2014 11:32:57 am

Hi,

I face the same situation ; did you find a solution please?

Thanks,

Irma

Tuesday 26 August 2014 1:34:10 pm

Hi,

basically missing twig function for this, there was plans to have a generic one similar to ez_content_name*, which would work the same way but generic.

Something like:
ez_i18n_property( ValueObjectstring propertyName[, string forcedLanguage] )

Usage:
ez_i18n_property( FieldDefinition, "name" )

Would that solve your use case?
 

* ez_content_name should imho eventually be deprecate in favor of the generic one when and if we standardize translated properties.

Modified on Tuesday 26 August 2014 1:35:40 pm by André R

Wednesday 27 August 2014 9:20:49 am

Hi,

Thanks for your quick reply ; yes it would solve our use case. 

Thank you for your help,

Irma

Friday 05 September 2014 8:35:19 pm

Hi,

 

small update, there is an related pull request which gives insight on how to add this if someone wants to give it a shoot:

https://github.com/ezsystems/ezpublish-kernel/pull/980

Friday 05 September 2014 8:56:20 pm

@André: You mean ez_content_name should be kept "outside" of this possible generic one until standarization is done? 

Saturday 11 October 2014 8:06:49 pm

I hope this pull request can be merged soon. Most of our eZ Publish 4 projects rely on being able to easily display the (multilingual) name (and also the description) of content attributes (ie 'content field definitions'). I was surprised to discover that eZ Publish 5 doesn't have this functionality yet. As we often use both the field name and description in this way, a more generic approach than just an 'ez_field_name' helper would be better for us, but I'd settle for 'ez_field_name' and 'ez_field_description'.

If it's going to be a while still, what would be the best way to we add this functionality in our own Bundle?

Thanks!

Andy

Thursday 16 October 2014 10:57:14 am

The reply has been removed because of violation of forum rules.

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from