/** * High-level URL localization function optimized for client-side UI usage. * * This is a convenience wrapper around `localizeUrl()` that provides features * needed in UI: * * - Accepts relative paths (e.g., "/about") * - Returns relative paths when possible * - Automatically detects current locale if not specified * - Handles string input/output instead of URL objects * * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/i18n-routing * * @example * ```typescript * // In a React/Vue/Svelte component * const NavLink = ({ href }) => { * // Automatically uses current locale, keeps path relative * return ...; * }; * * // Examples: * localizeHref("/about") * // => "/de/about" (if current locale is "de") * localizeHref("/store", { locale: "fr" }) * // => "/fr/store" (explicit locale) * * // Cross-origin links remain absolute * localizeHref("https://other-site.com/about") * // => "https://other-site.com/de/about" * ``` * * For server-side URL localization (e.g., in middleware), use `localizeUrl()` * which provides more precise control over URL handling. * * @param {string} href - The href to localize (can be relative or absolute) * @param {object} [options] - Options for localization * @param {Locale} [options.locale] - Target locale. If not provided, uses `getLocale()` * @returns {string} The localized href, relative if input was relative */ export function localizeHref(href: string, options?: { locale?: string | undefined; }): string; /** * High-level URL de-localization function optimized for client-side UI usage. * * This is a convenience wrapper around `deLocalizeUrl()` that provides features * needed in the UI: * * - Accepts relative paths (e.g., "/de/about") * - Returns relative paths when possible * - Handles string input/output instead of URL objects * * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/i18n-routing * * @example * ```typescript * // In a React/Vue/Svelte component * const LocaleSwitcher = ({ href }) => { * // Remove locale prefix before switching * const baseHref = deLocalizeHref(href); * return locales.map(locale => * * Switch to {locale} * * ); * }; * * // Examples: * deLocalizeHref("/de/about") // => "/about" * deLocalizeHref("/fr/store") // => "/store" * * // Cross-origin links remain absolute * deLocalizeHref("https://example.com/de/about") * // => "https://example.com/about" * ``` * * For server-side URL de-localization (e.g., in middleware), use `deLocalizeUrl()` * which provides more precise control over URL handling. * * @param {string} href - The href to de-localize (can be relative or absolute) * @returns {string} The de-localized href, relative if input was relative */ export function deLocalizeHref(href: string): string; //# sourceMappingURL=localize-href.d.ts.map