mirror of
https://github.com/strapi/strapi.git
synced 2025-10-06 05:44:19 +00:00
43 lines
1.0 KiB
JavaScript
43 lines
1.0 KiB
JavaScript
import { prefixPluginTranslations } from './utils/prefixPluginTranslations';
|
|
import TodoCard from './components/TodoCard';
|
|
|
|
const name = 'todo-example';
|
|
|
|
/** @type import('@strapi/strapi/admin').PluginDefinition */
|
|
export default {
|
|
register(app) {
|
|
app.registerPlugin({
|
|
id: 'todo-example',
|
|
name,
|
|
});
|
|
},
|
|
|
|
bootstrap(app) {
|
|
app.getPlugin('content-manager').injectComponent('editView', 'right-links', {
|
|
name: 'my-plugin-my-compo',
|
|
Component: TodoCard,
|
|
});
|
|
},
|
|
|
|
async registerTrads({ locales }) {
|
|
const importedTrads = await Promise.all(
|
|
locales.map((locale) => {
|
|
return import(`./translations/${locale}.json`)
|
|
.then(({ default: data }) => {
|
|
return {
|
|
data: prefixPluginTranslations(data, name),
|
|
locale,
|
|
};
|
|
})
|
|
.catch(() => {
|
|
return {
|
|
data: {},
|
|
locale,
|
|
};
|
|
});
|
|
})
|
|
);
|
|
return Promise.resolve(importedTrads);
|
|
},
|
|
};
|