mirror of
https://github.com/strapi/strapi.git
synced 2025-08-11 02:07:51 +00:00
41 lines
959 B
JavaScript
41 lines
959 B
JavaScript
'use strict';
|
|
|
|
const _ = require('lodash');
|
|
|
|
const { getService } = require('../../utils');
|
|
|
|
module.exports = () => {
|
|
const contentTypeService = getService('content-types');
|
|
const coreApiService = getService('core-api');
|
|
|
|
Object.values(strapi.contentTypes).forEach(contentType => {
|
|
if (contentTypeService.isLocalized(contentType)) {
|
|
const { attributes, modelName } = contentType;
|
|
|
|
_.set(attributes, 'localizations', {
|
|
writable: true,
|
|
private: false,
|
|
configurable: false,
|
|
visible: false,
|
|
collection: modelName,
|
|
populate: ['id', 'locale', 'published_at'],
|
|
});
|
|
|
|
_.set(attributes, 'locale', {
|
|
writable: true,
|
|
private: false,
|
|
configurable: false,
|
|
visible: false,
|
|
type: 'string',
|
|
});
|
|
|
|
coreApiService.addCreateLocalizationAction(contentType);
|
|
}
|
|
});
|
|
|
|
strapi.db.migrations.register({
|
|
before() {},
|
|
after() {},
|
|
});
|
|
};
|