UNPKG

@prezly/theme-kit-react

Version:

Data layer and utility library for developing Prezly themes with NextJS

41 lines (40 loc) 1.56 kB
import type { IntlDictionary, IntlMessageDescriptor, IntlMessageValues, Locale, Timezone } from '@prezly/theme-kit-intl'; import type { ReactNode } from 'react'; export interface IntlContext { locale: Locale.Code; defaultLocale: Locale.Code; locales: Locale.Code[]; messages: IntlDictionary; timezone: Timezone; /** * Moment.js style date format from `Newsroom['date_format']`. When provided, * `FormattedDate` will format dates using this pattern. */ dateFormat?: string; /** * Moment.js style time format from `Newsroom['time_format']`. When provided, * `FormattedTime` will format times using this pattern. */ timeFormat?: string; } export declare function IntlProvider({ children, ...value }: IntlContext & { children: ReactNode; }): import("react/jsx-runtime").JSX.Element; export declare function useIntl(): { locale: Locale.Code; messages: Partial<Record<string, import("@prezly/theme-kit-intl").IntlMessageFormat>>; formatMessage: (descriptor: IntlMessageDescriptor, values?: IntlMessageValues<string>) => string; defaultLocale: Locale.Code; locales: Locale.Code[]; timezone: Timezone; /** * Moment.js style date format from `Newsroom['date_format']`. When provided, * `FormattedDate` will format dates using this pattern. */ dateFormat?: string; /** * Moment.js style time format from `Newsroom['time_format']`. When provided, * `FormattedTime` will format times using this pattern. */ timeFormat?: string; };