mirror of
https://github.com/strapi/strapi.git
synced 2026-01-05 03:38:09 +00:00
Cleanup language middleware usage
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
This commit is contained in:
parent
0925758742
commit
7fdfd4803d
5
packages/strapi/lib/core/bootstrap.js
vendored
5
packages/strapi/lib/core/bootstrap.js
vendored
@ -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.
|
||||
|
||||
@ -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();
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user