API ReferenceCultureDependentAttribute Class

Note: this attribute is only effective for multi-language sites or asset libraries.

The CultureDependentAttribute can be applied to content model properties. The attribute specifies that the property has different values for each culture or language of the site or asset library.

Culture dependence is opt-in per property, therefore you have to decorate a property with this attribute to be able to set a different value per language. Usually, you will want to specify text-based fields as culture-dependent and other fields such as images or numbers as culture-invariant. When a property is marked as culture-dependent, an icon indicating this is displayed next to the field label in the back office.

If CultureDependentAttribute is not specified on a content model property, the same property value will be used for all languages (i.e. the property value is culture-invariant).

Usage

Decorate the content model property with the CultureDependentAttribute. The attribute does not have any parameters. In the back-office application, users will now be able to set different values for this property per language.

Example

The following specifies that the Description property on the RoomDetail content type is culture-dependent.

[Page]
public class RoomDetail: IContentType
{
    [CultureDependent]
    public string Description { get; set; }

    // This property is not culture-dependent
    public int DailyRate { get; set; }

    //...
}