feat(l2): 添加多环境配置及国际化支持

- 新增klp和g30环境配置文件
- 添加vue-i18n实现中英文切换
- 更新package.json添加环境组相关脚本
- 修改vue.config.js支持多环境配置加载
This commit is contained in:
砂糖
2025-12-27 13:35:47 +08:00
parent 3650d87a34
commit 4fa6a1f59a
13 changed files with 349 additions and 43 deletions

50
apps/l2/src/i18n/en-US.js Normal file
View File

@@ -0,0 +1,50 @@
export default {
common: {
title: 'Galvanizing Line & Production Process Management System',
home: 'Home',
dashboard: 'Dashboard',
system: 'System Management',
monitor: 'System Monitoring',
tool: 'Tools',
logout: 'Logout',
login: 'Login',
register: 'Register',
username: 'Username',
password: 'Password',
remember: 'Remember me',
forgetPassword: 'Forgot password',
submit: 'Submit',
reset: 'Reset',
add: 'Add',
edit: 'Edit',
delete: 'Delete',
view: 'View',
search: 'Search',
refresh: 'Refresh',
save: 'Save',
cancel: 'Cancel',
confirm: 'Confirm',
back: 'Back',
success: 'Success',
error: 'Error',
warning: 'Warning',
info: 'Info',
yes: 'Yes',
no: 'No',
operation: 'Operation',
status: 'Status',
createTime: 'Create Time',
updateTime: 'Update Time',
remark: 'Remark',
pleaseSelect: 'Please select',
pleaseInput: 'Please input',
pleaseEnter: 'Please enter'
},
dashboard: {
welcome: 'Welcome to Galvanizing Line & Production Process Management System',
todayData: 'Today\'s Data',
totalData: 'Total Data',
onlineUsers: 'Online Users',
systemInfo: 'System Information'
}
}

34
apps/l2/src/i18n/index.js Normal file
View File

@@ -0,0 +1,34 @@
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import ElementLocale from 'element-ui/lib/locale'
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
Vue.use(VueI18n)
// 从环境变量读取语言设置优先使用VUE_APP_I18N_LOCALE
const locale = process.env.VUE_APP_I18N_LOCALE || 'zh-CN'
// 合并系统语言包和Element UI语言包
const messages = {
'zh-CN': {
...require('./zh-CN'),
...zhLocale
},
'en-US': {
...require('./en-US'),
...enLocale
}
}
// 创建i18n实例
const i18n = new VueI18n({
locale,
fallbackLocale: 'zh-CN',
messages
})
// 设置Element UI的i18n
ElementLocale.i18n((key, value) => i18n.t(key, value))
export default i18n

50
apps/l2/src/i18n/zh-CN.js Normal file
View File

@@ -0,0 +1,50 @@
export default {
common: {
title: '镀锌机组及生产工艺管理系统',
home: '首页',
dashboard: '仪表盘',
system: '系统管理',
monitor: '系统监控',
tool: '工具',
logout: '退出登录',
login: '登录',
register: '注册',
username: '用户名',
password: '密码',
remember: '记住我',
forgetPassword: '忘记密码',
submit: '提交',
reset: '重置',
add: '新增',
edit: '编辑',
delete: '删除',
view: '查看',
search: '搜索',
refresh: '刷新',
save: '保存',
cancel: '取消',
confirm: '确认',
back: '返回',
success: '成功',
error: '错误',
warning: '警告',
info: '提示',
yes: '是',
no: '否',
operation: '操作',
status: '状态',
createTime: '创建时间',
updateTime: '更新时间',
remark: '备注',
pleaseSelect: '请选择',
pleaseInput: '请输入',
pleaseEnter: '请输入'
},
dashboard: {
welcome: '欢迎使用镀锌机组及生产工艺管理系统',
todayData: '今日数据',
totalData: '累计数据',
onlineUsers: '在线用户',
systemInfo: '系统信息'
}
}

View File

@@ -5,6 +5,7 @@ import VueKonva from 'vue-konva';
import Element from 'element-ui'
import './assets/styles/element-variables.scss'
import i18n from './i18n' // 引入i18n配置
import '@/assets/styles/index.scss' // global css
// import '@/assets/styles/ruoyi.scss' // ruoyi css
@@ -72,7 +73,8 @@ DictData.install()
*/
Vue.use(Element, {
size: Cookies.get('size') || 'small' // set element-ui default size
size: Cookies.get('size') || 'small', // set element-ui default size
i18n: (key, value) => i18n.t(key, value) // i18n support
})
Vue.config.productionTip = false
@@ -81,5 +83,6 @@ new Vue({
el: '#app',
router,
store,
i18n,
render: h => h(App)
})