-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvue3-plugin.js
More file actions
35 lines (32 loc) · 914 Bytes
/
vue3-plugin.js
File metadata and controls
35 lines (32 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import messages from "./src/i18n/index.js";
import * as Components from "./index.js";
/**
* Register BIMData components globally.
*
* @param {
* {
* i18nPlugin: Object
* }
* } [cfg]
*/
const pluginFactory = ({ i18nPlugin } = {}) => {
return {
install(app) {
if (i18nPlugin) {
Object.entries(messages).forEach(([locale, translations]) => {
i18nPlugin.global.mergeLocaleMessage(locale, translations);
});
} else {
console.warn(
"[BIMData Components Plugin] No i18n instance provided. " +
"You should either provide an i18n instance or define " +
"your own translations in order have text displayed properly."
);
}
Object.entries(Components).forEach(([componentName, component]) => {
app.component(componentName, component);
});
},
};
};
export default pluginFactory;