# Language Switcher

> Locale (and optionally currency/region) switcher for the top bar or header. Persists the selection.

## Playground

An interactive playground for LanguageSwitcher is embedded above. Open the canonical story on Storybook: [https://storybook.laioutr.cloud/?path=/story/ui-kit-molecules-languageswitcher--default](https://storybook.laioutr.cloud/?path=/story/ui-kit-molecules-languageswitcher--default)

## Overview

`LanguageSwitcher` lets shoppers switch the active locale. Pass `availableLocales` (an array of `AvailableLocale`) and `currentLocale`, then listen for the `change` event with the picked locale id. The component renders nothing when fewer than two locales are available, so it can sit unconditionally in chrome. It accepts a `surfaceTone` of `'light'` or `'dark'`, since chrome and navigation live on neutral surfaces by design.

## Key Business & UX Benefits

- Lets international shoppers switch locale from any page, lifting conversion in cross-border markets.
- The prop-plus-emit contract keeps locale state in the consumer, so the component drops cleanly into apps that already manage market data themselves.
- Returning the trigger as a no-op when fewer than two locales are available means consumers can place it unconditionally in chrome.

<tip>

Pro-Tip from Larry: Place `LanguageSwitcher` in the `TopBar` so users can change language without digging into the menu.

</tip>

## Feature List

<features :items="["`availableLocales` prop accepts a typed `AvailableLocale[]`; the component renders nothing when fewer than two locales are passed","`change` event emits the picked locale id, leaving navigation, persistence, and refresh wiring in the consumer","`surfaceTone` accepts only `'light'` or `'dark'` (no `'bright'`), matching the neutral chrome the switcher is designed for","Optional `side` ('bottom' default, 'top'), `fontSize`, `iconSize`, and `inTopbar` props tune the trigger and dropdown placement","Paired `LanguageSwitcherDisplay` subcomponent renders the trigger so the switcher composes inside menus or top bars"]">



</features>

### LLanguageSwitcher

#### Props

```json
{"type":"object","properties":{"currentLocale":{"type":"string","default":"void 0"},"availableLocales":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"endonym":{"type":"string"},"regionCode":{"type":"string"},"languageHint":{"type":"string"}},"additionalProperties":false,"required":["code","endonym","regionCode"]},"default":[]},"side":{"enum":["top","bottom"],"type":"string","default":"bottom"},"surfaceTone":{"enum":["dark","light"],"type":"string","default":"void 0"},"iconSize":{"type":"string","default":"void 0"},"inTopbar":{"type":"boolean"},"fontSize":{"enum":["s","m","xs","l","sm","xl","ml","2xl","3xl","4xl"],"type":"string","default":"s"}}}
```

#### Events

```json
[{"name":"change","description":"","tags":[],"type":"[locale: string]","signature":"(event: \"change\", locale: string): void","schema":["string"]}]
```

### LLanguageSwitcherDisplay

#### Props

```json
{"type":"object","properties":{"availableLocales":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"endonym":{"type":"string"},"regionCode":{"type":"string"},"languageHint":{"type":"string"}},"additionalProperties":false,"required":["code","endonym","regionCode"]}},"currentLocale":{"type":"string"},"side":{"enum":["top","bottom"],"type":"string"},"surfaceTone":{"enum":["dark","light"],"type":"string"},"inTopbar":{"type":"boolean"},"iconSize":{"type":"string"},"fontSize":{"enum":["s","m","xs","l","sm","xl","ml","2xl","3xl","4xl"],"type":"string"}},"required":["availableLocales"]}
```

#### Events

```json
[{"name":"change","description":"","tags":[],"type":"[locale: string]","signature":"(event: \"change\", locale: string): void","schema":["string"]}]
```
