37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import type { I18nConfig } from './types.js';
|
|
export type LanguageSwitcherClassNames = {
|
|
item?: string;
|
|
itemActive?: string;
|
|
menu?: string;
|
|
root?: string;
|
|
trigger?: string;
|
|
};
|
|
type LocaleItem = {
|
|
code: string;
|
|
label: string;
|
|
};
|
|
/**
|
|
* Language switcher that links to the CORRECT localized URL per language,
|
|
* reading the current page's alternates from AlternateLinksProvider — so it
|
|
* never 404s on differing slugs (/pl/uslugi vs /en/services).
|
|
*
|
|
* Unstyled by default (classNames, like CookieBanner) — NOT a fixed
|
|
* light/dark variant, so it matches any project's design. A locale with no
|
|
* known alternate falls back to its root (/{code}).
|
|
*
|
|
* // layout/header (client), inside AlternateLinksProvider
|
|
* <LanguageSwitcher
|
|
* config={i18nConfig}
|
|
* currentLocale={locale}
|
|
* classNames={{ root: '...', trigger: '...', menu: '...', item: '...' }}
|
|
* />
|
|
*/
|
|
export declare function LanguageSwitcher({ classNames, config, currentLocale, renderLabel, }: {
|
|
classNames?: LanguageSwitcherClassNames;
|
|
config: I18nConfig;
|
|
currentLocale: string;
|
|
/** Custom label per locale (e.g. flag + code). Defaults to the config label. */
|
|
renderLabel?: (locale: LocaleItem) => React.ReactNode;
|
|
}): import("react/jsx-runtime").JSX.Element;
|
|
export {};
|