---
title: Localization
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

List of examples:

## Cultures

### Creating a new culture

```csharp

// Creates a new culture object
CultureInfo newCulture = new CultureInfo();

// Sets the culture properties
newCulture.CultureName = "New culture";
newCulture.CultureCode = "nw-cu";
newCulture.CultureShortName = "Culture";

// Saves the new culture to the database
CultureInfoProvider.SetCultureInfo(newCulture);

```

[> Back to list of examples](#localization-toc)

### Updating a culture

```csharp

// Gets the culture using the culture code
CultureInfo updateCulture = CultureInfoProvider.GetCultureInfo("nw-cu");

if (updateCulture != null)
{
    // Updates the culture properties
    updateCulture.CultureName = updateCulture.CultureName.ToLower();

    // Saves the modified culture to the database
    CultureInfoProvider.SetCultureInfo(updateCulture);
}

```

[> Back to list of examples](#localization-toc)

### Updating multiple cultures

```csharp

// Prepares a where condition for loading all cultures whose code starts with 'nw'
string where = "CultureCode LIKE N'nw%'";

// Get all cultures that fulfill the condition
InfoDataSet<CultureInfo> cultures = CultureInfoProvider.GetCultures(where, null);

// Loops through individual cultures
foreach (CultureInfo culture in cultures)
{
    // Updates the culture properties
    culture.CultureName = culture.CultureName.ToUpper();

    // Saves the updated culture to the database
    CultureInfoProvider.SetCultureInfo(culture);
}

```

[> Back to list of examples](#localization-toc)

### Assigning a culture to a site

```csharp

// Gets the culture using the culture code
CultureInfo culture = CultureInfoProvider.GetCultureInfo("nw-cu");

if (culture != null)
{
    // Assigns the culture to the current site
    CultureSiteInfoProvider.AddCultureToSite(culture.CultureID, SiteContext.CurrentSiteID);
}

```

[> Back to list of examples](#localization-toc)

### Removing a culture from a site

```csharp

// Gets the culture using the culture code
CultureInfo removeCulture = CultureInfoProvider.GetCultureInfo("nw-cu");

if (removeCulture != null)
{
    // Gets the object representing the relationship between the culture and the current site
    CultureSiteInfo cultureSite = CultureSiteInfoProvider.GetCultureSiteInfo(removeCulture.CultureID, SiteContext.CurrentSiteID);

    if (cultureSite != null)
    {
        // Removes the culture from the current site
        CultureSiteInfoProvider.DeleteCultureSiteInfo(cultureSite);
    }
}

```

[> Back to list of examples](#localization-toc)

### Deleting a culture

```csharp

// Gets the culture using the culture code
CultureInfo deleteCulture = CultureInfoProvider.GetCultureInfo("nw-cu");

if (deleteCulture != null)
{
    // Deletes the culture
    CultureInfoProvider.DeleteCultureInfo(deleteCulture);
}

```

[> Back to list of examples](#localization-toc)
