You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.2 KiB
70 lines
2.2 KiB
import type { App } from 'vue';
|
|
import { createI18n } from 'vue-i18n';
|
|
import { Quasar } from 'quasar';
|
|
import en from './i18n/platform_en';
|
|
import zh_CN from './i18n/platform_zh_CN';
|
|
import tw_CN from './i18n/platform_tw_CN';
|
|
|
|
let gc: any = undefined;
|
|
let i18n: any = undefined;
|
|
|
|
class Initializer {
|
|
public static init(callback) {
|
|
fetch(window['webContextPath'] + 'api/lcdp/configure/getActiveConfigure')
|
|
.then((response) => response.json())
|
|
.then((data) => {
|
|
gc = data.data;
|
|
gc.webContextPath = window['webContextPath'];
|
|
gc.loginError = window['loginError'] === 'true' ? true : false;
|
|
|
|
fetch(window['webContextPath'] + 'api/mvc/i18n/getI18nMessagesByKeys?key=application.title&key=application.copyright')
|
|
.then((response) => response.json())
|
|
.then((data) => {
|
|
const i18nMessages = data.data;
|
|
for (const key in i18nMessages['en']) {
|
|
en[key] = i18nMessages['en'][key];
|
|
}
|
|
for (const key in i18nMessages['zh_CN']) {
|
|
zh_CN[key] = i18nMessages['zh_CN'][key];
|
|
}
|
|
for (const key in i18nMessages['tw_CN']) {
|
|
tw_CN[key] = i18nMessages['tw_CN'][key];
|
|
}
|
|
i18n = createI18n({
|
|
legacy: false,
|
|
availableLocales: gc.setting.i18n.availableLocales,
|
|
locale: gc.setting.i18n.locale,
|
|
fallbackLocale: gc.setting.i18n.fallbackLocale,
|
|
missingWarn: gc.setting.i18n.missingWarn,
|
|
fallbackWarn: gc.setting.i18n.fallbackWarn,
|
|
messages: {
|
|
en: en,
|
|
zh_CN: zh_CN,
|
|
tw_CN: tw_CN,
|
|
},
|
|
});
|
|
callback();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
export default {
|
|
install: (app: App) => {
|
|
app.use(i18n);
|
|
app.use(Quasar, {
|
|
config: {
|
|
brand: gc.theme.brand,
|
|
loadingBar: {
|
|
color: gc.theme.loadingBar.color,
|
|
size: gc.theme.loadingBar.size + 'px',
|
|
position: gc.theme.loadingBar.position,
|
|
reverse: gc.theme.loadingBar.reverse,
|
|
},
|
|
},
|
|
});
|
|
app.config.globalProperties.$gc = gc;
|
|
},
|
|
};
|
|
|
|
export { gc, i18n, Initializer };
|
|
|