---
title: Creating language selectors
related:
  - https://docs.kentico.com/k9/multilingual-websites/setting-up-multilingual-websites/configuring-urls-for-multilingual-websites.md
  - https://docs.kentico.com/k9/developing-websites/developing-websites-using-the-portal-engine/using-and-configuring-web-parts.md
  - https://docs.kentico.com/k9/configuring-kentico/configuring-page-urls/wildcard-urls.md
  - https://docs.kentico.com/k9/configuring-kentico/managing-sites/setting-domain-names-for-sites.md
---

> 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).

To create a language selector on a page, [use](https://docs.kentico.com/k9/developing-websites/developing-websites-using-the-portal-engine/using-and-configuring-web-parts.md) the Language data source web part in combination with the Basic repeater web part.

1. Place the **Language data source** web part on a page. The data source generates 'CultureCode', 'CultureName', and 'URL' (the URL is culture specific) fields.
2. Configure the web part and copy the value of the **Web part control ID** property.
3. Place the **Basic repeater** web part on the page and configure it.
4. In the **Data source name** property, paste the copied **Web part control ID** value from the data source web part.
5. In the **Content before** and **Content after** field, add the markup for the language selector. For example:

   ```xml title="Content before"

   <div class="language-selection">
       {% LocalizationContext.CurrentCulture.CultureShortName %}
   </div>
   <nav role="navigation">
     <ul class="language-items">

   ```

   ```xml title="Content after"

     </ul>
   </nav>

   ```
6. Access the data source fields in the transformation. For example:

   ```xml title="Text / XML transformation code"

   <li>
       <a title="{% CultureName %}" href="{% HTMLEncode(URL) %} ">{% CultureName %}</a>
   </li>

   ```
7. **Save & Close**.
8. [Style](https://docs.kentico.com/k9/developing-websites/designing-websites-using-css.md) the markup in the **CSS** **stylesheets** application.

The page now lists the available cultures.

![A language selector displayed on the sample Dancing Goat website](https://docs.kentico.com/docsassets/k9/creating-language-selectors/language_selector.png "A language selector displayed on the sample Dancing Goat website")

### Localizing the names of cultures

By default, the system displays the names of cultures in English. You can create [resource strings](https://docs.kentico.com/k9/multilingual-websites/setting-up-a-multilingual-user-interface/working-with-resource-strings.md) for specific culture codes and access them using the following [macro code](https://docs.kentico.com/k9/macro-expressions/entering-macro-expressions.md):

```xml title="Text / XML transformation code"

{%
    cultureLocalizedName = GetResourceString(CurrentSite.SiteName + "." + CultureCode);
    return;
%}

```

You would then use the _cultureLocalizedName_ variable in the transformation code instead of the _CultureName_ source field. This allows you to display custom culture names instead of culture codes. The **Dancing Goat** sample site uses the same approach to build its language selector.

### Renaming the language selection parameter

The default name of the language selection parameter is _lang_. To rename the parameter:

1. Add the **CMSLanguageParameterName** key into the _/configuration/appSettings_ section of your application's **web.config** file.
2. Enter the new name as the key's **value**.

   ```html

   <add key="CMSLanguageParameterName" value="sprache" />

   ```

Even though switching between languages using URL query string parameters is the default approach, it is not recommended for live production websites. Parameters make URLs more confusing and are not friendly toward search engines. Instead, you can configure the system to use one of the options described in [Configuring URLs for multilingual websites](https://docs.kentico.com/k9/multilingual-websites/setting-up-multilingual-websites/configuring-urls-for-multilingual-websites.md).
