UNPKG

react-intlayer

Version:

Easily internationalize i18n your React applications with type-safe multilingual content management.

31 lines (30 loc) 949 B
import { LocalesValues, StrictModeLocaleMap } from "@intlayer/types/module_augmentation"; //#region src/client/t.d.ts /** * Client-side translation function that returns the translation of the provided multilang content. * * If the locale is not provided, it will use the locale from the client context. * * @param multilangContent - An object mapping locales to their respective content. * @param locale - Optional locale to override the current context locale. * @returns The translation for the specified locale. * * @example * ```tsx * import { t } from 'react-intlayer'; * * const MyComponent = () => { * const greeting = t({ * en: 'Hello', * fr: 'Bonjour', * es: 'Hola', * }); * * return <h1>{greeting}</h1>; * }; * ``` */ declare const t: <Content = string>(multilangContent: StrictModeLocaleMap<Content>, locale?: LocalesValues) => Content; //#endregion export { t }; //# sourceMappingURL=t.d.ts.map