get_translated_attr

Description

get_translated_attr is similar to get_attr, but it will also translate the attribute if it is present.

Example

p is Person
get_attr(p, "domicile", "de")

This will return the domicile of a person translated to the requested language, so e.g. for a german interface "Schweiz" if the person is from Switzerland. If this person actually has no domicile (either because not provided or because there is no property name domicile, this will return "de" and translate it to the language string (e.g. "Deutschland" for German).

Last updated