# getLocaleKey

Normalize a locale tag to the key the i18n registry stores it under

## Import

```tsx
import { getLocaleKey } from "@videojs/react/i18n";
```

`getLocaleKey` lowercases a BCP 47 tag, replaces underscores with hyphens, and removes Unicode extensions such as `-u-nu-latn`. The registry stores [`registerI18n`](https://videojs.org/docs/framework/react/reference/api/register-i18n) layers under this key, so use it to compare a tag with one you have registered or to key your own per-locale data the same way.

```ts
import { getLocaleKey } from '@videojs/react/i18n';

getLocaleKey('en_US-u-nu-latn'); // 'en-us'
getLocaleKey('zh-Hant'); // 'zh-hant'
```

## API Reference

`getLocaleKey(locale): Locale`

### Parameters

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `locale` (required) | `(typeof LOCALES)[number] \| string & {}` | — | BCP 47 tag to normalize. |

### Return Value

`(typeof LOCALES)[number] | string & {}`

---

React documentation: https://videojs.org/docs/framework/react/llms.txt
All documentation: https://videojs.org/llms.txt
