> ## Documentation Index
> Fetch the complete documentation index at: https://flex-fields.bjanczak.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Examples target Filament 5. Verify optional dependencies before configuring integrations.
> Upload transfer completion, permanent storage and record acceptance are separate milestones. Native and Spatie image conversions retain the original.

# Locales and RTL

> Choose formatting locale and translation fallback while preserving script-aware direction.

Formatting accepts bounded language/script/region/variant locale IDs with RFC5646
extension groups and private-use tails attached to a language. Both separators
are accepted; browser tags use hyphens and PHP IDs use underscores:

> [!TIP]
>
> **Watch this in the workshop:** [52:13 — resolve labels and RTL direction for one note instance](https://www.youtube.com/watch?v=m4V_R7YxTP4\&t=3133s).

```php theme={"theme":{"light":"github-light","dark":"github-dark"}}
use Bjanczak\FilamentFlexFields\Support\Locale\LocaleContext;

$locale = new LocaleContext(
    locale: 'en-US-u-ca-buddhist-nu-thai',
    translationLocales: ['en', 'en_US', 'pl'],
    fallback: 'en',
);

$locale->formatting->tag; // en-US-u-ca-buddhist-nu-thai
$locale->translationChain; // ['en_US', 'en']
```

A missing exact translation drops the complete extension block before trying
region/script/variant parents. No dangling `en_US_u` or partial extension becomes
a translation candidate. Explicit scripts determine direction (`ar-Latn` is LTR).
`FamilyRenderContext` uses the same locale admission as ordinary formatting.
Duplicate extension singletons, empty extension values, malformed variants and
oversized IDs reject. The syntax contract does not bundle the IANA/Unicode
registries or claim every calendar/numbering option exists in the installed ICU
or browser. Grandfathered tags, extlang forms and private-use-only locale IDs
remain unsupported. See [RFC5646](https://www.rfc-editor.org/rfc/rfc5646.html).

## Continue reading

[Extension guides](https://flex-fields.bjanczak.com/docs/extensions.md) · [Definition and registration reference](https://flex-fields.bjanczak.com/docs/extensions/definition-reference.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.