mirror of
https://github.com/strapi/strapi.git
synced 2025-08-10 01:38:10 +00:00
39 lines
913 B
JavaScript
39 lines
913 B
JavaScript
import { prefixPluginTranslations } from '@strapi/helper-plugin';
|
|
import pluginPkg from '../../package.json';
|
|
import pluginId from './pluginId';
|
|
|
|
const name = pluginPkg.strapi.name;
|
|
|
|
export default {
|
|
register(app) {
|
|
app.registerPlugin({
|
|
id: pluginId,
|
|
name,
|
|
});
|
|
},
|
|
bootstrap() {},
|
|
async registerTrads({ locales }) {
|
|
const importedTrads = await Promise.all(
|
|
locales.map((locale) => {
|
|
return import(
|
|
/* webpackChunkName: "sentry-translation-[request]" */ `./translations/${locale}.json`
|
|
)
|
|
.then(({ default: data }) => {
|
|
return {
|
|
data: prefixPluginTranslations(data, pluginId),
|
|
locale,
|
|
};
|
|
})
|
|
.catch(() => {
|
|
return {
|
|
data: {},
|
|
locale,
|
|
};
|
|
});
|
|
})
|
|
);
|
|
|
|
return Promise.resolve(importedTrads);
|
|
},
|
|
};
|