How to use the react-i18next.reactI18nextModule function in react-i18next

To help you get started, we’ve selected a few react-i18next examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github globocom / megadraft / tests / __mocks__ / react-i18next.js View on Github external
*/

const React = require("react");
const reactI18next = require("react-i18next");

module.exports = {
  // this mock makes sure any components using the translate HoC receive the t function as a prop
  translate: () => Component => props =>  k} {...props} />,
  Trans: ({ children }) => children,
  I18n: ({ children }) => children(k => k, { i18n: {} }),

  // mock if needed
  Interpolate: reactI18next.Interpolate,
  I18nextProvider: reactI18next.I18nextProvider,
  loadNamespaces: reactI18next.loadNamespaces,
  reactI18nextModule: reactI18next.reactI18nextModule,
  setDefaults: reactI18next.setDefaults,
  getDefaults: reactI18next.getDefaults,
  setI18n: reactI18next.setI18n,
  getI18n: reactI18next.getI18n
};
github pagarme / react-scripts-former-kit-dashboard / template / src / __mocks__ / react-i18next.js View on Github external
)
    }

    return child
  })
}

module.exports = {
  // this mock makes sure any components using the translate HoC receive the t function as a prop
  getDefaults: reactI18next.getDefaults,
  getI18n: reactI18next.getI18n,
  I18n: ({ children }) => children(k => k, { i18n: {} }),
  I18nextProvider: reactI18next.I18nextProvider,
  Interpolate: reactI18next.Interpolate,
  loadNamespaces: reactI18next.loadNamespaces,
  reactI18nextModule: reactI18next.reactI18nextModule,
  setDefaults: reactI18next.setDefaults,
  setI18n: reactI18next.setI18n,
  Trans: ({ children }) => renderNodes(children),
  translate: () => Component => props => (
     k}
      i18n={{
        changeLanguage: l => l,
        language: 'en-US',
        languages: ['en-US', 'pt'],
      }}
      {...props}
    />
  ),
}
github sandiz / rs-manager / src / app-config / i18next.config.client.js View on Github external
const i18n = require('i18next');

const reactI18nextModule = require('react-i18next').reactI18nextModule;

// const Backend = require('i18next-xhr-backend').Backend;
// const LanguageDetector = require('i18next-browser-languagedetector');

const languages = require('./base-config').languages;

const i18nextOptions = {
    interpolation: {
        escapeValue: false,
    },
    //debug: true,
    saveMissing: false,
    lng: 'en',
    fallbackLng: 'en',
    whitelist: languages,
    react: {