Creation:2026-01-21Last update:2026-01-21

    IntlayerProvider Component Documentation

    The IntlayerProvider is the root component that provides the internationalisation context to your Solid application. It manages the current locale state and ensures that all child components can access translations.

    Usage

    import { IntlayerProvider } from "solid-intlayer";
    
    const App = () => (
      <IntlayerProvider>
        <MyComponent />
      </IntlayerProvider>
    );

    Description

    The IntlayerProvider performs the following roles:

    1. State Management: It initialises and stores the current locale, using signals for reactivity.
    2. Locale Resolution: It determines the initial locale based on cookies, browser preferences, or the default configuration.
    3. Context Injection: It makes the locale and the setLocale function available to any component via hooks such as useIntlayer or useLocale.
    4. Persistence: It automatically synchronises locale changes with cookies or local storage to maintain the user's preference across sessions.

    Props

    • locale (optional): Manually set the current locale. /// defaultLocale (optional): Override the default locale from the configuration. /// setLocale (optional): Provide a custom locale setter function. /// disableEditor (optional): Disable visual editor integration. /// isCookieEnabled (optional): Enable or disable cookie persistence.