Kentico CMS 7.0 Developer's Guide

Managing site cultures

Managing site cultures

Previous topic Next topic Mail us feedback on this topic!  

Managing site cultures

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

Arrow


API examples for newer versions


Please visit the latest API Examples documentation to view API examples for newer versions of Kentico.



The following example assigns a culture to a site.

 

private bool AddCultureToSite()
{
    // Get site and culture objects
    SiteInfo site = SiteInfoProvider.GetSiteInfo("MyNewSite");
    CultureInfo culture = CultureInfoProvider.GetCultureInfo("ar-sa");

 
    if ((site != null) && (culture != null))
    {
        // Add culture to site
        CultureSiteInfoProvider.AddCultureToSite(culture.CultureID, site.SiteID);

 
        return true;
    }

 
    return false;
}

 

The following example removes a culture from a site.

 

private bool RemoveCultureFromSite()
{
    // Get site and culture objects
    SiteInfo site = SiteInfoProvider.GetSiteInfo("MyNewSite");
    CultureInfo culture = CultureInfoProvider.GetCultureInfo("ar-sa");
 
    if ((site != null) && (culture != null))
    {

      // Delete the culture site
      CultureSiteInfoProvider.RemoveCultureFromSite(culture.CultureID, site.SiteID);

        
        return true;
    }
 
    return false;
}