API Reference: EnableLinkToCultureAttribute Class

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

The EnableLinkToCultureAttribute can be applied to content model properties. The attribute specifies that the value of this property can be linked to one of the cultures passed to the attribute (other than the currently active content culture). In the back-office application, a dropdown list will appear with the field allowing the property value to be linked to one of the other cultures.

If a property value is linked to another culture, whenever the other culture's value for this property changes, the property value for the current value also changes. This can be useful if you have different region-specific cultures (f.e. UK English and US English), where properties may often have the same value for the different cultures. In this case, linking a property value to another (similar) culture will reduce the need for duplicating and copy-pasting content.

Applying this attribute implicitly specifies that the property is culture-dependent (equivalent to decorating the property with the Culture Dependent attribute), therefore setting this property explicitly is not necessary.

Usage

Decorate the content model property with the EnableLinkToCultureAttribute. Pass the culture names that can be linked to in the constructor. The attribute constructor accepts one or more culture name values as a params string[] parameter. Alternatively, the attribute can be set multiple times on the property.

Example

The following example shows a string property that can be linked to the US English language.

[Page]
public class ContentPage: IContentType
{
    // This property can be linked to the US English culture.
    [EnableLinkToCulture("en-US")]
    public string Title { get; set; }

    // ...
}