tango-ui-cw
Version:
A lightweight ui library with ClayW
28 lines (21 loc) • 843 B
TypeScript
import type { PropsWithChildren } from "react";
export type TangoLocale = "zh-CN" | "en-US" | (string & {});
export type TangoMessages = Record<string, Record<string, unknown>>;
export interface TangoI18nContextValue {
locale: TangoLocale;
setLocale: (nextLocale: TangoLocale) => void;
toggleLocale: () => void;
messages: TangoMessages;
t: (key: string, fallback?: string) => string;
}
export interface TangoI18nProviderProps extends PropsWithChildren {
locale?: TangoLocale;
defaultLocale?: TangoLocale;
onLocaleChange?: (nextLocale: TangoLocale) => void;
messages?: TangoMessages;
}
export declare function TangoI18nProvider(
props: TangoI18nProviderProps
): JSX.Element;
export declare function useTangoI18n(): TangoI18nContextValue;
export declare function normalizeTangoLocale(locale: TangoLocale): TangoLocale;