Skip to content

Commit

Permalink
upgrade to nextjs12
Browse files Browse the repository at this point in the history
  • Loading branch information
sunilsabatp committed Oct 26, 2022
1 parent 24e3d7b commit 498521c
Show file tree
Hide file tree
Showing 164 changed files with 1,535 additions and 2,607 deletions.
56 changes: 28 additions & 28 deletions i18n/index.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import path from 'path';
import LanguageDetector from 'i18next-browser-languagedetector';
import NextI18Next from 'next-i18next';
import { initReactI18next } from 'react-i18next';
import getConfig from '../tenant.config';
// import path from 'path';
// import LanguageDetector from 'i18next-browser-languagedetector';
// import NextI18Next from 'next-i18next';
// import { initReactI18next } from 'react-i18next';
// import getConfig from '../tenant.config';

const config = getConfig();
// const config = getConfig();

export default new NextI18Next({
use: [LanguageDetector, initReactI18next],
localePath: path.resolve('./public/static/locales'),
defaultLanguage: config.languages[0] ? config.languages[0] : 'en',
fallbackLng: config.languages[0] ? config.languages[0] : 'en',
debug: false,
otherLanguages: config.languages, // list all languages here
detection: {
// check if language is cached in local storage, otherwise retrieve from browser language
order: ['localStorage', 'navigator'],
// export default new NextI18Next({
// use: [LanguageDetector, initReactI18next],
// localePath: path.resolve('./public/static/locales'),
// defaultLanguage: config.languages[0] ? config.languages[0] : 'en',
// fallbackLng: config.languages[0] ? config.languages[0] : 'en',
// debug: false,
// otherLanguages: config.languages, // list all languages here
// detection: {
// // check if language is cached in local storage, otherwise retrieve from browser language
// order: ['localStorage', 'navigator'],

// next-i18next by default searches for the 'next-i18next' cookie, local storage key on server requests
lookupLocalStorage: 'language',
// // next-i18next by default searches for the 'next-i18next' cookie, local storage key on server requests
// lookupLocalStorage: 'language',

// cache the language local storage
caches: ['localStorage'],
},
react: {
// trigger a rerender when language is changed
bindI18n: 'languageChanged',
// we're NOT using suspsense to detect when the translations have loaded
useSuspense: false,
},
});
// // cache the language local storage
// caches: ['localStorage'],
// },
// react: {
// // trigger a rerender when language is changed
// bindI18n: 'languageChanged',
// // we're NOT using suspsense to detect when the translations have loaded
// useSuspense: false,
// },
// });
1 change: 0 additions & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
10 changes: 10 additions & 0 deletions next-i18next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const path = require('path');

module.exports = {
i18n: {
fallbackLng: 'en',
defaultLocale: 'en',
locales: ['en', 'de', 'cs', 'es', 'fr', 'it', 'pt-BR'],
},
localePath: path.resolve('./public/static/locales'),
};
2 changes: 2 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const withPlugins = require('next-compose-plugins');
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
const { i18n } = require('./next-i18next.config');

// Use the SentryWebpack plugin to upload the source maps during build step
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
Expand Down Expand Up @@ -47,6 +48,7 @@ const hasAssetPrefix =

module.exports = withPlugins([[withBundleAnalyzer]], {
productionBrowserSourceMaps: true,
i18n,
serverRuntimeConfig: {
rootDir: __dirname,
},
Expand Down
Loading

0 comments on commit 498521c

Please sign in to comment.