i18next

  • Version 23.10.1
  • Published
  • 634 kB
  • 1 dependency
  • MIT license

Install

npm i i18next
yarn add i18next
pnpm add i18next

Overview

i18next internationalization framework

Index

Variables

Classes

Interfaces

Type Aliases

Variables

variable ActualOptions

const ActualOptions: any;

    variable changeLanguage

    const changeLanguage: (
    lng?: string,
    callback?: Callback
    ) => Promise<TFunction<'translation', undefined>>;

      variable createInstance

      const createInstance: (options?: InitOptions<object>, callback?: Callback) => i18n;

        variable dir

        const dir: (lng?: string) => 'ltr' | 'rtl';

          variable exists

          const exists: ExistsFunction<string, $Dictionary<unknown>>;

            variable getFixedT

            const getFixedT: <
            Ns extends Namespace<string> = 'translation',
            TKPrefix extends string = undefined,
            ActualNs extends Namespace<string> = Ns extends null ? 'translation' : Ns
            >(
            ...args:
            | [lng: string | readonly string[], ns?: Ns, keyPrefix?: TKPrefix]
            | [lng: null, ns: Ns, keyPrefix?: TKPrefix]
            ) => TFunction<ActualNs, TKPrefix>;

              variable hasLoadedNamespace

              const hasLoadedNamespace: {
              (
              ns: string | readonly string[],
              options?: {
              lng?: string | readonly string[];
              precheck: (
              i18n: i18n,
              loadNotPending: (
              lng: string | readonly string[],
              ns: string | readonly string[]
              ) => boolean
              ) => boolean;
              }
              ): boolean;
              (ns: string, options?: Pick<InitOptions<object>, 'fallbackLng'>): boolean;
              };

                variable i18next

                const i18next: i18n;

                  variable init

                  const init: {
                  (callback?: Callback): Promise<TFunction<'translation', undefined>>;
                  <T>(options: InitOptions<T>, callback?: Callback): Promise<
                  TFunction<'translation', undefined>
                  >;
                  };

                    variable Key

                    const Key: any;

                      variable loadLanguages

                      const loadLanguages: (
                      lngs: string | readonly string[],
                      callback?: Callback
                      ) => Promise<void>;

                        variable loadNamespaces

                        const loadNamespaces: (
                        ns: string | readonly string[],
                        callback?: Callback
                        ) => Promise<void>;

                          variable loadResources

                          const loadResources: (callback?: (err: any) => void) => void;

                            variable ParseKeys

                            const ParseKeys: any;

                              variable reloadResources

                              const reloadResources: {
                              (
                              lngs?: string | readonly string[],
                              ns?: string | readonly string[],
                              callback?: () => void
                              ): Promise<void>;
                              (
                              lngs: null,
                              ns: string | readonly string[],
                              callback?: () => void
                              ): Promise<void>;
                              };

                                variable Ret

                                const Ret: any;

                                  variable setDefaultNamespace

                                  const setDefaultNamespace: (ns: string) => void;

                                    variable t

                                    const t: TFunction<['translation', ...string[]], undefined>;

                                      variable TFunctionReturn

                                      const TFunctionReturn: any;

                                        variable TOpt

                                        const TOpt: any;

                                          variable use

                                          const use: <T extends Module>(module: T | NewableModule<T> | Newable<T>) => i18n;

                                            Classes

                                            class ResourceStore

                                            class ResourceStore {}

                                              constructor

                                              constructor(data: Resource, options: InitOptions<object>);

                                                property data

                                                data: Resource;

                                                  property options

                                                  options: InitOptions<object>;

                                                    method off

                                                    off: (
                                                    event: 'added' | 'removed',
                                                    callback?: (lng: string, ns: string) => void
                                                    ) => void;
                                                    • Remove event listener removes all callback when callback not specified

                                                    method on

                                                    on: (
                                                    event: 'added' | 'removed',
                                                    callback: (lng: string, ns: string) => void
                                                    ) => void;
                                                    • Gets fired when resources got added or removed

                                                    Interfaces

                                                    interface BackendModule

                                                    interface BackendModule<Options = object> extends Module {}
                                                    • Used to load data for i18next. Can be provided as a singleton or as a prototype constructor (preferred for supporting multiple instances of i18next). For singleton set property type to 'backend' For a prototype constructor set static property.

                                                    property type

                                                    type: 'backend';

                                                      method create

                                                      create: (
                                                      languages: readonly string[],
                                                      namespace: string,
                                                      key: string,
                                                      fallbackValue: string
                                                      ) => void;
                                                      • Save the missing translation

                                                      method init

                                                      init: (
                                                      services: Services,
                                                      backendOptions: Options,
                                                      i18nextOptions: InitOptions
                                                      ) => void;

                                                        method read

                                                        read: (language: string, namespace: string, callback: ReadCallback) => void;

                                                          method readMulti

                                                          readMulti: (
                                                          languages: readonly string[],
                                                          namespaces: readonly string[],
                                                          callback: MultiReadCallback
                                                          ) => void;
                                                          • Load multiple languages and namespaces. For backends supporting multiple resources loading

                                                          method save

                                                          save: (language: string, namespace: string, data: ResourceLanguage) => void;
                                                          • Store the translation. For backends acting as cache layer

                                                          interface CloneOptions

                                                          interface CloneOptions extends InitOptions {}

                                                            property forkResourceStore

                                                            forkResourceStore?: boolean;
                                                            • Will create a new instance of the resource store and import the existing translation resources. This way it will not shared the resource store instance. false

                                                            interface CustomInstanceExtensions

                                                            interface CustomInstanceExtensions {}

                                                              interface CustomPluginOptions

                                                              interface CustomPluginOptions {}
                                                              • This interface can be augmented by users to add types to i18next default PluginOptions.

                                                              interface CustomTypeOptions

                                                              interface CustomTypeOptions {}
                                                              • This interface can be augmented by users to add types to i18next default TypeOptions.

                                                                Usage:

                                                                // i18next.d.ts
                                                                import 'i18next';
                                                                declare module 'i18next' {
                                                                interface CustomTypeOptions {
                                                                defaultNS: 'custom';
                                                                returnNull: false;
                                                                returnObjects: false;
                                                                nsSeparator: ':';
                                                                keySeparator: '.';
                                                                jsonFormat: 'v4';
                                                                allowObjectInHTMLChildren: false;
                                                                resources: {
                                                                custom: {
                                                                foo: 'foo';
                                                                };
                                                                };
                                                                }
                                                                }

                                                              interface ExistsFunction

                                                              interface ExistsFunction<
                                                              TKeys extends string = string,
                                                              TInterpolationMap extends object = $Dictionary
                                                              > {}
                                                              • Uses similar args as the t function and returns true if a key exists.

                                                              call signature

                                                              (key: TKeys | TKeys[], options?: TOptions<TInterpolationMap>): boolean;

                                                                interface FallbackLngObjList

                                                                interface FallbackLngObjList {}

                                                                  index signature

                                                                  [language: string]: readonly string[];

                                                                    interface Formatter

                                                                    interface Formatter {}

                                                                      property format

                                                                      format: FormatFunction;

                                                                        method add

                                                                        add: (
                                                                        name: string,
                                                                        fc: (value: any, lng: string | undefined, options: any) => string
                                                                        ) => void;

                                                                          method addCached

                                                                          addCached: (
                                                                          name: string,
                                                                          fc: (lng: string | undefined, options: any) => (value: any) => string
                                                                          ) => void;

                                                                            method init

                                                                            init: (services: Services, i18nextOptions: InitOptions) => void;

                                                                              interface FormatterModule

                                                                              interface FormatterModule extends Module, Formatter {}

                                                                                property type

                                                                                type: 'formatter';

                                                                                  interface i18n

                                                                                  interface i18n extends CustomInstanceExtensions {}

                                                                                    property exists

                                                                                    exists: ExistsFunction;
                                                                                    • Uses similar args as the t function and returns true if a key exists.

                                                                                    property format

                                                                                    format: FormatFunction;
                                                                                    • Exposes interpolation.format function added on init.

                                                                                    property initializedLanguageOnce

                                                                                    initializedLanguageOnce: boolean;
                                                                                    • Language was initialized

                                                                                    property initializedStoreOnce

                                                                                    initializedStoreOnce: boolean;
                                                                                    • Store was initialized

                                                                                    property isInitialized

                                                                                    isInitialized: boolean;
                                                                                    • Is initialized

                                                                                    property isInitializing

                                                                                    isInitializing: boolean;
                                                                                    • Is initializing

                                                                                    property language

                                                                                    language: string;
                                                                                    • Is set to the current detected or set language. If you need the primary used language depending on your configuration (supportedLngs, load) you will prefer using i18next.languages[0].

                                                                                    property languages

                                                                                    languages: readonly string[];
                                                                                    • Is set to an array of language-codes that will be used it order to lookup the translation value.

                                                                                    property modules

                                                                                    modules: Modules;
                                                                                    • List of modules used

                                                                                    property options

                                                                                    options: InitOptions;
                                                                                    • Current options

                                                                                    property resolvedLanguage

                                                                                    resolvedLanguage?: string;
                                                                                    • Is set to the current resolved language. It can be used as primary used language, for example in a language switcher.

                                                                                    property services

                                                                                    services: Services;
                                                                                    • Internal container for all used plugins and implementation details like languageUtils, pluralResolvers, etc.

                                                                                    property store

                                                                                    store: ResourceStore;
                                                                                    • Internal container for translation resources

                                                                                    property t

                                                                                    t: TFunction<
                                                                                    [
                                                                                    ...$NormalizeIntoArray<DefaultNamespace>,
                                                                                    ...Exclude<
                                                                                    FlatNamespace,
                                                                                    InferArrayValuesElseReturnType<DefaultNamespace>
                                                                                    >[]
                                                                                    ]
                                                                                    >;

                                                                                      method addResource

                                                                                      addResource: (
                                                                                      lng: string,
                                                                                      ns: string,
                                                                                      key: string,
                                                                                      value: string,
                                                                                      options?: { keySeparator?: string; silent?: boolean }
                                                                                      ) => i18n;
                                                                                      • Adds one key/value.

                                                                                      method addResourceBundle

                                                                                      addResourceBundle: (
                                                                                      lng: string,
                                                                                      ns: string,
                                                                                      resources: any,
                                                                                      deep?: boolean,
                                                                                      overwrite?: boolean
                                                                                      ) => i18n;
                                                                                      • Adds a complete bundle. Setting deep param to true will extend existing translations in that file. Setting overwrite to true it will overwrite existing translations in that file.

                                                                                      method addResources

                                                                                      addResources: (lng: string, ns: string, resources: any) => i18n;
                                                                                      • Adds multiple key/values.

                                                                                      method changeLanguage

                                                                                      changeLanguage: (lng?: string, callback?: Callback) => Promise<TFunction>;
                                                                                      • Changes the language. The callback will be called as soon translations were loaded or an error occurs while loading. HINT: For easy testing - setting lng to 'cimode' will set t function to always return the key.

                                                                                      method cloneInstance

                                                                                      cloneInstance: (options?: CloneOptions, callback?: Callback) => i18n;
                                                                                      • Creates a clone of the current instance. Shares store, plugins and initial configuration. Can be used to create an instance sharing storage but being independent on set language or namespaces.

                                                                                      method createInstance

                                                                                      createInstance: (options?: InitOptions, callback?: Callback) => i18n;
                                                                                      • Will return a new i18next instance. Please read the options page for details on configuration options. Providing a callback will automatically call init. The callback will be called after all translations were loaded or with an error when failed (in case of using a backend).

                                                                                      method dir

                                                                                      dir: (lng?: string) => 'ltr' | 'rtl';
                                                                                      • Returns rtl or ltr depending on languages read direction.

                                                                                      method emit

                                                                                      emit: (eventName: string, ...args: any[]) => void;
                                                                                      • Emit event

                                                                                      method getDataByLanguage

                                                                                      getDataByLanguage: (lng: string) => { [key: string]: { [key: string]: string } };
                                                                                      • Returns a resource data by language.

                                                                                      method getFixedT

                                                                                      getFixedT: <
                                                                                      Ns extends Namespace<string> = 'translation',
                                                                                      TKPrefix extends string = undefined,
                                                                                      ActualNs extends Namespace<string> = Ns extends null ? 'translation' : Ns
                                                                                      >(
                                                                                      ...args:
                                                                                      | [lng: string | readonly string[], ns?: Ns, keyPrefix?: TKPrefix]
                                                                                      | [lng: null, ns: Ns, keyPrefix?: TKPrefix]
                                                                                      ) => TFunction<ActualNs, TKPrefix>;
                                                                                      • Returns a t function that defaults to given language or namespace. Both params could be arrays of languages or namespaces and will be treated as fallbacks in that case. On the returned function you can like in the t function override the languages or namespaces by passing them in options or by prepending namespace.

                                                                                        Accepts optional keyPrefix that will be automatically applied to returned t function.

                                                                                      method getResource

                                                                                      getResource: (
                                                                                      lng: string,
                                                                                      ns: string,
                                                                                      key: string,
                                                                                      options?: Pick<InitOptions, 'keySeparator' | 'ignoreJSONStructure'>
                                                                                      ) => any;
                                                                                      • Gets one value by given key.

                                                                                      method getResourceBundle

                                                                                      getResourceBundle: (lng: string, ns: string) => any;
                                                                                      • Returns a resource bundle.

                                                                                      method hasLoadedNamespace

                                                                                      hasLoadedNamespace: {
                                                                                      (
                                                                                      ns: string | readonly string[],
                                                                                      options?: {
                                                                                      lng?: string | readonly string[];
                                                                                      precheck: (
                                                                                      i18n: i18n,
                                                                                      loadNotPending: (
                                                                                      lng: string | readonly string[],
                                                                                      ns: string | readonly string[]
                                                                                      ) => boolean
                                                                                      ) => boolean;
                                                                                      }
                                                                                      ): boolean;
                                                                                      (ns: string, options?: Pick<InitOptions<object>, 'fallbackLng'>): boolean;
                                                                                      };
                                                                                      • Checks if namespace has loaded yet. i.e. used by react-i18next

                                                                                      • Checks if a namespace has been loaded.

                                                                                      method hasResourceBundle

                                                                                      hasResourceBundle: (lng: string, ns: string) => boolean;
                                                                                      • Checks if a resource bundle exists.

                                                                                      method init

                                                                                      init: {
                                                                                      (callback?: Callback): Promise<TFunction>;
                                                                                      <T>(options: InitOptions<T>, callback?: Callback): Promise<
                                                                                      TFunction<'translation', undefined>
                                                                                      >;
                                                                                      };
                                                                                      • The default of the i18next module is an i18next instance ready to be initialized by calling init. You can create additional instances using the createInstance function.

                                                                                        Parameter options

                                                                                        Initial options.

                                                                                        Parameter callback

                                                                                        will be called after all translations were loaded or with an error when failed (in case of using a backend).

                                                                                      method loadLanguages

                                                                                      loadLanguages: (
                                                                                      lngs: string | readonly string[],
                                                                                      callback?: Callback
                                                                                      ) => Promise<void>;
                                                                                      • Loads additional languages not defined in init options (preload).

                                                                                      method loadNamespaces

                                                                                      loadNamespaces: (
                                                                                      ns: string | readonly string[],
                                                                                      callback?: Callback
                                                                                      ) => Promise<void>;
                                                                                      • Loads additional namespaces not defined in init options.

                                                                                      method loadResources

                                                                                      loadResources: (callback?: (err: any) => void) => void;

                                                                                        method off

                                                                                        off: (event: string, listener?: (...args: any[]) => void) => void;
                                                                                        • Remove event listener removes all callback when callback not specified

                                                                                        method on

                                                                                        on: {
                                                                                        (event: 'initialized', callback: (options: InitOptions) => void): void;
                                                                                        (
                                                                                        event: 'loaded',
                                                                                        callback: (loaded: {
                                                                                        [language: string]: { [namespace: string]: boolean };
                                                                                        }) => void
                                                                                        ): void;
                                                                                        (
                                                                                        event: 'failedLoading',
                                                                                        callback: (lng: string, ns: string, msg: string) => void
                                                                                        ): void;
                                                                                        (
                                                                                        event: 'missingKey',
                                                                                        callback: (
                                                                                        lngs: readonly string[],
                                                                                        namespace: string,
                                                                                        key: string,
                                                                                        res: string
                                                                                        ) => void
                                                                                        ): void;
                                                                                        (
                                                                                        event: 'added' | 'removed',
                                                                                        callback: (lng: string, ns: string) => void
                                                                                        ): void;
                                                                                        (event: 'languageChanged', callback: (lng: string) => void): void;
                                                                                        (event: string, listener: (...args: any[]) => void): void;
                                                                                        };
                                                                                        • Gets fired after initialization.

                                                                                        • Gets fired on loaded resources.

                                                                                        • Gets fired if loading resources failed.

                                                                                        • Gets fired on accessing a key not existing.

                                                                                        • Gets fired when resources got added or removed.

                                                                                        • Gets fired when changeLanguage got called.

                                                                                        • Event listener

                                                                                        method reloadResources

                                                                                        reloadResources: {
                                                                                        (
                                                                                        lngs?: string | readonly string[],
                                                                                        ns?: string | readonly string[],
                                                                                        callback?: () => void
                                                                                        ): Promise<void>;
                                                                                        (
                                                                                        lngs: null,
                                                                                        ns: string | readonly string[],
                                                                                        callback?: () => void
                                                                                        ): Promise<void>;
                                                                                        };
                                                                                        • Reloads resources on given state. Optionally you can pass an array of languages and namespaces as params if you don't want to reload all.

                                                                                        method removeResourceBundle

                                                                                        removeResourceBundle: (lng: string, ns: string) => i18n;
                                                                                        • Removes an existing bundle.

                                                                                        method setDefaultNamespace

                                                                                        setDefaultNamespace: (ns: string) => void;
                                                                                        • Changes the default namespace.

                                                                                        method use

                                                                                        use: <T extends Module>(module: T | NewableModule<T> | Newable<T>) => this;
                                                                                        • The use function is there to load additional plugins to i18next. For available module see the plugins page and don't forget to read the documentation of the plugin.

                                                                                          Parameter module

                                                                                          Accepts a class or object

                                                                                        interface I18nFormatModule

                                                                                        interface I18nFormatModule extends Module {}

                                                                                          property type

                                                                                          type: 'i18nFormat';

                                                                                            interface InitOptions

                                                                                            interface InitOptions<T = object> extends PluginOptions<T> {}

                                                                                              property appendNamespaceToCIMode

                                                                                              appendNamespaceToCIMode?: boolean;
                                                                                              • Prefixes the namespace to the returned key when using cimode false

                                                                                              property appendNamespaceToMissingKey

                                                                                              appendNamespaceToMissingKey?: boolean;
                                                                                              • Appends namespace to missing key false

                                                                                              property cleanCode

                                                                                              cleanCode?: boolean;
                                                                                              • Language will be lowercased EN --> en while leaving full locales like en-US false

                                                                                              property compatibilityJSON

                                                                                              compatibilityJSON?: 'v1' | 'v2' | 'v3' | 'v4';
                                                                                              • Compatibility JSON version 'v4'

                                                                                              property contextSeparator

                                                                                              contextSeparator?: string;
                                                                                              • Char to split context from key '_'

                                                                                              property debug

                                                                                              debug?: boolean;
                                                                                              • Logs info level to console output. Helps finding issues with loading not working. false

                                                                                              property defaultNS

                                                                                              defaultNS?: string | false | readonly string[];
                                                                                              • Default namespace used if not passed to translation function 'translation'

                                                                                              property fallbackLng

                                                                                              fallbackLng?: false | FallbackLng;
                                                                                              • Language to use if translations in user language are not available. 'dev'

                                                                                              property fallbackNS

                                                                                              fallbackNS?: false | string | readonly string[];
                                                                                              • String or array of namespaces to lookup key if not found in given namespace. false

                                                                                              property ignoreJSONStructure

                                                                                              ignoreJSONStructure?: boolean;
                                                                                              • Automatically lookup for a flat key if a nested key is not found an vice-versa true

                                                                                              property initImmediate

                                                                                              initImmediate?: boolean;
                                                                                              • Triggers resource loading in init function inside a setTimeout (default async behaviour). Set it to false if your backend loads resources sync - that way calling i18next.t after init is possible without relaying on the init callback. true

                                                                                              property interpolation

                                                                                              interpolation?: InterpolationOptions;
                                                                                              • See Also

                                                                                                • https://www.i18next.com/translation-function/interpolation

                                                                                              property joinArrays

                                                                                              joinArrays?: false | string;
                                                                                              • Char, eg. '\n' that arrays will be joined by false

                                                                                              property keySeparator

                                                                                              keySeparator?: false | string;
                                                                                              • Char to separate keys '.'

                                                                                              property lng

                                                                                              lng?: string;
                                                                                              • Language to use (overrides language detection) undefined

                                                                                              property load

                                                                                              load?: 'all' | 'currentOnly' | 'languageOnly';
                                                                                              • Language codes to lookup, given set language is 'en-US': 'all' --> ['en-US', 'en', 'dev'], 'currentOnly' --> 'en-US', 'languageOnly' --> 'en' 'all'

                                                                                              property locizeLastUsed

                                                                                              locizeLastUsed?: {
                                                                                              /**
                                                                                              * The id of your locize project
                                                                                              */
                                                                                              projectId: string;
                                                                                              /**
                                                                                              * An api key if you want to send missing keys
                                                                                              */
                                                                                              apiKey?: string;
                                                                                              /**
                                                                                              * The reference language of your project
                                                                                              * @default 'en'
                                                                                              */
                                                                                              referenceLng?: string;
                                                                                              /**
                                                                                              * Version
                                                                                              * @default 'latest'
                                                                                              */
                                                                                              version?: string;
                                                                                              /**
                                                                                              * Debounce interval to send data in milliseconds
                                                                                              * @default 90000
                                                                                              */
                                                                                              debounceSubmit?: number;
                                                                                              /**
                                                                                              * Hostnames that are allowed to send last used data.
                                                                                              * Please keep those to your local system, staging, test servers (not production)
                                                                                              * @default ['localhost']
                                                                                              */
                                                                                              allowedHosts?: readonly string[];
                                                                                              };
                                                                                              • Options for https://github.com/locize/locize-lastused undefined

                                                                                              property lowerCaseLng

                                                                                              lowerCaseLng?: boolean;
                                                                                              • Language will be lowercased eg. en-US --> en-us false

                                                                                              property maxParallelReads

                                                                                              maxParallelReads?: number;
                                                                                              • Limit parallelism of calls to backend This is needed to prevent trying to open thousands of sockets or file descriptors, which can cause failures and actually make the entire process take longer. 10

                                                                                              property maxRetries

                                                                                              maxRetries?: number;
                                                                                              • The maximum number of retries to perform. Note that retries are only performed when a request has no response and throws an error. The default value is used if value is set below 0. 5

                                                                                              property missingInterpolationHandler

                                                                                              missingInterpolationHandler?: (
                                                                                              text: string,
                                                                                              value: any,
                                                                                              options: InitOptions
                                                                                              ) => any;
                                                                                              • Gets called in case a interpolation value is undefined. This method will not be called if the value is empty string or null noop

                                                                                              property missingKeyHandler

                                                                                              missingKeyHandler?:
                                                                                              | false
                                                                                              | ((
                                                                                              lngs: readonly string[],
                                                                                              ns: string,
                                                                                              key: string,
                                                                                              fallbackValue: string,
                                                                                              updateMissing: boolean,
                                                                                              options: any
                                                                                              ) => void);
                                                                                              • Used for custom missing key handling (needs saveMissing set to true!) false

                                                                                              property missingKeyNoValueFallbackToKey

                                                                                              missingKeyNoValueFallbackToKey?: boolean;
                                                                                              • Used to not fallback to the key as default value, when using saveMissing functionality. i.e. when using with i18next-http-backend this will result in having a key with an empty string value. false

                                                                                              property nonExplicitSupportedLngs

                                                                                              nonExplicitSupportedLngs?: boolean;
                                                                                              • If true will pass eg. en-US if finding en in supportedLngs false

                                                                                              property ns

                                                                                              ns?: string | readonly string[];
                                                                                              • String or array of namespaces to load 'translation'

                                                                                              property nsSeparator

                                                                                              nsSeparator?: false | string;
                                                                                              • Char to split namespace from key ':'

                                                                                              property partialBundledLanguages

                                                                                              partialBundledLanguages?: boolean;
                                                                                              • Allow initializing with bundled resources while using a backend to load non bundled ones. false

                                                                                              property pluralSeparator

                                                                                              pluralSeparator?: string;
                                                                                              • Char to split plural from key '_'

                                                                                              property postProcess

                                                                                              postProcess?: false | string | readonly string[];
                                                                                              • String or array of postProcessors to apply per default false

                                                                                              property postProcessPassResolved

                                                                                              postProcessPassResolved?: boolean;
                                                                                              • passthrough the resolved object including 'usedNS', 'usedLang' etc into options object of postprocessors as 'i18nResolved' property false

                                                                                              property preload

                                                                                              preload?: false | readonly string[];
                                                                                              • Array of languages to preload. Important on server-side to assert translations are loaded before rendering views. false

                                                                                              property react

                                                                                              react?: ReactOptions;
                                                                                              • Options for react - check documentation of plugin undefined

                                                                                              property resources

                                                                                              resources?: Resource;
                                                                                              • Resources to initialize with (if not using loading or not appending using addResourceBundle) undefined

                                                                                              property retryTimeout

                                                                                              retryTimeout?: number;
                                                                                              • Set how long to wait, in milliseconds, between retries of failed requests. This number is compounded by a factor of 2 for subsequent retry. The default value is used if value is set below 1ms. 350

                                                                                              property returnDetails

                                                                                              returnDetails?: boolean;
                                                                                              • Returns an object that includes information about the used language, namespace, key and value false

                                                                                              property returnEmptyString

                                                                                              returnEmptyString?: boolean;
                                                                                              • Allows empty string as valid translation true

                                                                                              property returnNull

                                                                                              returnNull?: boolean;
                                                                                              • Allows null values as valid translation false

                                                                                              property returnObjects

                                                                                              returnObjects?: boolean;
                                                                                              • Allows objects as valid translation result false

                                                                                              property saveMissing

                                                                                              saveMissing?: boolean;
                                                                                              • Calls save missing key function on backend if key not found. false

                                                                                              property saveMissingPlurals

                                                                                              saveMissingPlurals?: boolean;
                                                                                              • Calls save missing key function on backend if key not found also for plural forms. false

                                                                                              property saveMissingTo

                                                                                              saveMissingTo?: 'current' | 'all' | 'fallback';
                                                                                              • 'fallback'

                                                                                              property simplifyPluralSuffix

                                                                                              simplifyPluralSuffix?: boolean;
                                                                                              • Will use 'plural' as suffix for languages only having 1 plural form, setting it to false will suffix all with numbers true

                                                                                              property supportedLngs

                                                                                              supportedLngs?: false | readonly string[];
                                                                                              • Array of allowed languages false

                                                                                              property updateMissing

                                                                                              updateMissing?: boolean;
                                                                                              • Experimental: enable to update default values using the saveMissing (Works only if defaultValue different from translated value. Only useful on initial development or when keeping code as source of truth not changing values outside of code. Only supported if backend supports it already) false

                                                                                              method overloadTranslationOptionHandler

                                                                                              overloadTranslationOptionHandler: (args: string[]) => TOptions;
                                                                                              • Sets defaultValue args => ({ defaultValue: args[1] })

                                                                                              method parseMissingKeyHandler

                                                                                              parseMissingKeyHandler: (key: string, defaultValue?: string) => any;
                                                                                              • Receives a key that was not found in t() and returns a value, that will be returned by t() noop

                                                                                              method returnedObjectHandler

                                                                                              returnedObjectHandler: (key: string, value: string, options: any) => void;
                                                                                              • Gets called if object was passed in as key but returnObjects was set to false noop

                                                                                              interface InterpolationOptions

                                                                                              interface InterpolationOptions {}

                                                                                                property alwaysFormat

                                                                                                alwaysFormat?: boolean;
                                                                                                • Always format interpolated values. false

                                                                                                property defaultVariables

                                                                                                defaultVariables?: { [index: string]: any };
                                                                                                • Global variables to use in interpolation replacements undefined

                                                                                                property escapeValue

                                                                                                escapeValue?: boolean;
                                                                                                • Escape passed in values to avoid xss injection true

                                                                                                property format

                                                                                                format?: FormatFunction;
                                                                                                • Format function see formatting for details noop

                                                                                                property formatSeparator

                                                                                                formatSeparator?: string;
                                                                                                • Used to separate format from interpolation value ','

                                                                                                property maxReplaces

                                                                                                maxReplaces?: number;
                                                                                                • After how many interpolation runs to break out before throwing a stack overflow 1000

                                                                                                property nestingOptionsSeparator

                                                                                                nestingOptionsSeparator?: string;
                                                                                                • Separates options from key ','

                                                                                                property nestingPrefix

                                                                                                nestingPrefix?: string;
                                                                                                • Prefix for nesting '$t('

                                                                                                property nestingPrefixEscaped

                                                                                                nestingPrefixEscaped?: string;
                                                                                                • Escaped prefix for nesting (regexSafe) undefined

                                                                                                property nestingSuffix

                                                                                                nestingSuffix?: string;
                                                                                                • Suffix for nesting ')'

                                                                                                property nestingSuffixEscaped

                                                                                                nestingSuffixEscaped?: string;
                                                                                                • Escaped suffix for nesting (regexSafe) undefined

                                                                                                property prefix

                                                                                                prefix?: string;
                                                                                                • Prefix for interpolation '{{'

                                                                                                property prefixEscaped

                                                                                                prefixEscaped?: string;
                                                                                                • Escaped prefix for interpolation (regexSafe) undefined

                                                                                                property skipOnVariables

                                                                                                skipOnVariables?: boolean;
                                                                                                • If true, it will skip to interpolate the variables true

                                                                                                property suffix

                                                                                                suffix?: string;
                                                                                                • Suffix for interpolation '}}'

                                                                                                property suffixEscaped

                                                                                                suffixEscaped?: string;
                                                                                                • Escaped suffix for interpolation (regexSafe) undefined

                                                                                                property unescapePrefix

                                                                                                unescapePrefix?: string;
                                                                                                • Prefix to unescaped mode '-'

                                                                                                property unescapeSuffix

                                                                                                unescapeSuffix?: string;
                                                                                                • Suffix to unescaped mode undefined

                                                                                                property useRawValueToEscape

                                                                                                useRawValueToEscape?: boolean;
                                                                                                • If true, then value passed into escape function is not casted to string, use with custom escape function that does its own type check false

                                                                                                method escape

                                                                                                escape: (str: string) => string;
                                                                                                • Escape function str => str

                                                                                                interface Interpolator

                                                                                                interface Interpolator {}

                                                                                                  method init

                                                                                                  init: (options: InterpolationOptions, reset: boolean) => undefined;

                                                                                                    method interpolate

                                                                                                    interpolate: (
                                                                                                    str: string,
                                                                                                    data: object,
                                                                                                    lng: string,
                                                                                                    options: InterpolationOptions
                                                                                                    ) => string;

                                                                                                      method nest

                                                                                                      nest: (
                                                                                                      str: string,
                                                                                                      fc: (...args: any[]) => any,
                                                                                                      options: InterpolationOptions
                                                                                                      ) => string;

                                                                                                        method reset

                                                                                                        reset: () => undefined;

                                                                                                          method resetRegExp

                                                                                                          resetRegExp: () => undefined;

                                                                                                            interface LanguageDetectorAsyncModule

                                                                                                            interface LanguageDetectorAsyncModule extends Module {}
                                                                                                            • Used to detect language in user land. Can be provided as a singleton or as a prototype constructor (preferred for supporting multiple instances of i18next). For singleton set property type to 'languageDetector' For a prototype constructor set static property.

                                                                                                            property async

                                                                                                            async: true;
                                                                                                            • Set to true to enable async detection

                                                                                                            property type

                                                                                                            type: 'languageDetector';

                                                                                                              method cacheUserLanguage

                                                                                                              cacheUserLanguage: (lng: string) => void | Promise<void>;

                                                                                                                method detect

                                                                                                                detect: (
                                                                                                                callback: (lng: string | readonly string[] | undefined) => void | undefined
                                                                                                                ) => void | Promise<string | readonly string[] | undefined>;
                                                                                                                • Must call callback passing detected language or return a Promise

                                                                                                                method init

                                                                                                                init: (
                                                                                                                services: Services,
                                                                                                                detectorOptions: object,
                                                                                                                i18nextOptions: InitOptions
                                                                                                                ) => void;

                                                                                                                  interface LanguageDetectorModule

                                                                                                                  interface LanguageDetectorModule extends Module {}
                                                                                                                  • Used to detect language in user land. Can be provided as a singleton or as a prototype constructor (preferred for supporting multiple instances of i18next). For singleton set property type to 'languageDetector' For a prototype constructor set static property.

                                                                                                                  property type

                                                                                                                  type: 'languageDetector';

                                                                                                                    method cacheUserLanguage

                                                                                                                    cacheUserLanguage: (lng: string) => void;

                                                                                                                      method detect

                                                                                                                      detect: () => string | readonly string[] | undefined;
                                                                                                                      • Must return detected language

                                                                                                                      method init

                                                                                                                      init: (
                                                                                                                      services: Services,
                                                                                                                      detectorOptions: object,
                                                                                                                      i18nextOptions: InitOptions
                                                                                                                      ) => void;

                                                                                                                        interface LoggerModule

                                                                                                                        interface LoggerModule extends Module {}
                                                                                                                        • Override the built-in console logger. Do not need to be a prototype function.

                                                                                                                        property type

                                                                                                                        type: 'logger';

                                                                                                                          method error

                                                                                                                          error: (...args: any[]) => void;

                                                                                                                            method log

                                                                                                                            log: (...args: any[]) => void;

                                                                                                                              method warn

                                                                                                                              warn: (...args: any[]) => void;

                                                                                                                                interface Module

                                                                                                                                interface Module {}

                                                                                                                                  property type

                                                                                                                                  type: ModuleType;

                                                                                                                                    interface Modules

                                                                                                                                    interface Modules {}

                                                                                                                                      property backend

                                                                                                                                      backend?: BackendModule;

                                                                                                                                        property external

                                                                                                                                        external: ThirdPartyModule[];

                                                                                                                                          property formatter

                                                                                                                                          formatter?: FormatterModule;

                                                                                                                                            property i18nFormat

                                                                                                                                            i18nFormat?: I18nFormatModule;

                                                                                                                                              property languageDetector

                                                                                                                                              languageDetector?: LanguageDetectorModule | LanguageDetectorAsyncModule;

                                                                                                                                                property logger

                                                                                                                                                logger?: LoggerModule;

                                                                                                                                                  interface Newable

                                                                                                                                                  interface Newable<T> {}

                                                                                                                                                    construct signature

                                                                                                                                                    new (...args: any[]): T;

                                                                                                                                                      interface NewableModule

                                                                                                                                                      interface NewableModule<T extends Module> extends Newable<T> {}

                                                                                                                                                        property type

                                                                                                                                                        type: T['type'];

                                                                                                                                                          interface PostProcessorModule

                                                                                                                                                          interface PostProcessorModule extends Module {}
                                                                                                                                                          • Used to extend or manipulate the translated values before returning them in t function. Need to be a singleton object.

                                                                                                                                                          property name

                                                                                                                                                          name: string;
                                                                                                                                                          • Unique name

                                                                                                                                                          property type

                                                                                                                                                          type: 'postProcessor';

                                                                                                                                                            method process

                                                                                                                                                            process: (
                                                                                                                                                            value: string,
                                                                                                                                                            key: string | string[],
                                                                                                                                                            options: TOptions,
                                                                                                                                                            translator: any
                                                                                                                                                            ) => string;

                                                                                                                                                              interface ReactOptions

                                                                                                                                                              interface ReactOptions {}

                                                                                                                                                                property bindI18n

                                                                                                                                                                bindI18n?: string | false;
                                                                                                                                                                • Set which events trigger a re-render, can be set to false or string of events 'languageChanged'

                                                                                                                                                                property bindI18nStore

                                                                                                                                                                bindI18nStore?: string | false;
                                                                                                                                                                • Set which events on store trigger a re-render, can be set to false or string of events ''

                                                                                                                                                                property defaultTransParent

                                                                                                                                                                defaultTransParent?: string;
                                                                                                                                                                • Set it to the default parent element created by the Trans component. 'div'

                                                                                                                                                                property keyPrefix

                                                                                                                                                                keyPrefix?: string;
                                                                                                                                                                • Optional keyPrefix that will be automatically applied to returned t function in useTranslation for example. undefined

                                                                                                                                                                property nsMode

                                                                                                                                                                nsMode?: 'default' | 'fallback';
                                                                                                                                                                • Set it to fallback to let passed namespaces to translated hoc act as fallbacks 'default'

                                                                                                                                                                property transEmptyNodeValue

                                                                                                                                                                transEmptyNodeValue?: string;
                                                                                                                                                                • Set fallback value for Trans components without children undefined

                                                                                                                                                                property transKeepBasicHtmlNodesFor

                                                                                                                                                                transKeepBasicHtmlNodesFor?: readonly string[];
                                                                                                                                                                • Which nodes not to convert in defaultValue generation in the Trans component. ['br', 'strong', 'i', 'p']

                                                                                                                                                                property transSupportBasicHtmlNodes

                                                                                                                                                                transSupportBasicHtmlNodes?: boolean;
                                                                                                                                                                • Convert eg. found in translations to a react component of type br true

                                                                                                                                                                property transWrapTextNodes

                                                                                                                                                                transWrapTextNodes?: string;
                                                                                                                                                                • Wrap text nodes in a user-specified element. ''

                                                                                                                                                                property useSuspense

                                                                                                                                                                useSuspense?: boolean;
                                                                                                                                                                • Set it to false if you do not want to use Suspense true

                                                                                                                                                                method hashTransKey

                                                                                                                                                                hashTransKey: (
                                                                                                                                                                defaultValue: TOptionsBase['defaultValue']
                                                                                                                                                                ) => TOptionsBase['defaultValue'];
                                                                                                                                                                • Function to generate an i18nKey from the defaultValue (or Trans children) when no key is provided. By default, the defaultValue (Trans text) itself is used as the key. If you want to require keys for all translations, supply a function that always throws an error. undefined

                                                                                                                                                                method unescape

                                                                                                                                                                unescape: (str: string) => string;
                                                                                                                                                                • Unescape function by default it unescapes some basic html entities

                                                                                                                                                                interface Resource

                                                                                                                                                                interface Resource {}

                                                                                                                                                                  index signature

                                                                                                                                                                  [language: string]: ResourceLanguage;

                                                                                                                                                                    interface ResourceLanguage

                                                                                                                                                                    interface ResourceLanguage {}

                                                                                                                                                                      index signature

                                                                                                                                                                      [namespace: string]: ResourceKey;

                                                                                                                                                                        interface Services

                                                                                                                                                                        interface Services {}

                                                                                                                                                                          property backendConnector

                                                                                                                                                                          backendConnector: any;

                                                                                                                                                                            property formatter

                                                                                                                                                                            formatter?: Formatter;

                                                                                                                                                                              property i18nFormat

                                                                                                                                                                              i18nFormat: any;

                                                                                                                                                                                property interpolator

                                                                                                                                                                                interpolator: Interpolator;

                                                                                                                                                                                  property languageDetector

                                                                                                                                                                                  languageDetector: any;

                                                                                                                                                                                    property languageUtils

                                                                                                                                                                                    languageUtils: any;

                                                                                                                                                                                      property logger

                                                                                                                                                                                      logger: any;

                                                                                                                                                                                        property pluralResolver

                                                                                                                                                                                        pluralResolver: any;

                                                                                                                                                                                          property resourceStore

                                                                                                                                                                                          resourceStore: ResourceStore;

                                                                                                                                                                                            interface TFunction

                                                                                                                                                                                            interface TFunction<Ns extends Namespace = DefaultNamespace, KPrefix = undefined> {}
                                                                                                                                                                                            • ************************ T function declaration * ************************

                                                                                                                                                                                            property $TFunctionBrand

                                                                                                                                                                                            $TFunctionBrand: $IsResourcesDefined extends true
                                                                                                                                                                                            ? `${$FirstNamespace<Ns>}`
                                                                                                                                                                                            : never;

                                                                                                                                                                                              call signature

                                                                                                                                                                                                interface ThirdPartyModule

                                                                                                                                                                                                interface ThirdPartyModule extends Module {}

                                                                                                                                                                                                  property type

                                                                                                                                                                                                  type: '3rdParty';

                                                                                                                                                                                                    method init

                                                                                                                                                                                                    init: (i18next: i18n) => void;

                                                                                                                                                                                                      interface TOptionsBase

                                                                                                                                                                                                      interface TOptionsBase {}

                                                                                                                                                                                                        property context

                                                                                                                                                                                                        context?: any;
                                                                                                                                                                                                        • Used for contexts (eg. male\female)

                                                                                                                                                                                                        property count

                                                                                                                                                                                                        count?: number;
                                                                                                                                                                                                        • Count value used for plurals

                                                                                                                                                                                                        property defaultValue

                                                                                                                                                                                                        defaultValue?: unknown;
                                                                                                                                                                                                        • Default value to return if a translation was not found

                                                                                                                                                                                                        property fallbackLng

                                                                                                                                                                                                        fallbackLng?: FallbackLng;
                                                                                                                                                                                                        • Override language to lookup key if not found see fallbacks for details

                                                                                                                                                                                                        property interpolation

                                                                                                                                                                                                        interpolation?: InterpolationOptions;
                                                                                                                                                                                                        • Override interpolation options

                                                                                                                                                                                                        property joinArrays

                                                                                                                                                                                                        joinArrays?: string;
                                                                                                                                                                                                        • Char, eg. '\n' that arrays will be joined by (can be set globally too)

                                                                                                                                                                                                        property keySeparator

                                                                                                                                                                                                        keySeparator?: false | string;
                                                                                                                                                                                                        • Override char to separate keys

                                                                                                                                                                                                        property lng

                                                                                                                                                                                                        lng?: string;
                                                                                                                                                                                                        • Override language to use

                                                                                                                                                                                                        property lngs

                                                                                                                                                                                                        lngs?: readonly string[];
                                                                                                                                                                                                        • Override languages to use

                                                                                                                                                                                                        property ns

                                                                                                                                                                                                        ns?: Namespace;
                                                                                                                                                                                                        • Override namespaces (string or array)

                                                                                                                                                                                                        property nsSeparator

                                                                                                                                                                                                        nsSeparator?: false | string;
                                                                                                                                                                                                        • Override char to split namespace from key

                                                                                                                                                                                                        property ordinal

                                                                                                                                                                                                        ordinal?: boolean;
                                                                                                                                                                                                        • Ordinal flag for ordinal plurals

                                                                                                                                                                                                        property postProcess

                                                                                                                                                                                                        postProcess?: string | readonly string[];
                                                                                                                                                                                                        • String or array of postProcessors to apply see interval plurals as a sample

                                                                                                                                                                                                        property replace

                                                                                                                                                                                                        replace?: any;
                                                                                                                                                                                                        • Object with vars for interpolation - or put them directly in options

                                                                                                                                                                                                        property returnDetails

                                                                                                                                                                                                        returnDetails?: boolean;
                                                                                                                                                                                                        • Returns an object that includes information about the used language, namespace, key and value

                                                                                                                                                                                                        property returnObjects

                                                                                                                                                                                                        returnObjects?: boolean;
                                                                                                                                                                                                        • Accessing an object not a translation string (can be set globally too)

                                                                                                                                                                                                        interface WithT

                                                                                                                                                                                                        interface WithT<Ns extends Namespace = DefaultNamespace> {}

                                                                                                                                                                                                          property t

                                                                                                                                                                                                          t: TFunction<Ns>;

                                                                                                                                                                                                            Type Aliases

                                                                                                                                                                                                            type $FirstNamespace

                                                                                                                                                                                                            type $FirstNamespace<Ns extends Namespace> = Ns extends readonly any[] ? Ns[0] : Ns;

                                                                                                                                                                                                              type $IsResourcesDefined

                                                                                                                                                                                                              type $IsResourcesDefined = [keyof _Resources] extends [never] ? false : true;

                                                                                                                                                                                                                type $ValueIfResourcesDefined

                                                                                                                                                                                                                type $ValueIfResourcesDefined<Value, Fallback> = $IsResourcesDefined extends true
                                                                                                                                                                                                                ? Value
                                                                                                                                                                                                                : Fallback;

                                                                                                                                                                                                                  type AppendKeyPrefix

                                                                                                                                                                                                                  type AppendKeyPrefix<Key, KPrefix> = KPrefix extends string
                                                                                                                                                                                                                  ? `${KPrefix}${_KeySeparator}${Key & string}`
                                                                                                                                                                                                                  : Key;

                                                                                                                                                                                                                    type AppendNamespace

                                                                                                                                                                                                                    type AppendNamespace<Ns, Keys> = `${Ns & string}${_NsSeparator}${Keys & string}`;

                                                                                                                                                                                                                      type Callback

                                                                                                                                                                                                                      type Callback = (error: any, t: TFunction) => void;

                                                                                                                                                                                                                        type CallbackError

                                                                                                                                                                                                                        type CallbackError = Error | string | null | undefined;

                                                                                                                                                                                                                          type DefaultNamespace

                                                                                                                                                                                                                          type DefaultNamespace = TypeOptions['defaultNS'];

                                                                                                                                                                                                                            type DefaultTReturn

                                                                                                                                                                                                                            type DefaultTReturn<TOpt extends TOptions> =
                                                                                                                                                                                                                            | TReturnOptionalObjects<TOpt>
                                                                                                                                                                                                                            | TReturnOptionalNull;

                                                                                                                                                                                                                              type FallbackLng

                                                                                                                                                                                                                              type FallbackLng =
                                                                                                                                                                                                                              | string
                                                                                                                                                                                                                              | readonly string[]
                                                                                                                                                                                                                              | FallbackLngObjList
                                                                                                                                                                                                                              | ((code: string) => string | readonly string[] | FallbackLngObjList);

                                                                                                                                                                                                                                type FilterKeysByContext

                                                                                                                                                                                                                                type FilterKeysByContext<
                                                                                                                                                                                                                                Keys,
                                                                                                                                                                                                                                TOpt extends TOptions
                                                                                                                                                                                                                                > = TOpt['context'] extends string
                                                                                                                                                                                                                                ? Keys extends `${infer Prefix}${_ContextSeparator}${TOpt['context']}${infer Suffix}`
                                                                                                                                                                                                                                ? `${Prefix}${Suffix}`
                                                                                                                                                                                                                                : never
                                                                                                                                                                                                                                : Keys;

                                                                                                                                                                                                                                  type FlatNamespace

                                                                                                                                                                                                                                  type FlatNamespace = $PreservedValue<keyof TypeOptions['resources'], string>;

                                                                                                                                                                                                                                    type FormatFunction

                                                                                                                                                                                                                                    type FormatFunction = (
                                                                                                                                                                                                                                    value: any,
                                                                                                                                                                                                                                    format?: string,
                                                                                                                                                                                                                                    lng?: string,
                                                                                                                                                                                                                                    options?: InterpolationOptions & $Dictionary<any>
                                                                                                                                                                                                                                    ) => string;

                                                                                                                                                                                                                                      type InterpolationMap

                                                                                                                                                                                                                                      type InterpolationMap<Ret> = $PreservedValue<
                                                                                                                                                                                                                                      $StringKeyPathToRecord<ParseInterpolationValues<Ret>, unknown>,
                                                                                                                                                                                                                                      Record<string, unknown>
                                                                                                                                                                                                                                      >;

                                                                                                                                                                                                                                        type JoinKeys

                                                                                                                                                                                                                                        type JoinKeys<K1, K2> = `${K1 & string}${_KeySeparator}${K2 & string}`;

                                                                                                                                                                                                                                          type KeyPrefix

                                                                                                                                                                                                                                          type KeyPrefix<Ns extends Namespace> =
                                                                                                                                                                                                                                          | ResourceKeys<true>[$FirstNamespace<Ns>]
                                                                                                                                                                                                                                          | undefined;

                                                                                                                                                                                                                                            type KeysBuilder

                                                                                                                                                                                                                                            type KeysBuilder<Res, WithReturnObjects> = $IsResourcesDefined extends true
                                                                                                                                                                                                                                            ? WithReturnObjects extends true
                                                                                                                                                                                                                                            ? keyof Res | KeysBuilderWithReturnObjects<Res>
                                                                                                                                                                                                                                            : KeysBuilderWithoutReturnObjects<Res>
                                                                                                                                                                                                                                            : string;

                                                                                                                                                                                                                                              type KeysBuilderWithoutReturnObjects

                                                                                                                                                                                                                                              type KeysBuilderWithoutReturnObjects<
                                                                                                                                                                                                                                              Res,
                                                                                                                                                                                                                                              Key = keyof $OmitArrayKeys<Res>
                                                                                                                                                                                                                                              > = Key extends keyof Res
                                                                                                                                                                                                                                              ? Res[Key] extends $Dictionary | readonly unknown[]
                                                                                                                                                                                                                                              ? JoinKeys<Key, KeysBuilderWithoutReturnObjects<Res[Key]>>
                                                                                                                                                                                                                                              : Key
                                                                                                                                                                                                                                              : never;

                                                                                                                                                                                                                                                type KeysBuilderWithReturnObjects

                                                                                                                                                                                                                                                type KeysBuilderWithReturnObjects<Res, Key = keyof Res> = Key extends keyof Res
                                                                                                                                                                                                                                                ? Res[Key] extends $Dictionary | readonly unknown[]
                                                                                                                                                                                                                                                ?
                                                                                                                                                                                                                                                | JoinKeys<Key, WithOrWithoutPlural<keyof $OmitArrayKeys<Res[Key]>>>
                                                                                                                                                                                                                                                | JoinKeys<Key, KeysBuilderWithReturnObjects<Res[Key]>>
                                                                                                                                                                                                                                                : never
                                                                                                                                                                                                                                                : never;
                                                                                                                                                                                                                                                • **************************************************** Build all keys and key prefixes based on Resources * ****************************************************

                                                                                                                                                                                                                                                type KeysByTOptions

                                                                                                                                                                                                                                                type KeysByTOptions<TOpt extends TOptions> = TOpt['returnObjects'] extends true
                                                                                                                                                                                                                                                ? ResourceKeys<true>
                                                                                                                                                                                                                                                : ResourceKeys;
                                                                                                                                                                                                                                                • ********************************************************************** Parse t function keys based on the namespace, options and key prefix * **********************************************************************

                                                                                                                                                                                                                                                type KeysWithoutReturnObjects

                                                                                                                                                                                                                                                type KeysWithoutReturnObjects = {
                                                                                                                                                                                                                                                [Ns in FlatNamespace]: WithOrWithoutPlural<KeysBuilder<Resources[Ns], false>>;
                                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                                  type KeysWithReturnObjects

                                                                                                                                                                                                                                                  type KeysWithReturnObjects = {
                                                                                                                                                                                                                                                  [Ns in FlatNamespace]: WithOrWithoutPlural<KeysBuilder<Resources[Ns], true>>;
                                                                                                                                                                                                                                                  };

                                                                                                                                                                                                                                                    type KeyWithContext

                                                                                                                                                                                                                                                    type KeyWithContext<Key, TOpt extends TOptions> = TOpt['context'] extends string
                                                                                                                                                                                                                                                    ? `${Key & string}${_ContextSeparator}${TOpt['context']}`
                                                                                                                                                                                                                                                    : Key;

                                                                                                                                                                                                                                                      type ModuleType

                                                                                                                                                                                                                                                      type ModuleType =
                                                                                                                                                                                                                                                      | 'backend'
                                                                                                                                                                                                                                                      | 'logger'
                                                                                                                                                                                                                                                      | 'languageDetector'
                                                                                                                                                                                                                                                      | 'postProcessor'
                                                                                                                                                                                                                                                      | 'i18nFormat'
                                                                                                                                                                                                                                                      | 'formatter'
                                                                                                                                                                                                                                                      | '3rdParty';

                                                                                                                                                                                                                                                        type MultiReadCallback

                                                                                                                                                                                                                                                        type MultiReadCallback = (
                                                                                                                                                                                                                                                        err: CallbackError,
                                                                                                                                                                                                                                                        data: Resource | null | undefined
                                                                                                                                                                                                                                                        ) => void;

                                                                                                                                                                                                                                                          type Namespace

                                                                                                                                                                                                                                                          type Namespace<T = FlatNamespace> = T | readonly T[];

                                                                                                                                                                                                                                                            type NsByTOptions

                                                                                                                                                                                                                                                            type NsByTOptions<
                                                                                                                                                                                                                                                            Ns extends Namespace,
                                                                                                                                                                                                                                                            TOpt extends TOptions
                                                                                                                                                                                                                                                            > = TOpt['ns'] extends Namespace ? TOpt['ns'] : Ns;

                                                                                                                                                                                                                                                              type ParseInterpolationValues

                                                                                                                                                                                                                                                              type ParseInterpolationValues<Ret> =
                                                                                                                                                                                                                                                              Ret extends `${string}${_InterpolationPrefix}${infer Value}${_InterpolationSuffix}${infer Rest}`
                                                                                                                                                                                                                                                              ?
                                                                                                                                                                                                                                                              | (Value extends `${infer ActualValue},${string}`
                                                                                                                                                                                                                                                              ? ActualValue
                                                                                                                                                                                                                                                              : Value)
                                                                                                                                                                                                                                                              | ParseInterpolationValues<Rest>
                                                                                                                                                                                                                                                              : never;
                                                                                                                                                                                                                                                              • ******************************************************* Parse t function return type and interpolation values * *******************************************************

                                                                                                                                                                                                                                                              type ParseKeys

                                                                                                                                                                                                                                                              type ParseKeys<
                                                                                                                                                                                                                                                              Ns extends Namespace = DefaultNamespace,
                                                                                                                                                                                                                                                              TOpt extends TOptions = {},
                                                                                                                                                                                                                                                              KPrefix = undefined,
                                                                                                                                                                                                                                                              Keys extends $Dictionary = KeysByTOptions<TOpt>,
                                                                                                                                                                                                                                                              ActualNS extends Namespace = NsByTOptions<Ns, TOpt>
                                                                                                                                                                                                                                                              > = $IsResourcesDefined extends true
                                                                                                                                                                                                                                                              ? FilterKeysByContext<
                                                                                                                                                                                                                                                              | ParseKeysByKeyPrefix<Keys[$FirstNamespace<ActualNS>], KPrefix>
                                                                                                                                                                                                                                                              | ParseKeysByNamespaces<ActualNS, Keys>
                                                                                                                                                                                                                                                              | ParseKeysByFallbackNs<Keys>,
                                                                                                                                                                                                                                                              TOpt
                                                                                                                                                                                                                                                              >
                                                                                                                                                                                                                                                              : string;

                                                                                                                                                                                                                                                                type ParseKeysByFallbackNs

                                                                                                                                                                                                                                                                type ParseKeysByFallbackNs<Keys extends $Dictionary> =
                                                                                                                                                                                                                                                                _FallbackNamespace extends false
                                                                                                                                                                                                                                                                ? never
                                                                                                                                                                                                                                                                : _FallbackNamespace extends (infer UnionFallbackNs extends string)[]
                                                                                                                                                                                                                                                                ? Keys[UnionFallbackNs]
                                                                                                                                                                                                                                                                : Keys[_FallbackNamespace & string];

                                                                                                                                                                                                                                                                  type ParseKeysByKeyPrefix

                                                                                                                                                                                                                                                                  type ParseKeysByKeyPrefix<Keys, KPrefix> = KPrefix extends string
                                                                                                                                                                                                                                                                  ? Keys extends `${KPrefix}${_KeySeparator}${infer Key}`
                                                                                                                                                                                                                                                                  ? Key
                                                                                                                                                                                                                                                                  : never
                                                                                                                                                                                                                                                                  : Keys;

                                                                                                                                                                                                                                                                    type ParseKeysByNamespaces

                                                                                                                                                                                                                                                                    type ParseKeysByNamespaces<
                                                                                                                                                                                                                                                                    Ns extends Namespace,
                                                                                                                                                                                                                                                                    Keys
                                                                                                                                                                                                                                                                    > = Ns extends readonly (infer UnionNsps)[]
                                                                                                                                                                                                                                                                    ? UnionNsps extends keyof Keys
                                                                                                                                                                                                                                                                    ? AppendNamespace<UnionNsps, Keys[UnionNsps]>
                                                                                                                                                                                                                                                                    : never
                                                                                                                                                                                                                                                                    : never;

                                                                                                                                                                                                                                                                      type ParseTReturn

                                                                                                                                                                                                                                                                      type ParseTReturn<Key, Res, TOpt extends TOptions = {}> = ParseTReturnWithFallback<
                                                                                                                                                                                                                                                                      Key,
                                                                                                                                                                                                                                                                      Key extends `${infer K1}${_KeySeparator}${infer RestKey}`
                                                                                                                                                                                                                                                                      ? ParseTReturn<RestKey, Res[K1 & keyof Res], TOpt>
                                                                                                                                                                                                                                                                      : // Process plurals only if count is provided inside options
                                                                                                                                                                                                                                                                      TOpt['count'] extends number
                                                                                                                                                                                                                                                                      ? TOpt['ordinal'] extends boolean
                                                                                                                                                                                                                                                                      ? ParseTReturnPluralOrdinal<Res, Key>
                                                                                                                                                                                                                                                                      : ParseTReturnPlural<Res, Key>
                                                                                                                                                                                                                                                                      : // otherwise access plain key without adding plural and ordinal suffixes
                                                                                                                                                                                                                                                                      Res extends readonly unknown[]
                                                                                                                                                                                                                                                                      ? Key extends `${infer NKey extends number}`
                                                                                                                                                                                                                                                                      ? Res[NKey]
                                                                                                                                                                                                                                                                      : never
                                                                                                                                                                                                                                                                      : Res[Key & keyof Res]
                                                                                                                                                                                                                                                                      >;

                                                                                                                                                                                                                                                                        type ParseTReturnPlural

                                                                                                                                                                                                                                                                        type ParseTReturnPlural<
                                                                                                                                                                                                                                                                        Res,
                                                                                                                                                                                                                                                                        Key,
                                                                                                                                                                                                                                                                        KeyWithPlural = `${Key & string}${_PluralSeparator}${PluralSuffix}`
                                                                                                                                                                                                                                                                        > = Res[(KeyWithPlural | Key) & keyof Res];

                                                                                                                                                                                                                                                                          type ParseTReturnPluralOrdinal

                                                                                                                                                                                                                                                                          type ParseTReturnPluralOrdinal<
                                                                                                                                                                                                                                                                          Res,
                                                                                                                                                                                                                                                                          Key,
                                                                                                                                                                                                                                                                          KeyWithOrdinalPlural = `${Key &
                                                                                                                                                                                                                                                                          string}${_PluralSeparator}ordinal${_PluralSeparator}${PluralSuffix}`
                                                                                                                                                                                                                                                                          > = Res[(KeyWithOrdinalPlural | Key) & keyof Res];

                                                                                                                                                                                                                                                                            type ParseTReturnWithFallback

                                                                                                                                                                                                                                                                            type ParseTReturnWithFallback<Key, Val> = Val extends ''
                                                                                                                                                                                                                                                                            ? _ReturnEmptyString extends true
                                                                                                                                                                                                                                                                            ? ''
                                                                                                                                                                                                                                                                            : Key
                                                                                                                                                                                                                                                                            : Val extends null
                                                                                                                                                                                                                                                                            ? _ReturnNull extends true
                                                                                                                                                                                                                                                                            ? null
                                                                                                                                                                                                                                                                            : Key
                                                                                                                                                                                                                                                                            : Val;

                                                                                                                                                                                                                                                                              type PluginOptions

                                                                                                                                                                                                                                                                              type PluginOptions<T> = $MergeBy<
                                                                                                                                                                                                                                                                              {
                                                                                                                                                                                                                                                                              /**
                                                                                                                                                                                                                                                                              * Options for language detection - check documentation of plugin
                                                                                                                                                                                                                                                                              * @default undefined
                                                                                                                                                                                                                                                                              */
                                                                                                                                                                                                                                                                              detection?: object;
                                                                                                                                                                                                                                                                              /**
                                                                                                                                                                                                                                                                              * Options for backend - check documentation of plugin
                                                                                                                                                                                                                                                                              * @default undefined
                                                                                                                                                                                                                                                                              */
                                                                                                                                                                                                                                                                              backend?: T;
                                                                                                                                                                                                                                                                              /**
                                                                                                                                                                                                                                                                              * Options for cache layer - check documentation of plugin
                                                                                                                                                                                                                                                                              * @default undefined
                                                                                                                                                                                                                                                                              */
                                                                                                                                                                                                                                                                              cache?: object;
                                                                                                                                                                                                                                                                              /**
                                                                                                                                                                                                                                                                              * Options for i18n message format - check documentation of plugin
                                                                                                                                                                                                                                                                              * @default undefined
                                                                                                                                                                                                                                                                              */
                                                                                                                                                                                                                                                                              i18nFormat?: object;
                                                                                                                                                                                                                                                                              },
                                                                                                                                                                                                                                                                              CustomPluginOptions
                                                                                                                                                                                                                                                                              >;

                                                                                                                                                                                                                                                                                type PluralSuffix

                                                                                                                                                                                                                                                                                type PluralSuffix = _JSONFormat extends 'v4'
                                                                                                                                                                                                                                                                                ? 'zero' | 'one' | 'two' | 'few' | 'many' | 'other'
                                                                                                                                                                                                                                                                                : number | 'plural';

                                                                                                                                                                                                                                                                                  type ReadCallback

                                                                                                                                                                                                                                                                                  type ReadCallback = (
                                                                                                                                                                                                                                                                                  err: CallbackError,
                                                                                                                                                                                                                                                                                  data: ResourceKey | boolean | null | undefined
                                                                                                                                                                                                                                                                                  ) => void;

                                                                                                                                                                                                                                                                                    type ResourceKey

                                                                                                                                                                                                                                                                                    type ResourceKey =
                                                                                                                                                                                                                                                                                    | string
                                                                                                                                                                                                                                                                                    | {
                                                                                                                                                                                                                                                                                    [key: string]: any;
                                                                                                                                                                                                                                                                                    };

                                                                                                                                                                                                                                                                                      type ResourceKeys

                                                                                                                                                                                                                                                                                      type ResourceKeys<WithReturnObjects = _ReturnObjects> =
                                                                                                                                                                                                                                                                                      WithReturnObjects extends true
                                                                                                                                                                                                                                                                                      ? KeysWithReturnObjects
                                                                                                                                                                                                                                                                                      : KeysWithoutReturnObjects;

                                                                                                                                                                                                                                                                                        type Resources

                                                                                                                                                                                                                                                                                        type Resources = $ValueIfResourcesDefined<_Resources, $Dictionary<string>>;

                                                                                                                                                                                                                                                                                          type TFunctionDetailedResult

                                                                                                                                                                                                                                                                                          type TFunctionDetailedResult<T = string, TOpt extends TOptions = {}> = {
                                                                                                                                                                                                                                                                                          /**
                                                                                                                                                                                                                                                                                          * The plain used key
                                                                                                                                                                                                                                                                                          */
                                                                                                                                                                                                                                                                                          usedKey: string;
                                                                                                                                                                                                                                                                                          /**
                                                                                                                                                                                                                                                                                          * The translation result.
                                                                                                                                                                                                                                                                                          */
                                                                                                                                                                                                                                                                                          res: T;
                                                                                                                                                                                                                                                                                          /**
                                                                                                                                                                                                                                                                                          * The key with context / plural
                                                                                                                                                                                                                                                                                          */
                                                                                                                                                                                                                                                                                          exactUsedKey: string;
                                                                                                                                                                                                                                                                                          /**
                                                                                                                                                                                                                                                                                          * The used language for this translation.
                                                                                                                                                                                                                                                                                          */
                                                                                                                                                                                                                                                                                          usedLng: string;
                                                                                                                                                                                                                                                                                          /**
                                                                                                                                                                                                                                                                                          * The used namespace for this translation.
                                                                                                                                                                                                                                                                                          */
                                                                                                                                                                                                                                                                                          usedNS: string;
                                                                                                                                                                                                                                                                                          /**
                                                                                                                                                                                                                                                                                          * The parameters used for interpolation.
                                                                                                                                                                                                                                                                                          */
                                                                                                                                                                                                                                                                                          usedParams: InterpolationMap<T> & { count?: TOpt['count'] };
                                                                                                                                                                                                                                                                                          };

                                                                                                                                                                                                                                                                                            type TFunctionReturn

                                                                                                                                                                                                                                                                                            type TFunctionReturn<
                                                                                                                                                                                                                                                                                            Ns extends Namespace,
                                                                                                                                                                                                                                                                                            Key,
                                                                                                                                                                                                                                                                                            TOpt extends TOptions,
                                                                                                                                                                                                                                                                                            ActualNS extends Namespace = NsByTOptions<Ns, TOpt>,
                                                                                                                                                                                                                                                                                            ActualKey = KeyWithContext<Key, TOpt>
                                                                                                                                                                                                                                                                                            > = $IsResourcesDefined extends true
                                                                                                                                                                                                                                                                                            ? ActualKey extends `${infer Nsp}${_NsSeparator}${infer RestKey}`
                                                                                                                                                                                                                                                                                            ? ParseTReturn<RestKey, Resources[Nsp & keyof Resources], TOpt>
                                                                                                                                                                                                                                                                                            : ParseTReturn<ActualKey, Resources[$FirstNamespace<ActualNS>], TOpt>
                                                                                                                                                                                                                                                                                            : DefaultTReturn<TOpt>;

                                                                                                                                                                                                                                                                                              type TFunctionReturnOptionalDetails

                                                                                                                                                                                                                                                                                              type TFunctionReturnOptionalDetails<
                                                                                                                                                                                                                                                                                              Ret,
                                                                                                                                                                                                                                                                                              TOpt extends TOptions
                                                                                                                                                                                                                                                                                              > = TOpt['returnDetails'] extends true ? TFunctionDetailedResult<Ret, TOpt> : Ret;

                                                                                                                                                                                                                                                                                                type TOptions

                                                                                                                                                                                                                                                                                                type TOptions<TInterpolationMap extends object = $Dictionary> = TOptionsBase &
                                                                                                                                                                                                                                                                                                TInterpolationMap;

                                                                                                                                                                                                                                                                                                  type TReturnOptionalNull

                                                                                                                                                                                                                                                                                                  type TReturnOptionalNull = _ReturnNull extends true ? null : never;

                                                                                                                                                                                                                                                                                                    type TReturnOptionalObjects

                                                                                                                                                                                                                                                                                                    type TReturnOptionalObjects<TOpt extends TOptions> = _ReturnObjects extends true
                                                                                                                                                                                                                                                                                                    ? $SpecialObject | string
                                                                                                                                                                                                                                                                                                    : TOpt['returnObjects'] extends true
                                                                                                                                                                                                                                                                                                    ? $SpecialObject
                                                                                                                                                                                                                                                                                                    : string;

                                                                                                                                                                                                                                                                                                      type TypeOptions

                                                                                                                                                                                                                                                                                                      type TypeOptions = $MergeBy<
                                                                                                                                                                                                                                                                                                      {
                                                                                                                                                                                                                                                                                                      /**
                                                                                                                                                                                                                                                                                                      * Allows null values as valid translation
                                                                                                                                                                                                                                                                                                      */
                                                                                                                                                                                                                                                                                                      returnNull: false;
                                                                                                                                                                                                                                                                                                      /**
                                                                                                                                                                                                                                                                                                      * Allows empty string as valid translation
                                                                                                                                                                                                                                                                                                      */
                                                                                                                                                                                                                                                                                                      returnEmptyString: true;
                                                                                                                                                                                                                                                                                                      /**
                                                                                                                                                                                                                                                                                                      * Allows objects as valid translation result
                                                                                                                                                                                                                                                                                                      */
                                                                                                                                                                                                                                                                                                      returnObjects: false;
                                                                                                                                                                                                                                                                                                      /**
                                                                                                                                                                                                                                                                                                      * Char to separate keys
                                                                                                                                                                                                                                                                                                      */
                                                                                                                                                                                                                                                                                                      keySeparator: '.';
                                                                                                                                                                                                                                                                                                      /**
                                                                                                                                                                                                                                                                                                      * Char to split namespace from key
                                                                                                                                                                                                                                                                                                      */
                                                                                                                                                                                                                                                                                                      nsSeparator: ':';
                                                                                                                                                                                                                                                                                                      /**
                                                                                                                                                                                                                                                                                                      * Char to split plural from key
                                                                                                                                                                                                                                                                                                      */
                                                                                                                                                                                                                                                                                                      pluralSeparator: '_';
                                                                                                                                                                                                                                                                                                      /**
                                                                                                                                                                                                                                                                                                      * Char to split context from key
                                                                                                                                                                                                                                                                                                      */
                                                                                                                                                                                                                                                                                                      contextSeparator: '_';
                                                                                                                                                                                                                                                                                                      /**
                                                                                                                                                                                                                                                                                                      * Default namespace used if not passed to translation function
                                                                                                                                                                                                                                                                                                      */
                                                                                                                                                                                                                                                                                                      defaultNS: 'translation';
                                                                                                                                                                                                                                                                                                      /**
                                                                                                                                                                                                                                                                                                      * Fallback namespace used if translation not found in given namespace
                                                                                                                                                                                                                                                                                                      * @default false
                                                                                                                                                                                                                                                                                                      */
                                                                                                                                                                                                                                                                                                      fallbackNS: false;
                                                                                                                                                                                                                                                                                                      /**
                                                                                                                                                                                                                                                                                                      * Json Format Version - V4 allows plural suffixes
                                                                                                                                                                                                                                                                                                      */
                                                                                                                                                                                                                                                                                                      jsonFormat: 'v4';
                                                                                                                                                                                                                                                                                                      /**
                                                                                                                                                                                                                                                                                                      * Resources to initialize with
                                                                                                                                                                                                                                                                                                      */
                                                                                                                                                                                                                                                                                                      resources: object;
                                                                                                                                                                                                                                                                                                      /**
                                                                                                                                                                                                                                                                                                      * Flag that allows HTML elements to receive objects. This is only useful for React applications
                                                                                                                                                                                                                                                                                                      * where you pass objects to HTML elements so they can be replaced to their respective interpolation
                                                                                                                                                                                                                                                                                                      * values (mostly with Trans component)
                                                                                                                                                                                                                                                                                                      */
                                                                                                                                                                                                                                                                                                      allowObjectInHTMLChildren: false;
                                                                                                                                                                                                                                                                                                      /**
                                                                                                                                                                                                                                                                                                      * Prefix for interpolation
                                                                                                                                                                                                                                                                                                      */
                                                                                                                                                                                                                                                                                                      interpolationPrefix: '{{';
                                                                                                                                                                                                                                                                                                      /**
                                                                                                                                                                                                                                                                                                      * Suffix for interpolation
                                                                                                                                                                                                                                                                                                      */
                                                                                                                                                                                                                                                                                                      interpolationSuffix: '}}';
                                                                                                                                                                                                                                                                                                      },
                                                                                                                                                                                                                                                                                                      CustomTypeOptions
                                                                                                                                                                                                                                                                                                      >;

                                                                                                                                                                                                                                                                                                        type WithOrWithoutPlural

                                                                                                                                                                                                                                                                                                        type WithOrWithoutPlural<Key> = _JSONFormat extends 'v4' | 'v3'
                                                                                                                                                                                                                                                                                                        ? Key extends `${infer KeyWithoutOrdinalPlural}${_PluralSeparator}ordinal${_PluralSeparator}${PluralSuffix}`
                                                                                                                                                                                                                                                                                                        ? KeyWithoutOrdinalPlural | Key
                                                                                                                                                                                                                                                                                                        : Key extends `${infer KeyWithoutPlural}${_PluralSeparator}${PluralSuffix}`
                                                                                                                                                                                                                                                                                                        ? KeyWithoutPlural | Key
                                                                                                                                                                                                                                                                                                        : Key
                                                                                                                                                                                                                                                                                                        : Key;

                                                                                                                                                                                                                                                                                                          Package Files (3)

                                                                                                                                                                                                                                                                                                          Dependencies (1)

                                                                                                                                                                                                                                                                                                          Dev Dependencies (37)

                                                                                                                                                                                                                                                                                                          Peer Dependencies (0)

                                                                                                                                                                                                                                                                                                          No peer dependencies.

                                                                                                                                                                                                                                                                                                          Badge

                                                                                                                                                                                                                                                                                                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                                                                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/i18next.

                                                                                                                                                                                                                                                                                                          • Markdown
                                                                                                                                                                                                                                                                                                            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/i18next)
                                                                                                                                                                                                                                                                                                          • HTML
                                                                                                                                                                                                                                                                                                            <a href="https://www.jsdocs.io/package/i18next"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>