Sitecore 5.0 API

State.Language Property

Get or sets the current language code.

[Visual Basic]
Public Shared Property Language As String
[C#]
public static string Language {get; set;}

Property Value

The current language code.

Remarks

The current language specifies which pieces of content, Sitecore fetches by default. For instance if the language code is "da" (Danish), Sitecore will by default fetch contents that have the code "da".

The code is just an identifier, but usually it is an ISO language code, e.g. "en", "en-us", "da", "ge" etc.

This State variable does not change the language of the Sitecore client.

Example

The following example changes the language to german.

  string english = version.GetFieldValue("Text"); // english text
  State.Language = "ge";
  string german = version.GetFieldValue("Text"); // german text

See Also

State Class | Sitecore.Configuration Namespace | ClientLanguage