react-statix
Version:
React components for statix localization management
42 lines (34 loc) • 1.19 kB
TypeScript
import React, { ReactNode } from 'react';
import * as i18next from 'i18next';
type LanguagesKeys = Record<string, string>;
interface StatixConfig {
localePath: string;
languagesKeys?: LanguagesKeys;
editable?: boolean;
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;
locales: Record<string, any>;
updateLocalValue: (lang: string, key: string, value: string) => void;
pendingChanges: Record<string, Record<string, string>>;
resetChanges: () => void;
saveChanges: () => void;
usedLocales: Set<string>;
addUsedLocale: (key: string) => void;
}
declare const useStatix: () => StatixContextType;
interface LocaleTableProps {
localeData: Record<string, any>;
}
declare const LocaleTable: React.FC<LocaleTableProps>;
export { LocaleTable, StatixProvider, useEditableTranslation, useStatix };