Skip to content

Commit f0e01e4

Browse files
committed
fix: missing translations
1 parent 537bf4a commit f0e01e4

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

packages/core/admin/helpers/getTranslation.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const prefixPluginTranslations = (trad, pluginId) => {
2+
if (!pluginId) {
3+
throw new TypeError("pluginId can't be empty");
4+
}
5+
return Object.keys(trad).reduce((acc, current) => {
6+
acc[`${pluginId}.${current}`] = trad[current];
7+
return acc;
8+
}, {});
9+
};
10+
11+
export { prefixPluginTranslations };

packages/core/admin/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import pluginPkg from '../package.json';
88
import EditView from './components/EditView';
99
import pluginId from './helpers/pluginId';
1010
import getTrad from './helpers/getTrad';
11-
import getTranslation from './helpers/getTranslation';
11+
import { prefixPluginTranslations } from './helpers/prefixPluginTranslations';
1212
import CheckboxConfirmation from './components/ContentManagerHooks/ConfirmationCheckbox';
1313

1414
import { PluginIcon } from './components/PluginIcon';
@@ -98,7 +98,7 @@ export default {
9898
return import(`./translations/${locale}.json`)
9999
.then(({ default: data }) => {
100100
return {
101-
data: getTranslation(data),
101+
data: prefixPluginTranslations(data, pluginId),
102102
locale,
103103
};
104104
})

0 commit comments

Comments
 (0)