UNPKG

next-translations

Version:
30 lines (29 loc) 1.65 kB
export type T_PageTranslations = { [key: string]: any; }; type T_Callback = { textBefore: string | undefined; textComponent: string | undefined; textAfter: string | undefined; }; type T_InitializeTranslations = { translations: T_PageTranslations; }; export type T_t = ((slug: string) => undefined) | ((slug?: string | undefined) => any | undefined); export type T_tString = ((slug: string) => undefined) | ((slug?: string | undefined) => string | undefined); export type T_tNumber = ((slug: string) => undefined) | ((slug?: string | undefined) => number | undefined); export type T_tArray = ((slug: string) => undefined) | ((slug?: string | undefined) => any[] | undefined); export type T_tObject = ((slug: string) => undefined) | ((slug?: string | undefined) => object | undefined); export type T_tComponent = ((slug: string, callback: ({}: T_Callback) => any) => any) | ((slug: string | undefined, callback: ({}: T_Callback) => any) => any); declare let pageTranslations: T_PageTranslations | null; declare const initializeTranslations: (translations: T_InitializeTranslations) => void; declare const useTranslation: (namespace?: string, disabledErrors?: boolean | undefined) => { t: T_t; tString: (slug?: string | undefined) => string | undefined; tNumber: (slug?: string | undefined) => number | undefined; tArray: (slug?: string | undefined) => any[] | undefined; tObject: (slug?: string | undefined) => object | undefined; tComponent: T_tComponent; pageTranslations: T_PageTranslations | null; }; export { initializeTranslations, pageTranslations, useTranslation };