diff --git a/dashboard/package.json b/dashboard/package.json index d20385fa4..bcd54bfad 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -16,6 +16,7 @@ "dependencies": { "axios": "^0.18.0", "vue": "^2.5.2", + "vue-i18n": "^8.3.2", "vue-router": "^3.0.1", "vuetify": "^1.0.0" }, diff --git a/dashboard/src/i18n/config.js b/dashboard/src/i18n/config.js new file mode 100644 index 000000000..7ae3894fa --- /dev/null +++ b/dashboard/src/i18n/config.js @@ -0,0 +1,25 @@ +import i18n from '@/i18n' +import map from '@/i18n/map' + +function setLang (lang) { + localStorage.setItem('lang', lang) + console.log(map[lang]) + i18n.locale = map[lang] +} + +function loadDefautlLang (lang) { + if (localStorage.getItem('lang') === null) { + localStorage.setItem('lang', 'English') + } + i18n.locale = map[localStorage.getItem('lang')] +} + +function getLang () { + return localStorage.getItem('lang') +} + +export { + getLang, + loadDefautlLang, + setLang +} diff --git a/dashboard/src/i18n/en-US.json b/dashboard/src/i18n/en-US.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/dashboard/src/i18n/en-US.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/dashboard/src/i18n/index.js b/dashboard/src/i18n/index.js new file mode 100644 index 000000000..0aa61c8bc --- /dev/null +++ b/dashboard/src/i18n/index.js @@ -0,0 +1,18 @@ +import VueI18n from 'vue-i18n' +import Vue from 'vue' +import enUS from './en-US.json' +import zhCN from './zh-CN.json' + +Vue.use(VueI18n) + +const messages = { + en: enUS, + zh: zhCN +} + +const i18n = new VueI18n({ + locale: 'en', + messages +}) + +export default i18n diff --git a/dashboard/src/i18n/map.json b/dashboard/src/i18n/map.json new file mode 100644 index 000000000..fe379cd51 --- /dev/null +++ b/dashboard/src/i18n/map.json @@ -0,0 +1,5 @@ +{ + "English": "en", + "中文(简体)": "zh", + "Deutschland": "de" +} \ No newline at end of file diff --git a/dashboard/src/i18n/zh-CN.json b/dashboard/src/i18n/zh-CN.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/dashboard/src/i18n/zh-CN.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/dashboard/src/main.js b/dashboard/src/main.js index cb42fb1e3..a60763090 100644 --- a/dashboard/src/main.js +++ b/dashboard/src/main.js @@ -7,6 +7,8 @@ import Vuetify from 'vuetify' import 'vuetify/dist/vuetify.min.css' import '@/assets/styles/main.css' +import i18n from '@/i18n' + Vue.use(Vuetify) Vue.config.productionTip = false @@ -15,6 +17,7 @@ Vue.config.productionTip = false new Vue({ el: '#app', router, + i18n, components: { App }, template: '' }) diff --git a/dashboard/src/pages/Demo.vue b/dashboard/src/pages/Demo.vue new file mode 100644 index 000000000..e69de29bb diff --git a/dashboard/src/pages/Main.vue b/dashboard/src/pages/Main.vue index 1c3357ab0..2114541f9 100644 --- a/dashboard/src/pages/Main.vue +++ b/dashboard/src/pages/Main.vue @@ -69,7 +69,7 @@
{{message.body}} -
+
@@ -118,4 +118,12 @@ export default { .cvpm-main-drawer { position:fixed; } +.cvpm-main-content-with-drawer { + margin-top: 5em; + margin-left: 320px; +} +.cvpm-main-content-without-drawer { + margin-top: 5em; + margin-left: 20px; +} diff --git a/dashboard/src/pages/Settings.vue b/dashboard/src/pages/Settings.vue index 723ea84ba..d36073ffa 100644 --- a/dashboard/src/pages/Settings.vue +++ b/dashboard/src/pages/Settings.vue @@ -1,25 +1,22 @@