Skip to content

Instantly share code, notes, and snippets.

@tpinne
Created June 14, 2019 11:34
Show Gist options
  • Save tpinne/d6caa6aaae4bc5a028d4cf17ccc5e5ca to your computer and use it in GitHub Desktop.
Save tpinne/d6caa6aaae4bc5a028d4cf17ccc5e5ca to your computer and use it in GitHub Desktop.
// have a look a line 10 and 47 for the relevant changes
import * as React from 'react';
import {
TransProps,
Namespace,
// NamespaceExtractor,
// WithTranslationOptions,
WithTranslation,
withTranslation, // new import
// Subtract
} from 'react-i18next';
import { LinkProps } from 'next-server/link';
import { SingletonRouter } from 'next-server/router';
import i18next from 'i18next';
export type InitConfig = {
browserLanguageDetection?: boolean;
serverLanguageDetection?: boolean;
strictMode?: boolean;
defaultLanguage: string;
ignoreRoutes?: string[];
localePath?: string;
localeStructure?: string;
otherLanguages: string[];
localeSubpaths?: "none" | "foreign" | "all";
use?: any[];
customDetectors?: any[];
} & i18next.InitOptions;
export type Config = {
fallbackLng: boolean;
allLanguages: string[];
whitelist: string[];
preload: string[];
} & InitConfig;
declare class NextI18Next {
Trans: React.ComponentClass<TransProps>;
Link: React.ComponentClass<LinkProps>;
Router: SingletonRouter;
i18n: i18next.i18n;
config: Config;
constructor(config: InitConfig);
withTranslation: typeof withTranslation;
appWithTranslation<P extends object>(Component: React.ComponentType<P> | React.ElementType<P>): any;
}
export default NextI18Next;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment