feature:add i18n
This commit is contained in:
		
							
								
								
									
										49
									
								
								src/lang/en.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								src/lang/en.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
export default {
 | 
			
		||||
  route: {
 | 
			
		||||
    dashboard: 'dashboard',
 | 
			
		||||
    introduction: 'introduction',
 | 
			
		||||
    permission: 'permission',
 | 
			
		||||
    icons: 'icons',
 | 
			
		||||
    components: 'components:',
 | 
			
		||||
    componentIndex: 'introduction',
 | 
			
		||||
    tinymce: 'tinymce',
 | 
			
		||||
    markdown: 'Markdown',
 | 
			
		||||
    jsonEditor: 'JSON Editor',
 | 
			
		||||
    dndList: 'dnd list',
 | 
			
		||||
    splitPane: 'Splitpane',
 | 
			
		||||
    avatarUpload: 'avatar upload',
 | 
			
		||||
    dropzone: 'Dropzone',
 | 
			
		||||
    sticky: 'Sticky',
 | 
			
		||||
    countTo: 'CountTo',
 | 
			
		||||
    componentMixin: 'Mixin',
 | 
			
		||||
    backToTop: 'backToTop',
 | 
			
		||||
    charts: 'charts',
 | 
			
		||||
    chartsIndex: 'introduction',
 | 
			
		||||
    keyboardChart: 'keyboard chart',
 | 
			
		||||
    keyboardChart2: 'keyboard chart2',
 | 
			
		||||
    lineChart: 'line chart',
 | 
			
		||||
    mixChart: 'mix chart',
 | 
			
		||||
    example: 'example',
 | 
			
		||||
    Table: 'Table',
 | 
			
		||||
    dynamicTable: '动态table',
 | 
			
		||||
    dragTable: '拖拽table',
 | 
			
		||||
    inlineEditTable: 'table内编辑',
 | 
			
		||||
    complexTabl: '综合table',
 | 
			
		||||
    tab: 'Tab',
 | 
			
		||||
    form: 'Form',
 | 
			
		||||
    createForm: 'create form',
 | 
			
		||||
    editForm: 'edit form',
 | 
			
		||||
    errorPages: 'error pages',
 | 
			
		||||
    page401: '401',
 | 
			
		||||
    page404: '404',
 | 
			
		||||
    errorLog: 'error log',
 | 
			
		||||
    excel: 'excel',
 | 
			
		||||
    exportExcel: 'export excel',
 | 
			
		||||
    selectExcel: 'export selected',
 | 
			
		||||
    uploadExcel: 'upload excel',
 | 
			
		||||
    exportZip: 'zip',
 | 
			
		||||
    theme: 'theme',
 | 
			
		||||
    clipboardDemo: 'clipboard',
 | 
			
		||||
    i18n: 'i18n'
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										27
									
								
								src/lang/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								src/lang/index.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
import Vue from 'vue'
 | 
			
		||||
import elementEnLocale from 'element-ui/lib/locale/lang/en'
 | 
			
		||||
import elementZhLocale from 'element-ui/lib/locale/lang/zh-CN'
 | 
			
		||||
import enLocale from './en'
 | 
			
		||||
import zhLocale from './zh'
 | 
			
		||||
import VueI18n from 'vue-i18n'
 | 
			
		||||
import Cookies from 'js-cookie'
 | 
			
		||||
 | 
			
		||||
Vue.use(VueI18n)
 | 
			
		||||
 | 
			
		||||
const messages = {
 | 
			
		||||
  en: {
 | 
			
		||||
    ...enLocale,
 | 
			
		||||
    ...elementEnLocale
 | 
			
		||||
  },
 | 
			
		||||
  zh: {
 | 
			
		||||
    ...zhLocale,
 | 
			
		||||
    ...elementZhLocale
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const i18n = new VueI18n({
 | 
			
		||||
  locale: Cookies.get('language') || 'zh', // set locale
 | 
			
		||||
  messages // set locale messages
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
export default i18n
 | 
			
		||||
							
								
								
									
										49
									
								
								src/lang/zh.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								src/lang/zh.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
export default {
 | 
			
		||||
  route: {
 | 
			
		||||
    dashboard: '首页',
 | 
			
		||||
    introduction: '简述',
 | 
			
		||||
    permission: '权限测试页',
 | 
			
		||||
    icons: '图标',
 | 
			
		||||
    components: '组件',
 | 
			
		||||
    componentIndex: '介绍',
 | 
			
		||||
    tinymce: '富文本编辑器',
 | 
			
		||||
    markdown: 'Markdown',
 | 
			
		||||
    jsonEditor: 'JSON编辑器',
 | 
			
		||||
    dndList: '列表拖拽',
 | 
			
		||||
    splitPane: 'Splitpane',
 | 
			
		||||
    avatarUpload: '头像上传',
 | 
			
		||||
    dropzone: 'Dropzone',
 | 
			
		||||
    sticky: 'Sticky',
 | 
			
		||||
    countTo: 'CountTo',
 | 
			
		||||
    componentMixin: '小组件',
 | 
			
		||||
    backToTop: '返回顶部',
 | 
			
		||||
    charts: '图表',
 | 
			
		||||
    chartsIndex: '介绍',
 | 
			
		||||
    keyboardChart: '键盘图表',
 | 
			
		||||
    keyboardChart2: '键盘图表2',
 | 
			
		||||
    lineChart: '折线图',
 | 
			
		||||
    mixChart: '混合图表',
 | 
			
		||||
    example: '综合实例',
 | 
			
		||||
    Table: 'Table',
 | 
			
		||||
    dynamicTable: '动态table',
 | 
			
		||||
    dragTable: '拖拽table',
 | 
			
		||||
    inlineEditTable: 'table内编辑',
 | 
			
		||||
    complexTabl: '综合table',
 | 
			
		||||
    tab: 'Tab',
 | 
			
		||||
    form: '表单',
 | 
			
		||||
    createForm: '创建表单',
 | 
			
		||||
    editForm: '编辑表单',
 | 
			
		||||
    errorPages: '错误页面',
 | 
			
		||||
    page401: '401',
 | 
			
		||||
    page404: '404',
 | 
			
		||||
    errorLog: '错误日志',
 | 
			
		||||
    excel: 'excel',
 | 
			
		||||
    exportExcel: 'export excel',
 | 
			
		||||
    selectExcel: 'export selected',
 | 
			
		||||
    uploadExcel: 'upload excel',
 | 
			
		||||
    exportZip: 'zip',
 | 
			
		||||
    theme: '换肤',
 | 
			
		||||
    clipboardDemo: 'clipboard',
 | 
			
		||||
    i18n: '国际化'
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user