UNPKG

react-statix

Version:

React components for statix localization management

35 lines (28 loc) 1 kB
import React, { ReactNode } from 'react'; import * as i18next from 'i18next'; type LanguagesKeys = Record<string, string>; interface StatixConfig { localePath: string; languagesKeys?: LanguagesKeys; onSave?: (changes: Record<string, Record<string, string>>) => void; } interface StatixProviderProps { config?: StatixConfig; children: React.ReactNode; } declare const StatixProvider: React.FC<StatixProviderProps>; declare const useEditableTranslation: () => { t: (key: string, options?: any) => ReactNode; i18n: i18next.i18n; }; interface StatixContextType { editable: boolean; setEditable: (value: boolean) => void; locales: Record<string, any>; updateLocalValue: (lang: string, key: string, value: string) => void; pendingChanges: Record<string, Record<string, string>>; resetChanges: () => void; saveChanges: () => void; } declare const useStatix: () => StatixContextType; export { StatixProvider, useEditableTranslation, useStatix };