mirror of
https://github.com/strapi/strapi.git
synced 2025-07-25 09:56:53 +00:00
47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
import { prefixPluginTranslations } from '@strapi/helper-plugin';
|
|
import pluginPkg from '../../package.json';
|
|
import pluginId from './pluginId';
|
|
import pluginLogo from './assets/images/logo.svg';
|
|
|
|
const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
|
|
const icon = pluginPkg.strapi.icon;
|
|
const name = pluginPkg.strapi.name;
|
|
|
|
export default {
|
|
register(app) {
|
|
app.registerPlugin({
|
|
description: pluginDescription,
|
|
icon,
|
|
id: pluginId,
|
|
isReady: true,
|
|
isRequired: pluginPkg.strapi.required || false,
|
|
name,
|
|
pluginLogo,
|
|
});
|
|
},
|
|
bootstrap() {},
|
|
async registerTrads({ locales }) {
|
|
const importedTrads = await Promise.all(
|
|
locales.map(locale => {
|
|
return import(
|
|
/* webpackChunkName: "graphql-translation-[request]" */ `./translations/${locale}.json`
|
|
)
|
|
.then(({ default: data }) => {
|
|
return {
|
|
data: prefixPluginTranslations(data, pluginId),
|
|
locale,
|
|
};
|
|
})
|
|
.catch(() => {
|
|
return {
|
|
data: {},
|
|
locale,
|
|
};
|
|
});
|
|
})
|
|
);
|
|
|
|
return Promise.resolve(importedTrads);
|
|
},
|
|
};
|