openpencil/packages/docs/programmable/sdk/api/advanced/locale-apis.md

40 lines
943 B
Markdown
Raw Normal View History

2026-03-30 12:11:31 +00:00
---
title: Locale APIs
description: Lower-level locale stores and metadata exported by @open-pencil/vue.
---
# Locale APIs
In addition to `useI18n()`, the Vue SDK exports lower-level locale primitives for advanced integrations:
- `locale`
- `localeSetting`
- `setLocale()`
- `AVAILABLE_LOCALES`
- `LOCALE_LABELS`
Use these when you want direct store access, need to integrate locale state with a larger app shell, or want locale metadata without subscribing to the full `useI18n()` return object.
## Usage
```ts
import {
locale,
localeSetting,
setLocale,
AVAILABLE_LOCALES,
LOCALE_LABELS,
} from '@open-pencil/vue'
```
## Notes
- `locale` is the resolved active locale store
- `localeSetting` is the persisted user preference store
- `setLocale()` updates the preference and active locale together
- `AVAILABLE_LOCALES` and `LOCALE_LABELS` are useful for custom pickers
## Related APIs
- [useI18n](../composables/use-i18n)