Locale Provider

A context provider component that sets the locale for child components. Automatically determines text direction (LTR/RTL) based on the locale and provides locale context to formatting utilities.

Anatomy

<script>
  import { LocaleProvider } from "@saas-ui/svelte/utilities/locale-provider";
  import { FormatNumber } from "@saas-ui/svelte/utilities/format-number";
</script>

<!-- Wrap your app with LocaleProvider -->
<LocaleProvider locale="en-US">
  <FormatNumber value={1234.56} />
</LocaleProvider>

<!-- RTL locale support -->
<LocaleProvider locale="ar-SA">
  <FormatNumber value={1234.56} />
</LocaleProvider>

Examples

Basic Accessibility

Basic usage showing how LocaleProvider sets the locale context for child components.

Setting Locale Accessibility

Demonstrates how changing the locale affects formatting and text direction throughout the component tree.

Props

Prop Type Default Description
locale text en-US The locale to use for the application.
children any - The content to be rendered inside the component.