Cleanup language middleware usage

Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
This commit is contained in:
Alexandre Bodin 2020-04-09 17:08:31 +02:00
parent 0925758742
commit 7fdfd4803d
2 changed files with 7 additions and 7 deletions

View File

@ -25,11 +25,6 @@ module.exports = function(strapi) {
// Set current connections.
strapi.config.connections = strapi.config.get('database.connections', {});
// FIXME:
if (_.get(strapi.config, 'language.enabled')) {
strapi.config.language.locales = Object.keys(_.get(strapi.config, 'locales', {}));
}
strapi.contentTypes = {};
// Set models.

View File

@ -6,7 +6,6 @@
// Node.js core.
const { resolve } = require('path');
const { get } = require('lodash');
const locale = require('koa-locale');
const i18n = require('koa-i18n');
/**
@ -29,13 +28,19 @@ module.exports = strapi => {
strapi.app.use(
i18n(strapi.app, {
directory,
locales: Object.keys(get(strapi.config, 'locales', {})),
locales: strapi.config.get('middleware.settings.language.locales', []),
defaultLocale,
modes,
cookieName,
extension: '.json',
})
);
strapi.app.use((ctx, next) => {
console.log(ctx.i18n.__('someKey'));
next();
});
},
};
};