How to use the next-i18next.default function in next-i18next

To help you get started, we’ve selected a few next-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 SolidZORO / leaa / packages / leaa-www / i18n.js View on Github external
const NextI18Next = require('next-i18next').default;

module.exports = new NextI18Next({
  defaultLanguage: 'zh-CN',
  otherLanguages: ['en-US', 'zh-CN'],
  browserLanguageDetection: true,
  whitelist: ['en-US', 'zh-CN', 'zh', 'en'],
  localeSubpaths: 'foreign',
  // debug: true,
});
github lovincyrus / cosmonauts-world / i18n.js View on Github external
const NextI18Next = require('next-i18next').default;

module.exports = new NextI18Next({
  lng: 'en',
  defaultLanguage: 'en',
  otherLanguages: ['kr', 'cn', 'ru'],
  // https://github.com/isaachinman/next-i18next/issues/523
  localePath: typeof window === 'undefined' ? 'public/locales' : 'locales',
  browserLanguageDetection: true,
  debug: false,
});
github felixmosh / i18next-hmr / examples / next-with-next-i18next / i18n.js View on Github external
const NextI18Next = require('next-i18next').default;
const { localeSubpaths } = require('next/config').default().publicRuntimeConfig;

const localeSubpathVariations = {
  none: {},
  foreign: {
    de: 'de',
  },
  all: {
    en: 'en',
    de: 'de',
  },
};

const nextI18Next = new NextI18Next({
  otherLanguages: ['de'],
  localeSubpaths: localeSubpathVariations[localeSubpaths],
});

if (process.env.NODE_ENV === 'development') {
  const { applyClientHMR } = require('i18next-hmr');
  applyClientHMR(nextI18Next.i18n);
}

module.exports = nextI18Next;
github GenesisVision / web-client / packages / shared / i18n.js View on Github external
const NextI18Next = require("next-i18next").default;

const NextI18NextInstance = new NextI18Next({
  defaultLanguage: "en",
  otherLanguages: ["de"],
  defaultNS: "translations",
  browserLanguageDetection: false,
  localePath: typeof window === "undefined" ? "public/locales" : "locales"
});

module.exports = NextI18NextInstance;

module.exports.withTranslation = NextI18NextInstance.withTranslation;
module.exports.appWithTranslation = NextI18NextInstance.appWithTranslation;
module.exports.useTranslation = NextI18NextInstance.useTranslation;
github isaachinman / next-i18next / examples / custom-routing / i18n.js View on Github external
const NextI18Next = require('next-i18next').default

module.exports = new NextI18Next({ otherLanguages: ['de'] })
github haoict / production-ready-webapp-boilerplate / src / helpers / i18n.js View on Github external
const NextI18Next = require('next-i18next').default;

const options = {
  browserLanguageDetection: true,
  serverLanguageDetection: true,
  defaultNS: 'common',
  defaultLanguage: 'en',
  ignoreRoutes: ['/_next', '/static'],
  otherLanguages: ['vi', 'ja'],
  localePath: typeof window === 'undefined' ? 'public/static/locales' : 'static/locales',
  localeStructure: '{{lng}}/{{ns}}',
  localeSubpaths: {},
  keySeparator: '::'
};

const nextI18NextInstance = new NextI18Next(options);

module.exports = { ...nextI18NextInstance };
github react-next-boilerplate / react-next-boilerplate / i18n.js View on Github external
const { localeSubpaths } = require('next/config').default().publicRuntimeConfig;

const EN = 'en';
const ES = 'es';

const localeSubpathMapping = {
  none: {},
  en: EN,
  es: ES,
  all: {
    EN,
    ES,
  },
};

module.exports = new NextI18Next({
  defaultNS: 'common',
  defaultLanguage: 'es',
  otherLanguages: [EN, ES],
  localeSubpaths: localeSubpathMapping[localeSubpaths],
});
github ShadOoW / web-starter-kit / src / lib / i18n.js View on Github external
const NextI18Next = require('next-i18next').default;

module.exports = new NextI18Next({
  defaultLanguage: 'en',
  otherLanguages: ['fr', 'ar'],
  localeSubpaths: {
    en: 'en',
    fr: 'fr',
    ar: 'ar',
  },
  fallbackLng: 'en',
});
github isaachinman / next-i18next / examples / simple / i18n.js View on Github external
const NextI18Next = require('next-i18next').default
const { localeSubpaths } = require('next/config').default().publicRuntimeConfig

const localeSubpathVariations = {
  none: {},
  foreign: {
    de: 'de',
  },
  all: {
    en: 'en',
    de: 'de',
  },
}

module.exports = new NextI18Next({
  otherLanguages: ['de'],
  localeSubpaths: localeSubpathVariations[localeSubpaths],
})
github CrystallizeAPI / crystallize-frontend-boilerplate / lib / i18n.js View on Github external
const { localeSubpaths } = require('next/config').default().publicRuntimeConfig;
const NextI18Next = require('next-i18next').default;

module.exports = new NextI18Next({
  defaultLanguage: 'en',
  otherLanguages: ['de'],
  localeSubpaths
});

next-i18next

The easiest way to translate your NextJs apps.

MIT
Latest version published 13 days ago

Package Health Score

95 / 100
Full package analysis