Setu-TS
    Preparing search index...

    Type Alias LocalizationPluginOptions

    LocalizationPluginOptions: {
        allowPartialCatalogues?: boolean;
        exposeCatalogues?: { basePath: string; cacheControl?: string };
        middleware?: {
            cookie?: string | false;
            enabled?: boolean;
            exclude?: readonly PathPattern[];
            priority?: number;
            query?: string | false;
        };
        onMissing?: "key"
        | "throw";
        supportedLocales: readonly string[];
        tenantLocale?: (tenant: ITenant) => string | undefined;
        timeZone?: string;
    } & (
        | {
            catalogues: Readonly<Record<string, MessageCatalogue>>;
            source?: never;
        }
        | { catalogues?: never; source: IMessageSource }
    )

    Options for LocalizationPlugin. Exactly one of catalogues (static) and source (loaded once at register()) is required; supplying both, or neither, is a compile error.

    Type Declaration

    • Optional ReadonlyallowPartialCatalogues?: boolean

      Accept a supported locale whose catalogue lacks keys the default locale defines: warned once per locale at register(), served from the default locale at lookup. Default false — an incomplete catalogue fails startup.

    • Optional ReadonlyexposeCatalogues?: { basePath: string; cacheControl?: string }

      Serve each supported locale's catalogue as JSON at GET <basePath>/:locale, for a browser that formats after hydration. Off when absent.

      • ReadonlybasePath: string

        The route prefix: one or more plain path segments such as /i18n — letters, digits, ., _, ~ or -, with no segment of only . or .. — and never the root.

      • Optional ReadonlycacheControl?: string

        The Cache-Control value. Default 'private, max-age=3600' — never shared, because a session may refresh its cookie on this response. Set 'public, …' only when no session cookie reaches the route.

    • Optional Readonlymiddleware?: {
          cookie?: string | false;
          enabled?: boolean;
          exclude?: readonly PathPattern[];
          priority?: number;
          query?: string | false;
      }

      How the global resolution middleware is registered.

    • Optional ReadonlyonMissing?: "key" | "throw"

      What t() does for a key no catalogue has: 'key' answers the key and warns once (default); 'throw' throws MissingMessageError, for tests and CI.

    • ReadonlysupportedLocales: readonly string[]

      The supported BCP 47 tags; the first is the default.

    • Optional ReadonlytenantLocale?: (tenant: ITenant) => string | undefined

      A tenant's default locale; see LocaleMiddlewareOptions.tenantLocale.

    • Optional ReadonlytimeZone?: string

      The IANA time zone Date values are formatted in. Omitted, the runtime's own zone is used. A browser formatting the same messages should pass the same value.

    • { catalogues: Readonly<Record<string, MessageCatalogue>>; source?: never }
      • Readonlycatalogues: Readonly<Record<string, MessageCatalogue>>

        The catalogues, keyed by locale tag.

      • Optional Readonlysource?: never
    • { catalogues?: never; source: IMessageSource }
      • Optional Readonlycatalogues?: never
      • Readonlysource: IMessageSource

        A source that loads the catalogues once at register().

    0.9.0