Author:
    Creation:2026-06-12Last update:2026-06-12

    Dynamic Dictionaries

    Intlayer supports three mechanisms for expressing content that goes beyond a single static dictionary per key. Each is declared through a top-level metadata field in the content file; no wrapper function is needed.

    Feature Metadata field Selector in useIntlayer
    Collections item: N { item: N }
    Variants variant: "name" { variant: "name" }
    Dynamic Records meta: { id, … } { id, … }

    All three compose with the locale argument and support selective / lazy loading via importMode.

    When to use which

    • Collections — ordered list of items managed in separate files (FAQ entries, blog posts, products).
    • Variants — named content alternatives for A/B tests, seasonal banners, or feature flags.
    • Dynamic records — content fetched at runtime by an opaque ID (CMS records, user-specific copy).

    Selector disambiguation

    When multiple selectors are present on a dictionary, the resolution order is:

    plaintext
    variant → meta → item