import { type PathDefinitionTranslations } from "@inlang/paraglide-js/internal/adapter-utils"; import type { ParamMatcher } from "@sveltejs/kit"; import type { Paraglide } from "./runtime.js"; import type { I18nUserConfig } from "./adapter.server.js"; /** * The _resolved_ configuration for the i18n instance. */ export type I18nConfig = { runtime: Paraglide; translations: PathDefinitionTranslations; exclude: (path: string) => boolean; defaultLanguageTag: T; matchers: Record; prefixDefaultLanguage: "always" | "never"; textDirection: Record; seo: { noAlternateLinks: boolean; }; }; /** * Creates an i18n instance that manages your internationalization. * * @param runtime The Paraglide runtime. * @param options The options for the i18n instance. * @returns An i18n instance. * * @example * ```ts * // src/lib/i18n.js * import * as runtime from "../paraglide/runtime.js" * import { createI18n } from "@inlang/paraglide-sveltekit" * * export const i18n = createI18n(runtime, { ...options }) * ``` */ export declare function createI18n(runtime: Paraglide, options?: I18nUserConfig): { /** * The configuration that was used to create this i18n instance. */ config: I18nConfig; /** * The routing strategy that's being used. * * @private Not part of the public API, may change in non-major versions */ strategy: { getLanguageFromLocalisedPath: (localisedPath: string) => T | undefined; getLocalisedPath: (canonicalPath: string, languageTag: T) => string; getCanonicalPath: (localisedPath: string, languageTag: T) => string; }; /** * Returns a `reroute` hook that applies the path translations to the paths. * Register it in your `src/hooks.js` file to enable path translations. * * @example * ```ts * // src/hooks.js * import { i18n } from "../lib/i18n.js" * export const reroute = i18n.reroute() * ``` */ reroute: () => import("@sveltejs/kit").Reroute; /** * Returns a `handle` hook that set's the correct `lang` attribute * on the `html` element * * SERVER ONLY */ handle: () => never; /** * Takes in a URL and returns the language that should be used for it. * * @param url * @returns */ getLanguageFromUrl(url: URL): T; /** * Takes in a route and returns a translated version of it. * This is useful for use in `goto` statements and `redirect` calls. * * The oposite of `i18n.route()`. * * @param canonicalPath The path to translate (eg _/base/about_) * @param lang The language to translate to - Defaults to the current language * @returns The translated path (eg _/base/de/ueber-uns_) * * @example * ```ts * redirect(i18n.resolveRoute("/base/about", "de")) * ``` */ resolveRoute(path: string, lang?: T | undefined): string; /** * Takes in a path in one language and returns it's canonical version. * The oposite of `i18n.resolveRoute()`. * This is useful for use in: * - Language Switchers * - Navigation * * @param targetedPathSource The path to translate (eg _/base/de/ueber-uns_) * @returns The canonical version path (eg _/base/about_) * * @example * ```ts * * ``` */ route(translatedPath: string): string; }; //# sourceMappingURL=adapter.client.d.ts.map