23 lines
1.1 KiB
TypeScript
23 lines
1.1 KiB
TypeScript
/** Map of locale code → absolute-or-relative URL for the current page. */
|
|
export type AlternateLinks = Record<string, string>;
|
|
/**
|
|
* Holds the current page's per-locale URLs so a LanguageSwitcher links to the
|
|
* CORRECT localized slug instead of naively swapping the locale prefix
|
|
* (/pl/uslugi → /en/uslugi, which 404s when the English slug is /en/services).
|
|
*
|
|
* Wrap the app once; each page reports its own alternates via
|
|
* <AlternateLinksUpdater> (or useSetAlternateLinks). The switcher reads them
|
|
* with useAlternateLinks().
|
|
*
|
|
* // layout.tsx
|
|
* import { AlternateLinksProvider } from '@intecion/ipal-kit/client'
|
|
* <AlternateLinksProvider>{children}</AlternateLinksProvider>
|
|
*/
|
|
export declare function AlternateLinksProvider({ children }: {
|
|
children: React.ReactNode;
|
|
}): import("react/jsx-runtime").JSX.Element;
|
|
/** Read the current page's per-locale URLs (for a language switcher). */
|
|
export declare function useAlternateLinks(): AlternateLinks;
|
|
/** Setter for the alternates (used by AlternateLinksUpdater). */
|
|
export declare function useSetAlternateLinks(): (links: AlternateLinks) => void;
|