# @rax-ui/locale

> --- display: Locale family: Utils ---

Latest version **1.0.0-beta.62** (published 2020-11-24) · 0 weekly downloads

## Install

```sh
npm install @rax-ui/locale
pnpm add @rax-ui/locale
yarn add @rax-ui/locale
bun add @rax-ui/locale
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-beta.62 |
| Published | 2020-11-24 |
| First published | 2019-08-30 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | jinli.lyy |
| Maintainers | lianmin, amdgigabyte, myronliu347 |
| Keywords | Rax, rax-component |

## Links

- npm: https://www.npmjs.com/package/@rax-ui/locale
- npm.io page: https://npm.io/package/@rax-ui/locale

## Dependencies (1)

- [rax-children](https://npm.io/package/rax-children.md) ^1.0.0

## Recent versions

- 1.0.0-beta.62 (latest) — 2020-11-24
- 1.0.0-beta.47 (next) — 2020-04-17
- 1.0.0-beta.60 — 2020-08-28
- 1.0.0-beta.59 — 2020-08-18
- 1.0.0-beta.57 — 2020-06-22
- 1.0.0-beta.56 — 2020-06-03
- 1.0.0-beta.55 — 2020-05-26
- 1.0.0-beta.54 — 2020-05-13
- 1.0.0-beta.53 — 2020-05-12
- 1.0.0-beta.52 — 2020-05-11
- 1.0.0-beta.51 — 2020-04-29
- 1.0.0-beta.50 — 2020-04-27
- 1.0.0-beta.49 — 2020-04-23
- 1.0.0-beta.48 — 2020-04-23
- 1.0.0-beta.46 — 2020-04-15
- … 31 more at https://npm.io/package/@rax-ui/locale/versions

## README

---
display: Locale
family: Utils
---

# Locale

国际化控件, 目前用于定义/使用文案。

## API

### LocaleProvider

全局注入文案，`<LocaleProvider locale={} />`

### useLocale<T>(name: string, props: { locale: T }, defaultLocale: T)

使用文案

* name: 组件名称
* props: 组件参数，里面需要有 `locale`
* defaultLocale: 默认文案

### withLocale<T, P extends LocaledComponentProps<T>>(Component: ComponentType<P>, options: { name: string, defaultLocale: T })

HOC 用于 Class Component

* Component 组件
* options
  * options.name 组件名称
  * options.defaultLocale 默认文案

---
_Source: https://npm.io/package/@rax-ui/locale · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
