@tupipu/translator
Version:
A lightweight, extensible, and production-ready translation framework built specifically for Next.js apps. This package simplifies internationalization (i18n) by combining static and dynamic translations, language detection, server/client rendering compat
24 lines (21 loc) • 698 B
TypeScript
import React from 'react';
type TranslatorProps = {
children: React.ReactNode;
userId: string;
email: string;
apiKeyId: string;
apiKey: string;
};
type TranslatorContextType = {
language: string;
setLanguage: (lang: string) => void;
translate: (text: string) => Promise<string>;
};
type Languages = Record<string, Record<string, unknown>>;
declare const TranslatorProvider: React.FC<TranslatorProps>;
declare const useTranslatorContext: () => TranslatorContextType;
declare const useTranslation: (languages: Languages) => {
t: (key: string) => Promise<string>;
};
export { TranslatorProvider, useTranslation, useTranslatorContext };
export type { Languages };