Skip to content

Commit 674c997

Browse files
committed
CONSOLE-3769: Remove i18n namespaces from PluginStore
1 parent 421199d commit 674c997

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

frontend/packages/console-plugin-sdk/src/store.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ export class PluginStore {
5858
// Extensions contributed by dynamic plugins which are currently in use
5959
private dynamicPluginExtensions: LoadedExtension[];
6060

61-
private i18nNamespaces: Set<string>;
62-
6361
private readonly staticPlugins: StaticPlugin[];
6462

6563
// Static plugins that were disabled by loading replacement dynamic plugins
@@ -76,11 +74,7 @@ export class PluginStore {
7674

7775
private readonly listeners: VoidFunction[] = [];
7876

79-
constructor(
80-
staticPlugins: ActivePlugin[] = [],
81-
allowedDynamicPluginNames: string[] = [],
82-
i18nNamespaces: string[] = [],
83-
) {
77+
constructor(staticPlugins: ActivePlugin[] = [], allowedDynamicPluginNames: string[] = []) {
8478
this.staticPlugins = staticPlugins.map((plugin) => ({
8579
name: plugin.name,
8680
extensions: plugin.extensions.map((e, index) =>
@@ -91,7 +85,6 @@ export class PluginStore {
9185
}));
9286

9387
this.allowedDynamicPluginNames = _.uniq(allowedDynamicPluginNames);
94-
this.i18nNamespaces = new Set(i18nNamespaces);
9588
this.updateExtensions();
9689
}
9790

@@ -103,10 +96,6 @@ export class PluginStore {
10396
return [...this.allowedDynamicPluginNames];
10497
}
10598

106-
getI18nNamespaces() {
107-
return Array.from(this.i18nNamespaces);
108-
}
109-
11099
subscribe(listener: VoidFunction): VoidFunction {
111100
let isSubscribed = true;
112101
this.listeners.push(listener);

frontend/public/i18n.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import Pseudo from 'i18next-pseudo';
66
import { transformNamespace } from 'i18next-v4-format-converter';
77
import { getLastLanguage } from '@console/app/src/components/user-preferences/language/getLastLanguage';
88

9-
import { pluginStore } from './plugins';
109
import { dateTimeFormatter, fromNow } from './components/utils/datetime';
1110

1211
const params = new URLSearchParams(window.location.search);
@@ -76,7 +75,7 @@ export const init = () => {
7675
'topology',
7776
'vsphere-plugin',
7877
'webterminal-plugin',
79-
...pluginStore.getI18nNamespaces(),
78+
...Array.from(new Set(window.SERVER_FLAGS.i18nNamespaces)),
8079
],
8180
defaultNS: 'public',
8281
nsSeparator: '~',

frontend/public/plugins.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ const getEnabledDynamicPluginNames = () => {
1717
return allPluginNames.filter((pluginName) => !disabledPluginNames.includes(pluginName));
1818
};
1919

20-
const getI18nNamespaces = () => {
21-
return window.SERVER_FLAGS.i18nNamespaces;
22-
};
23-
2420
// Console active plugins module has its source generated during webpack build,
2521
// so we use dynamic require() instead of the usual static import statement.
2622
const activePlugins =
@@ -29,9 +25,8 @@ const activePlugins =
2925
: [];
3026

3127
const dynamicPluginNames = getEnabledDynamicPluginNames();
32-
const i18nNamespaces = getI18nNamespaces();
3328

34-
export const pluginStore = new PluginStore(activePlugins, dynamicPluginNames, i18nNamespaces);
29+
export const pluginStore = new PluginStore(activePlugins, dynamicPluginNames);
3530

3631
if (process.env.NODE_ENV !== 'production') {
3732
// Expose Console plugin store for debugging

0 commit comments

Comments
 (0)