Locale
Locale provider for setting the locale and direction of the app.
Setup
The LocaleProvider
component sets the locale for your app, formatting dates, numbers, and other
locale-specific data.
Note: If no
LocaleProvider
is setup, the default locale for the app will been-US
and therefore the direction will beltr
.
import { LocaleProvider } from '../locale-provider'
export const App = () => {
return <LocaleProvider locale="de-DE">{/* Your App */}</LocaleProvider>
}
import { LocaleProvider } from '../locale-provider'
export const App = () => {
return <LocaleProvider locale="de-DE">{/* Your App */}</LocaleProvider>
}
<script setup lang="ts">
import { LocaleProvider } from '../'
</script>
<template>
<LocaleProvider locale="de-DE"><!-- Your App --></LocaleProvider>
</template>
Usage
To access the current locale and direction settings, use the useLocaleContext
hook.
API Reference
LocaleProvider
Prop | Default | Type |
---|---|---|
locale | 'en-US' | string The locale to use for the application. |