File tree Expand file tree Collapse file tree 1 file changed +14
-27
lines changed Expand file tree Collapse file tree 1 file changed +14
-27
lines changed Original file line number Diff line number Diff line change @@ -49,33 +49,20 @@ export default {
4949 bootstrap ( app ) { } ,
5050 async registerTrads ( { locales } ) {
5151 const importedTrads = await Promise . all (
52- locales . map ( ( locale ) => {
53- return import (
54- /* webpackChunkName: "config-sync-translation-[request]" */ `./translations/${ locale } .json`
55- )
56- . then ( ( { default : data } ) => {
57- return {
58- data : prefixPluginTranslations ( data , pluginId ) ,
59- locale,
60- } ;
61- } )
62- . catch ( ( ) => {
63- return import (
64- /* webpackChunkName: "config-sync-translation-[request]" */ `./translations/en.json`
65- )
66- . then ( ( { default : data } ) => {
67- return {
68- data : prefixPluginTranslations ( data , pluginId ) ,
69- locale,
70- } ;
71- } )
72- . catch ( ( ) => {
73- return {
74- data : { } ,
75- locale,
76- } ;
77- } ) ;
78- } ) ;
52+ locales . map ( async ( locale ) => {
53+ try {
54+ // eslint-disable-next-line import/no-dynamic-require
55+ const data = require ( `./translations/${ locale } .json` ) ;
56+ return {
57+ data : prefixPluginTranslations ( data , pluginId ) ,
58+ locale,
59+ } ;
60+ } catch {
61+ return {
62+ data : { } ,
63+ locale,
64+ } ;
65+ }
7966 } ) ,
8067 ) ;
8168
You can’t perform that action at this time.
0 commit comments