How to get localized field names?

Hi,
How can I get localized field names of entities?
I found a way but not sure that it’s optimal:

@Inject
private Messages messages;
...
String localFieldName = messages.getMessage(Entity.class,"Entity."+ fieldName);

Hi,

Use MessageTools bean:


@Inject
private MessageTools messageTools;
...
MetaClass userClass = metadata.getClass(User.class);
messageTools.getPropertyCaption(userClass, "password");

enumerations are retrieved the same way as field names? i got nullpointer as i want to get meta from enum

hi, @ocrio.box

to get localized messages for enums you can use the following two methods:

Messages#getMessage(java.lang.Enum)

Messages#getMessage(java.lang.Enum, java.util.Locale)

Regards,
Daniil.