# Language selector

<figure><img src="/files/lB68VZ9Je3RIJL5H4Hgg" alt=""><figcaption><p>Language selector widget</p></figcaption></figure>

If your application supports multiple languages, you can add to the CSPR.click navigation bar a language selector.

## Language selector set up

Define an array with the list of languages your application supports:

```tsx
export const LANGUAGES: Lang[] = [
    Lang.EN,
    Lang.AZ,
    Lang.DE,
    Lang.ES,
    //...,
];
```

Create a state value to store the current language. For example, with `useState()` hook, but you can use any other method.

```tsx
const [language, setLanguage] = useState<Lang>(Lang.EN);
```

Define a `languageSettings` object with the list of languages, the current language, and a callback method to handle language selection by the user. Add this object to the `topBarSettings` prop in the `<ClickUI>` component:

```typescript
const languageSettings = {
    languages: LANGUAGES,
    creditsUrl: "/credits",
    contributeUrl: "/contribute",
    currentLanguage:  language,
    onChangeLanguage: (l: Lang) => { setLanguage(l); }
}
```

```tsx
<ClickUI
    topBarSettings={{
        languageSettings
    }}
/>
```

If you want to show a credits page to shout out your contributors, specify a URL in the `credits` field.

And if you want to ask your visitors to help you maintain the translations, specify a URL in the `contribute` field.

Note that both, `credits` and `contribute` links are optional. If you don't specify one or both, such options won't show in the language selector widget.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cspr.click/cspr.click-v1.12/cspr.click-sdk/react/customizing-the-top-bar/language-selector.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
