@inlang/paraglide-js
Version:
[](https://www.npmjs.com/package/@inlang/paraglide-js) [ {
* // do something
* }
*/
export declare const baseLocale = "en";
/**
* The project's locales that have been specified in the settings.
*
* @example
* if (locales.includes(userSelectedLocale) === false) {
* throw new Error('Locale is not available');
* }
*/
export declare const locales: readonly string[];
/** @type {string} */
export declare const cookieName: string;
/** @type {number} */
export declare const cookieMaxAge: number;
/** @type {string} */
export declare const cookieDomain: string;
/** @type {string} */
export declare const localStorageKey: string;
/**
* @type {Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>}
*/
export declare const strategy: Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>;
/**
* Route-level strategy overrides.
*
* `match` uses URLPattern syntax.
*
* @type {Array<{
* match: string;
* strategy?: Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>;
* exclude?: boolean;
* }>}
*/
export declare const routeStrategies: Array<{
match: string;
strategy?: Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>;
exclude?: boolean;
}>;
/**
* The used URL patterns.
*
* @type {Array<{ pattern: string, localized: Array<[Locale, string]> }>}
*/
export declare const urlPatterns: Array<{
pattern: string;
localized: Array<[Locale, string]>;
}>;
/**
* Returns the strategy to use for a specific URL.
*
* If no route strategy matches (or the matching rule is `exclude: true`),
* the global strategy is returned.
*
* @param {string | URL} url
* @returns {typeof strategy}
*/
export declare function getStrategyForUrl(url: string | URL): typeof strategy;
/**
* Returns whether the given URL is excluded from middleware i18n processing.
*
* @param {string | URL} url
* @returns {boolean}
*/
export declare function isExcludedByRouteStrategy(url: string | URL): boolean;
export type ParaglideAsyncLocalStorage = {
getStore(): {
locale?: Locale;
origin?: string;
messageCalls?: Set<string>;
} | undefined;
run: (store: {
locale?: Locale;
origin?: string;
messageCalls?: Set<string>;
}, cb: any) => any;
};
/**
* @typedef {{
* getStore(): {
* locale?: Locale,
* origin?: string,
* messageCalls?: Set<string>
* } | undefined,
* run: (store: { locale?: Locale, origin?: string, messageCalls?: Set<string>},
* cb: any) => any
* }} ParaglideAsyncLocalStorage
*/
/**
* Server side async local storage that is set by `serverMiddleware()`.
*
* The variable is used to retrieve the locale and origin in a server-side
* rendering context without effecting other requests.
*
* @type {ParaglideAsyncLocalStorage | undefined}
*/
export declare let serverAsyncLocalStorage: ParaglideAsyncLocalStorage | undefined;
export declare const disableAsyncLocalStorage = false;
export declare const experimentalMiddlewareLocaleSplitting = false;
export declare const isServer: boolean;
/** @type {Locale | undefined} */
export declare const experimentalStaticLocale: Locale | undefined;
/**
* Sets the server side async local storage.
*
* The function is needed because the `runtime.js` file
* must define the `serverAsyncLocalStorage` variable to
* avoid a circular import between `runtime.js` and
* `server.js` files.
*
* @param {ParaglideAsyncLocalStorage | undefined} value
*/
export declare function overwriteServerAsyncLocalStorage(value: ParaglideAsyncLocalStorage | undefined): void;
export declare const TREE_SHAKE_COOKIE_STRATEGY_USED = false;
export declare const TREE_SHAKE_URL_STRATEGY_USED = false;
export declare const TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
export declare const TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = false;
export declare const TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
export declare const TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
//# sourceMappingURL=variables.d.ts.map