Skip to content

Commit

Permalink
feat(docs): add example how to set locale
Browse files Browse the repository at this point in the history
  • Loading branch information
wingkwong committed Apr 25, 2024
1 parent 1a033fe commit 9cec2c2
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion apps/docs/content/docs/api-references/nextui-provider.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,48 @@ Here's the API reference for the `NextUIProvider`.

### locale

The locale to apply to the children. The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale. By default, It is `en-US`.
The locale to apply to the children.

**type**: `string | undefined`

Here's the supported locales. By default, It is `en-US`.

```tsx
const localeValues = [
'fr-FR', 'fr-CA', 'de-DE', 'en-US', 'en-GB', 'ja-JP',
'da-DK', 'nl-NL', 'fi-FI', 'it-IT', 'nb-NO', 'es-ES',
'sv-SE', 'pt-BR', 'zh-CN', 'zh-TW', 'ko-KR', 'bg-BG',
'hr-HR', 'cs-CZ', 'et-EE', 'hu-HU', 'lv-LV', 'lt-LT',
'pl-PL', 'ro-RO', 'ru-RU', 'sr-SP', 'sk-SK', 'sl-SI',
'tr-TR', 'uk-UA', 'ar-AE', 'ar-DZ', 'AR-EG', 'ar-SA',
'el-GR', 'he-IL', 'fa-AF', 'am-ET', 'hi-IN', 'th-TH'
];
```

Here's an example to set a Spanish locale.

```tsx
"use client";

import {type ReactNode} from "react";
import {NextUIProvider} from "@nextui-org/react";

export function AppProvider(props: AppProviderProps) {
const {children, className} = props;

return (
<NextUIProvider locale="es-ES" className={className}>
{children}
</NextUIProvider>
);
}

interface AppProviderProps {
children: ReactNode;
className?: string;
}
```

### defaultDates

The default dates range that can be selected in the calendar.
Expand Down

0 comments on commit 9cec2c2

Please sign in to comment.