123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- import { ReactElement, ReactNode } from 'react';
- export interface TranslationQuery {
- [name: string]: any;
- }
- export declare type Translate = <T = string>(i18nKey: string | TemplateStringsArray, query?: TranslationQuery | null, options?: {
- returnObjects?: boolean;
- fallback?: string | string[];
- default?: string;
- ns?: string;
- }) => T;
- export interface I18n {
- t: Translate;
- lang: string;
- }
- export interface I18nProviderProps {
- lang?: string;
- namespaces?: Record<string, I18nDictionary>;
- children?: ReactNode;
- config?: I18nConfig;
- }
- export interface TransProps {
- i18nKey: string;
- components?: ReactElement[] | Record<string, ReactElement>;
- values?: TranslationQuery;
- fallback?: string | string[];
- defaultTrans?: string;
- ns?: string;
- }
- export declare type PageValue = string[] | ((context: object) => string[]);
- export declare type LocaleLoader = (language: string | undefined, namespace: string) => Promise<I18nDictionary>;
- export interface I18nConfig {
- defaultLocale?: string;
- locales?: string[];
- loadLocaleFrom?: LocaleLoader;
- localesToIgnore?: string[];
- pages?: Record<string, PageValue>;
- logger?: I18nLogger;
- loggerEnvironment?: 'node' | 'browser' | 'both';
- staticsHoc?: Function;
- extensionsRgx?: string;
- loader?: boolean;
- logBuild?: boolean;
- revalidate?: number;
- pagesInDir?: string;
- interpolation?: {
- format?: Function;
- prefix: string;
- suffix: string;
- };
- keySeparator?: string | false;
- nsSeparator?: string | false;
- defaultNS?: string;
- }
- export interface LoaderConfig extends I18nConfig {
- locale?: string;
- router?: {
- locale: string;
- };
- pathname?: string;
- skipInitialProps?: boolean;
- loaderName?: string;
- isLoader?: boolean;
- [key: string]: any;
- }
- export interface LoggerProps {
- namespace: string | undefined;
- i18nKey: string;
- }
- export interface I18nLogger {
- (context: LoggerProps): void;
- }
- export interface I18nDictionary {
- [key: string]: string | I18nDictionary;
- }
- export interface DynamicNamespacesProps {
- dynamic?: LocaleLoader;
- namespaces?: string[];
- fallback?: ReactNode;
- children?: ReactNode;
- }
- declare global {
- module NodeJS {
- interface Global {
- i18nConfig: LoaderConfig;
- }
- }
- interface Window {
- i18nConfig: LoaderConfig;
- }
- }
|