API Reference: EnableLinkToNeutralCultureAttribute Class
Note: this attribute is only effective for multi-language sites or asset libraries.
The EnableLinkToNeutralCultureAttribute
can be applied to content model properties. The attribute works similarly to the EnableLinkToCulture
attribute. However, in contrast to the EnableLinkToCulture
attribute, you do not specify a culture name for this attribute. When this attribute is applied to a content model property, it enables a property value to be linked to the neutral culture of the currently active culture in the back office application (if the neutral culture is a valid culture for the site or asset library). For example, if the currently active content culture is en-US
, it allows a property value to be linked to the neutral en
culture.
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 a common neutral 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 EnableLinkToNeutralCultureAttribute
. The attribute does not have any parameters.
Example
The following example shows a string property that can be linked to neutral languages.
[Page]
public class ContentPage: IContentType
{
// This property can be linked to the neutral culture of the currently active content culture.
[EnableLinkToNeutralCulture()]
public string Title { get; set; }
// ...
}