C# Class Sitecore.SharedSource.Commons.Utilities.LanguageUtil

Utilities for dealing with languages and multilingual content in Sitecore
Exibir arquivo Open project: Velir/Sitecore-Commons

Public Methods

Method Description
CheckItemForLanguage ( string itemGuid, System.Language language, Database db ) : bool

Checks to see if the passed in item has a version in the specified language.

GetAvailableLanguagesForItem ( System.Item item, Database db ) : List

Gets the available languages for an item.

GetLanguage ( string languageName, bool fallBackToDefaultLanguage ) : System.Language

Tries to get the passed in language, if it is not found the default language will be returned.

GetLanguageUrlForItem ( System.Item item, System.Language language ) : string

Contructs a URL for a passed in Item that contains the parameter which will cause Sitecore to switch the current language.

GetLanguageUrlForUrl ( string baseUrl, System.Language language ) : string

Contructs a URL for a passed in URL that contains the parameter which will cause Sitecore to switch the current language.

GetLanguageUrlForUrl ( string baseUrl, string languageName ) : string

Contructs a URL for a passed in URL that contains the parameter which will cause Sitecore to switch the current language.

SwitchCurrentLanguage ( System.Language language ) : void

Switches the current language in Sitecore.Context

SwitchCurrentLanguage ( string languageName, bool fallBackToDefaultLanguage ) : void

Switches the current language in Sitecore.Context

Method Details

CheckItemForLanguage() public static method

Checks to see if the passed in item has a version in the specified language.
db is null language is null itemGuid is null or empty
public static CheckItemForLanguage ( string itemGuid, System.Language language, Database db ) : bool
itemGuid string The guid of the item to check.
language System.Language The language to check for.
db Database The Sitecore db to use.
return bool

GetAvailableLanguagesForItem() public static method

Gets the available languages for an item.
public static GetAvailableLanguagesForItem ( System.Item item, Database db ) : List
item System.Item The item.
db Database The db.
return List

GetLanguage() public static method

Tries to get the passed in language, if it is not found the default language will be returned.
public static GetLanguage ( string languageName, bool fallBackToDefaultLanguage ) : System.Language
languageName string Name of the language.
fallBackToDefaultLanguage bool if set to true the default language will be returned if any problems occur /// in retrieving the passed in language.
return System.Language

GetLanguageUrlForItem() public static method

Contructs a URL for a passed in Item that contains the parameter which will cause Sitecore to switch the current language.
public static GetLanguageUrlForItem ( System.Item item, System.Language language ) : string
item System.Item The item to link to.
language System.Language The language to switch to.
return string

GetLanguageUrlForUrl() public static method

Contructs a URL for a passed in URL that contains the parameter which will cause Sitecore to switch the current language.
public static GetLanguageUrlForUrl ( string baseUrl, System.Language language ) : string
baseUrl string The base URL.
language System.Language The language to switch to.
return string

GetLanguageUrlForUrl() public static method

Contructs a URL for a passed in URL that contains the parameter which will cause Sitecore to switch the current language.
public static GetLanguageUrlForUrl ( string baseUrl, string languageName ) : string
baseUrl string The base URL.
languageName string The name of the language to switch to.
return string

SwitchCurrentLanguage() public static method

Switches the current language in Sitecore.Context
public static SwitchCurrentLanguage ( System.Language language ) : void
language System.Language The language to switch to.
return void

SwitchCurrentLanguage() public static method

Switches the current language in Sitecore.Context
public static SwitchCurrentLanguage ( string languageName, bool fallBackToDefaultLanguage ) : void
languageName string Name of the language to switch to.
fallBackToDefaultLanguage bool if set to true the default language will be returned if any problems occur /// in retrieving the passed in language
return void