November Happy Hour will be moved to Thursday December 5th.

Class LanguageBranch

Represents a language that can be used in globalized solutions.

Inheritance
System.Object
LanguageBranch
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.DataAbstraction
Assembly: EPiServer.dll
Version: 10.10.4
Syntax
public class LanguageBranch : IReadOnly<LanguageBranch>, IReadOnly

Constructors

LanguageBranch()

Initializes a new instance of the LanguageBranch class.

Declaration
public LanguageBranch()

LanguageBranch(CultureInfo)

Initializes a new instance of the LanguageBranch class.

Declaration
public LanguageBranch(CultureInfo culture)
Parameters
Type Name Description
System.Globalization.CultureInfo culture

The culture of the language branch.

LanguageBranch(Int32, String, String, Int32, String, String, Boolean)

Initializes a new instance of the LanguageBranch class.

Declaration
[Obsolete("Use alternative constructor and assign values using properties.")]
public LanguageBranch(int id, string languageID, string name, int sortIndex, string rawIconPath, string urlSegment, bool enabled)
Parameters
Type Name Description
System.Int32 id

The internal numeric ID.

System.String languageID

The language ID.

System.String name

The name of the language.

System.Int32 sortIndex

Index to sort on.

System.String rawIconPath

The raw icon path.

System.String urlSegment

The URL segment that identifies the language when used in a URL.

System.Boolean enabled

if set to true the language is enabled.

LanguageBranch(String)

Initializes a new instance of the LanguageBranch class.

Declaration
public LanguageBranch(string languageID)
Parameters
Type Name Description
System.String languageID

The language of the branch.

LanguageBranch(String, String)

Initializes a new instance of the LanguageBranch class.

Declaration
[Obsolete("Use alternative constructor and assign values using properties.")]
public LanguageBranch(string languageID, string name)
Parameters
Type Name Description
System.String languageID

The language ID.

System.String name

The name of the language.

Fields

CacheKey

String used as cache key for language branches.

Declaration
public const string CacheKey = "EP:LanguageBranch"
Field Value
Type Description
System.String

Properties

ACL

Gets or sets the AccessControlList for this language.

Declaration
public AccessControlList ACL { get; set; }
Property Value
Type Description
AccessControlList

Culture

Gets or sets the culture for this language branch.

Declaration
public CultureInfo Culture { get; set; }
Property Value
Type Description
System.Globalization.CultureInfo

CurrentUrlSegment

Gets the URL segment string to use when creating or verifying Friendly URL:s

Declaration
[Obsolete("CurrentUrlSegment can now be replaced by URLSegment", false)]
public string CurrentUrlSegment { get; }
Property Value
Type Description
System.String

Enabled

Gets or sets a value indicating if this language branch is enabled.

Declaration
public bool Enabled { get; set; }
Property Value
Type Description
System.Boolean

ID

Gets or sets the unique identifier of this language branch.

Declaration
public int ID { get; set; }
Property Value
Type Description
System.Int32

IsReadOnly

Indicates whether the current object instance is read-only.

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
System.Boolean

LanguageBranchRepository

Convenient method to get the instance of ILanguageBranchRepository that is registered in ServiceLocator.

Declaration
[Obsolete("Use ServiceLocator.Current.GetInstance<ILanguageBranchRepository>()")]
public static ILanguageBranchRepository LanguageBranchRepository { get; }
Property Value
Type Description
ILanguageBranchRepository

The language branch repository.

LanguageID

Gets the language name of the current branch, for example "en"

Declaration
public string LanguageID { get; }
Property Value
Type Description
System.String
Remarks

Note that this is the Name property of a CultureInfo object.

Name

Gets or sets the display name of this language.

Declaration
public string Name { get; set; }
Property Value
Type Description
System.String
Remarks

Unless explicitly set, this property returns the NativeName of the Culture property.

RawIconPath

Gets or sets the raw flag icon path.

Declaration
public string RawIconPath { get; set; }
Property Value
Type Description
System.String

ResolvedIconPath

Gets the icon path.

Declaration
public string ResolvedIconPath { get; }
Property Value
Type Description
System.String
Remarks

Use this property to get path to Flag outside admin/edit. Uses UriSupport.ResolveUrlBySettings to resolve path to flag.

SortIndex

Gets or sets the sort index used when listing language branches.

Declaration
public int SortIndex { get; set; }
Property Value
Type Description
System.Int32

SystemIconPath

Path to icon used for admin and edit.

Declaration
[Obsolete("Not supported anymore")]
public string SystemIconPath { get; }
Property Value
Type Description
System.String
Remarks

This property is not to be used outside admin/edit. Uses ThemeUtility.GetImageThemeUrl to get Icon path.

URLSegment

Gets or sets a custom string that should be used in URL segments.

Declaration
public string URLSegment { get; set; }
Property Value
Type Description
System.String

Methods

CreateWritableClone()

Declaration
public virtual LanguageBranch CreateWritableClone()
Returns
Type Description
LanguageBranch

MakeReadOnly()

Changes the object instance into a read-only object.

Declaration
public virtual void MakeReadOnly()
Remarks

After calling this method, any attempt to change the object instance or any contained object will generate a System.NotSupportedException. I.e. the semantics is "deep read-only".

Note! After setting an object to read-only it is not possible to revert back to read-write mode. You will have to call the CreateWritableClone method to get a copy that can be modified.

QueryEditAccessRights(IPrincipal)

Queries if the user has edit access rights to the language branch.

Declaration
public virtual bool QueryEditAccessRights(IPrincipal user)
Parameters
Type Name Description
System.Security.Principal.IPrincipal user

The user.

Returns
Type Description
System.Boolean

True if the user has edit access to the language; otherwise false.

ValidateLanguageEdititingAccessRights(IPrincipal)

Validates that the user has access rights to edit the page in the given language.

Declaration
public virtual void ValidateLanguageEdititingAccessRights(IPrincipal user)
Parameters
Type Name Description
System.Security.Principal.IPrincipal user

The user.

Explicit Interface Implementations

IReadOnly.CreateWritableClone()

Declaration
object IReadOnly.CreateWritableClone()
Returns
Type Description
System.Object

Implements

Extension Methods