Skip to content

Commit

Permalink
feat:update i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
tasneem067 committed Feb 5, 2021
1 parent f4096a9 commit d0b5dcc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/apollo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@ const initModule = require(`./init.${AUTH_MODEL}`);

const pubSub = GraphqlPubSub.getInstance();

const i18next = require('i18next');
const i18nextMiddleware = require('i18next-http-middleware');
const Backend = require('i18next-fs-backend');
i18next.use(Backend).use(i18nextMiddleware.LanguageDetector).init({
//debug: true,
backend: {
loadPath: './locales/{{lng}}/razee-resources.json',
addPath: './locales/{{lng}}/{{ns}}.missing.json'
},
fallbackLng: 'en',
supportedLngs: ['en', 'cn', 'zh-cn'],
load: 'languageOnly',
saveMissing: true,
initImmediate: true,
nsSeparator: '#||#',
keySeparator: '#|#'
});

const createDefaultApp = () => {
const app = express();
app.set('trust proxy', true);
Expand All @@ -54,6 +72,7 @@ const createDefaultApp = () => {
}
return next();
});
app.use(i18nextMiddleware.handle(i18next));
return app;
};

Expand Down

0 comments on commit d0b5dcc

Please sign in to comment.