|
@@ -2,7 +2,6 @@ import I18nextChainedBackend from 'i18next-chained-backend';
|
|
|
import I18nextBrowserLanguageDetector from 'i18next-browser-languagedetector';
|
|
import I18nextBrowserLanguageDetector from 'i18next-browser-languagedetector';
|
|
|
import I18NextHttpBackend from 'i18next-http-backend';
|
|
import I18NextHttpBackend from 'i18next-http-backend';
|
|
|
import I18NextLocalStorageBackend from 'i18next-localstorage-backend';
|
|
import I18NextLocalStorageBackend from 'i18next-localstorage-backend';
|
|
|
-import path from 'path';
|
|
|
|
|
|
|
|
|
|
const isServer = typeof window === 'undefined';
|
|
const isServer = typeof window === 'undefined';
|
|
|
|
|
|
|
@@ -12,7 +11,6 @@ export const
|
|
|
locales: ['en_US', 'ja_JP', 'zh_CN'],
|
|
locales: ['en_US', 'ja_JP', 'zh_CN'],
|
|
|
};
|
|
};
|
|
|
export const defaultNS = 'translation';
|
|
export const defaultNS = 'translation';
|
|
|
-export const localePath = path.resolve('./public/static/locales');
|
|
|
|
|
|
|
|
|
|
export const serializeConfig = false;
|
|
export const serializeConfig = false;
|
|
|
export const use = isServer ? [] : [I18nextChainedBackend];
|
|
export const use = isServer ? [] : [I18nextChainedBackend];
|
|
@@ -20,7 +18,9 @@ export const
|
|
|
backend = {
|
|
backend = {
|
|
|
backends: isServer ? [I18nextBrowserLanguageDetector] : [I18NextLocalStorageBackend, I18NextHttpBackend],
|
|
backends: isServer ? [I18nextBrowserLanguageDetector] : [I18NextLocalStorageBackend, I18NextHttpBackend],
|
|
|
backendOptions: [
|
|
backendOptions: [
|
|
|
|
|
+ // options for i18next-localstorage-backend
|
|
|
{ expirationTime: 60 * 60 * 1000 }, // 1 hour
|
|
{ expirationTime: 60 * 60 * 1000 }, // 1 hour
|
|
|
- { loadPath: '/static/locales/{{lng}}/{{ns}}.json', } // for i18next-http-backend
|
|
|
|
|
|
|
+ // options for i18next-http-backend
|
|
|
|
|
+ { loadPath: '/static/locales/{{lng}}/{{ns}}.json', },
|
|
|
],
|
|
],
|
|
|
};
|
|
};
|