up
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
export default {
|
||||
// tabBar
|
||||
tabBar: {
|
||||
home: 'Home',
|
||||
settings: 'Settings',
|
||||
},
|
||||
// 首页
|
||||
index: {
|
||||
welcome: 'Welcome to OPS',
|
||||
subtitle: 'Operations Management System',
|
||||
quickActions: 'Quick Actions',
|
||||
allOrders: 'All Orders',
|
||||
addOrder: 'New Order',
|
||||
schedule: 'Schedule',
|
||||
language: 'Language',
|
||||
logout: 'Logout',
|
||||
logoutConfirm: 'Confirm Logout',
|
||||
logoutMessage: 'Are you sure you want to logout?',
|
||||
pending: 'Pending',
|
||||
ordered: 'Ordered',
|
||||
arrived: 'Arrived',
|
||||
received: 'Received',
|
||||
},
|
||||
// 登录页
|
||||
login: {
|
||||
title: 'Login',
|
||||
username: 'Username',
|
||||
password: 'Password',
|
||||
rememberMe: 'Remember me',
|
||||
loginBtn: 'Login',
|
||||
logging: 'Logging in...',
|
||||
registerLink: "Don't have an account?",
|
||||
forgotLink: 'Forgot password?',
|
||||
usernamePlaceholder: 'Enter username',
|
||||
passwordPlaceholder: 'Enter password',
|
||||
// 错误提示
|
||||
usernameRequired: 'Please enter username',
|
||||
passwordRequired: 'Please enter password',
|
||||
loginSuccess: 'Login successful',
|
||||
loginFailed: 'Login failed, please check username and password',
|
||||
networkError: 'Network error, please try again later',
|
||||
usernameNotFound: 'Username not found',
|
||||
passwordIncorrect: 'Username or password incorrect',
|
||||
paramError: 'Parameter error',
|
||||
requestFailed: 'Request failed',
|
||||
},
|
||||
// 注册页
|
||||
register: {
|
||||
title: 'Register',
|
||||
username: 'Username',
|
||||
email: 'Email',
|
||||
password: 'Password',
|
||||
confirmPassword: 'Confirm Password',
|
||||
registerBtn: 'Register',
|
||||
registering: 'Registering...',
|
||||
loginLink: 'Already have an account?',
|
||||
usernamePlaceholder: 'Enter username',
|
||||
emailPlaceholder: 'Enter email',
|
||||
passwordPlaceholder: 'Enter password',
|
||||
confirmPlaceholder: 'Confirm password',
|
||||
showPassword: 'Show password',
|
||||
hidePassword: 'Hide password',
|
||||
// 验证提示
|
||||
usernameRequired: 'Please enter username',
|
||||
emailRequired: 'Please enter email',
|
||||
emailInvalid: 'Invalid email format',
|
||||
passwordRequired: 'Please enter password',
|
||||
passwordLength: 'Password must be at least 6 characters',
|
||||
confirmRequired: 'Please confirm password',
|
||||
passwordMismatch: 'Passwords do not match',
|
||||
// 结果提示
|
||||
usernameExists: 'Username already exists',
|
||||
emailUsed: 'Email already in use',
|
||||
paramError: 'Parameter error',
|
||||
requestFailed: 'Request failed',
|
||||
registerSuccess: 'Registration successful',
|
||||
registerFailed: 'Registration failed, please try again later',
|
||||
},
|
||||
// API 配置页
|
||||
apiConfig: {
|
||||
title: 'Settings',
|
||||
apiUrl: 'API Server URL',
|
||||
apiUrlPlaceholder: 'Enter API address',
|
||||
format: 'Format',
|
||||
current: 'Current',
|
||||
notSet: 'Not set',
|
||||
save: 'Save',
|
||||
saveSuccess: 'Saved successfully',
|
||||
pleaseInput: 'Please enter API address',
|
||||
testConnection: 'Test Connection',
|
||||
testBtn: 'Test Connection',
|
||||
testing: 'Testing...',
|
||||
connectionSuccess: 'Connection successful',
|
||||
connectionFailed: 'Connection failed',
|
||||
language: 'Language',
|
||||
zh: '中文',
|
||||
en: 'English',
|
||||
},
|
||||
// 通用
|
||||
common: {
|
||||
loading: 'Loading...',
|
||||
error: 'Request failed',
|
||||
retry: 'Retry',
|
||||
confirm: 'Confirm',
|
||||
cancel: 'Cancel',
|
||||
success: 'Operation successful',
|
||||
failed: 'Operation failed',
|
||||
back: 'Back',
|
||||
networkError: 'Network request failed, please check your connection',
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { createI18n } from 'vue-i18n'
|
||||
import zh from './zh.js'
|
||||
import en from './en.js'
|
||||
|
||||
// 获取本地语言设置,默认中文
|
||||
function getLocale() {
|
||||
// 从本地存储读取
|
||||
const stored = uni.getStorageSync('locale')
|
||||
if (stored) return stored
|
||||
|
||||
// 获取系统语言
|
||||
const sysInfo = uni.getSystemInfoSync()
|
||||
const sysLang = sysInfo.language || 'zh-CN'
|
||||
// 简单判断:是否以 zh 开头
|
||||
return sysLang.toLowerCase().startsWith('zh') ? 'zh' : 'en'
|
||||
}
|
||||
|
||||
// 创建 i18n 实例
|
||||
export const i18n = createI18n({
|
||||
legacy: false, // uni-app 必须用 composition API 模式
|
||||
locale: getLocale(),
|
||||
fallbackLocale: 'zh',
|
||||
messages: {
|
||||
zh,
|
||||
en
|
||||
}
|
||||
})
|
||||
|
||||
// 切换语言
|
||||
export function setLocale(locale) {
|
||||
if (i18n.global.locale && typeof i18n.global.locale.value !== 'undefined') {
|
||||
i18n.global.locale.value = locale
|
||||
} else {
|
||||
i18n.global.locale = locale
|
||||
}
|
||||
uni.setStorageSync('locale', locale)
|
||||
// 触发页面更新
|
||||
uni.$emit('localeChanged', locale)
|
||||
}
|
||||
|
||||
// 获取当前语言
|
||||
export function getCurrentLocale() {
|
||||
if (i18n.global.locale && typeof i18n.global.locale.value !== 'undefined') {
|
||||
return i18n.global.locale.value
|
||||
}
|
||||
return i18n.global.locale
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
export default {
|
||||
// tabBar
|
||||
tabBar: {
|
||||
home: '首页',
|
||||
settings: '设置',
|
||||
},
|
||||
// 首页
|
||||
index: {
|
||||
welcome: '欢迎使用 OPS',
|
||||
subtitle: '运营管理系统',
|
||||
quickActions: '快捷操作',
|
||||
allOrders: '全部订单',
|
||||
addOrder: '新建订单',
|
||||
schedule: '日程管理',
|
||||
language: '语言',
|
||||
logout: '退出登录',
|
||||
logoutConfirm: '确认退出',
|
||||
logoutMessage: '确定要退出登录吗?',
|
||||
pending: '待处理',
|
||||
ordered: '已下单',
|
||||
arrived: '已到达',
|
||||
received: '已收件',
|
||||
},
|
||||
// 登录页
|
||||
login: {
|
||||
title: '登录',
|
||||
username: '用户名',
|
||||
password: '密码',
|
||||
rememberMe: '记住登录状态',
|
||||
loginBtn: '登 录',
|
||||
logging: '登录中...',
|
||||
registerLink: '没有账号?立即注册',
|
||||
forgotLink: '忘记密码?',
|
||||
usernamePlaceholder: '请输入用户名',
|
||||
passwordPlaceholder: '请输入密码',
|
||||
// 错误提示
|
||||
usernameRequired: '请输入用户名',
|
||||
passwordRequired: '请输入密码',
|
||||
loginSuccess: '登录成功',
|
||||
loginFailed: '登录失败,请检查用户名和密码',
|
||||
networkError: '网络错误,请稍后重试',
|
||||
usernameNotFound: '用户名不存在',
|
||||
passwordIncorrect: '用户名或密码错误',
|
||||
paramError: '参数错误',
|
||||
requestFailed: '请求失败',
|
||||
},
|
||||
// 注册页
|
||||
register: {
|
||||
title: '注册',
|
||||
username: '用户名',
|
||||
email: '邮箱',
|
||||
password: '密码',
|
||||
confirmPassword: '确认密码',
|
||||
registerBtn: '注 册',
|
||||
registering: '注册中...',
|
||||
loginLink: '已有账号?立即登录',
|
||||
usernamePlaceholder: '请输入用户名',
|
||||
emailPlaceholder: '请输入邮箱',
|
||||
passwordPlaceholder: '请输入密码',
|
||||
confirmPlaceholder: '请再次输入密码',
|
||||
showPassword: '显示密码',
|
||||
hidePassword: '隐藏密码',
|
||||
// 验证提示
|
||||
usernameRequired: '请输入用户名',
|
||||
emailRequired: '请输入邮箱',
|
||||
emailInvalid: '邮箱格式不正确',
|
||||
passwordRequired: '请输入密码',
|
||||
passwordLength: '密码至少6位',
|
||||
confirmRequired: '请确认密码',
|
||||
passwordMismatch: '两次密码输入不一致',
|
||||
// 结果提示
|
||||
usernameExists: '用户名已存在',
|
||||
emailUsed: '邮箱已被使用',
|
||||
paramError: '参数错误',
|
||||
requestFailed: '请求失败',
|
||||
registerSuccess: '注册成功',
|
||||
registerFailed: '注册失败,请稍后重试',
|
||||
},
|
||||
// API 配置页
|
||||
apiConfig: {
|
||||
title: '设置',
|
||||
apiUrl: 'API 服务器地址',
|
||||
apiUrlPlaceholder: '请输入 API 地址',
|
||||
format: '格式',
|
||||
current: '当前',
|
||||
notSet: '未设置',
|
||||
save: '保存配置',
|
||||
saveSuccess: '保存成功',
|
||||
pleaseInput: '请输入 API 地址',
|
||||
testConnection: '测试连接',
|
||||
testBtn: '测试连接',
|
||||
testing: '测试中...',
|
||||
connectionSuccess: '连接成功',
|
||||
connectionFailed: '连接失败',
|
||||
language: '语言设置',
|
||||
zh: '中文',
|
||||
en: 'English',
|
||||
},
|
||||
// 通用
|
||||
common: {
|
||||
loading: '加载中...',
|
||||
error: '请求失败',
|
||||
retry: '重试',
|
||||
confirm: '确定',
|
||||
cancel: '取消',
|
||||
success: '操作成功',
|
||||
failed: '操作失败',
|
||||
back: '返回',
|
||||
networkError: '网络请求失败,请检查网络',
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user