|
|
|
|
@ -0,0 +1,471 @@
|
|
|
|
|
import { createI18n } from 'vue-i18n'
|
|
|
|
|
|
|
|
|
|
const LOCALE_STORAGE_KEY = 'app_locale'
|
|
|
|
|
const LOCALE_CHANGE_EVENT = 'app-locale-changed'
|
|
|
|
|
const DEFAULT_LOCALE = 'zh-CN'
|
|
|
|
|
|
|
|
|
|
const messages = {
|
|
|
|
|
'zh-CN': {
|
|
|
|
|
common: {
|
|
|
|
|
submit: '提交',
|
|
|
|
|
close: '关闭',
|
|
|
|
|
exit: '退出',
|
|
|
|
|
notice: '通知',
|
|
|
|
|
moduleBuilding: '模块建设中~',
|
|
|
|
|
updateSuccess: '修改成功',
|
|
|
|
|
confirmLogout: '确定注销并退出系统吗',
|
|
|
|
|
languageSwitched: '语言已切换'
|
|
|
|
|
},
|
|
|
|
|
tab: {
|
|
|
|
|
home: '首页',
|
|
|
|
|
report: '报表',
|
|
|
|
|
work: '管理',
|
|
|
|
|
mine: '我的'
|
|
|
|
|
},
|
|
|
|
|
nav: {
|
|
|
|
|
home: '首页',
|
|
|
|
|
mine: '个人中心',
|
|
|
|
|
avatar: '修改头像',
|
|
|
|
|
info: '个人信息',
|
|
|
|
|
editInfo: '编辑资料',
|
|
|
|
|
pwd: '修改密码',
|
|
|
|
|
setting: '应用设置',
|
|
|
|
|
help: '常见问题',
|
|
|
|
|
about: '关于我们'
|
|
|
|
|
},
|
|
|
|
|
dashboard: {
|
|
|
|
|
welcome: '欢迎您使用',
|
|
|
|
|
subtitle: '必硕数字化智能中控平台',
|
|
|
|
|
functionNav: '功能导航',
|
|
|
|
|
productionOverview: '生产整体概况',
|
|
|
|
|
productionPlan: '生产计划',
|
|
|
|
|
collapseList: '收起列表',
|
|
|
|
|
viewMore: '查看更多 ›',
|
|
|
|
|
productName: '产品名称',
|
|
|
|
|
pipeline: '生产线',
|
|
|
|
|
planNumber: '计划数量',
|
|
|
|
|
planStart: '计划开始',
|
|
|
|
|
planEnd: '计划结束',
|
|
|
|
|
back: '返回',
|
|
|
|
|
todoTitle: '待办任务',
|
|
|
|
|
noTodo: '暂无待办任务',
|
|
|
|
|
taskCode: '任务编号:{value}',
|
|
|
|
|
taskType: '任务类型:{value}',
|
|
|
|
|
taskTarget: '目标:{value}',
|
|
|
|
|
createTime: '创建时间:{value}',
|
|
|
|
|
all: '总数',
|
|
|
|
|
pending: '未开工',
|
|
|
|
|
running: '生产中',
|
|
|
|
|
finished: '完工',
|
|
|
|
|
mold: '模具',
|
|
|
|
|
equipment: '设备',
|
|
|
|
|
keypart: '关键件',
|
|
|
|
|
spare: '备件',
|
|
|
|
|
product: '产品物料',
|
|
|
|
|
statusScheduled: '已排产',
|
|
|
|
|
statusTrial: '试产',
|
|
|
|
|
statusMass: '量产',
|
|
|
|
|
statusPause: '暂停',
|
|
|
|
|
statusWaitStockIn: '待入库',
|
|
|
|
|
viewPlan: '查看计划: {code}'
|
|
|
|
|
},
|
|
|
|
|
functionCommon: {
|
|
|
|
|
search: '查询',
|
|
|
|
|
cancel: '取消',
|
|
|
|
|
save: '保存',
|
|
|
|
|
loading: '加载中...',
|
|
|
|
|
loadingMore: '正在加载更多...',
|
|
|
|
|
noMoreData: '没有更多数据了',
|
|
|
|
|
noIdView: '缺少ID,无法查看详情',
|
|
|
|
|
noIdEdit: '缺少ID,无法编辑',
|
|
|
|
|
noIdDelete: '缺少ID,无法删除',
|
|
|
|
|
loadFailed: '加载失败',
|
|
|
|
|
deleteSuccess: '删除成功',
|
|
|
|
|
deleteFailed: '删除失败',
|
|
|
|
|
saveFailed: '保存失败',
|
|
|
|
|
createSuccess: '新增成功',
|
|
|
|
|
updateSuccess: '更新成功',
|
|
|
|
|
confirmDelete: '确认删除',
|
|
|
|
|
uploading: '上传中',
|
|
|
|
|
uploadImageFailed: '图片上传失败',
|
|
|
|
|
yes: '是',
|
|
|
|
|
no: '否'
|
|
|
|
|
},
|
|
|
|
|
mine: {
|
|
|
|
|
clickLogin: '点击登录',
|
|
|
|
|
username: '用户名:{name}',
|
|
|
|
|
profile: '个人信息',
|
|
|
|
|
feedback: '反馈中心',
|
|
|
|
|
service: '在线客服',
|
|
|
|
|
changePassword: '修改密码',
|
|
|
|
|
logout: '退出登录',
|
|
|
|
|
editProfile: '编辑资料',
|
|
|
|
|
faq: '常见问题',
|
|
|
|
|
about: '关于我们',
|
|
|
|
|
appSettings: '应用设置'
|
|
|
|
|
},
|
|
|
|
|
setting: {
|
|
|
|
|
language: '系统语言',
|
|
|
|
|
currentLanguage: '当前语言:{language}',
|
|
|
|
|
switchLanguage: '切换语言',
|
|
|
|
|
checkUpdate: '检查更新',
|
|
|
|
|
cleanCache: '清理缓存',
|
|
|
|
|
logout: '退出登录',
|
|
|
|
|
zhCN: '中文',
|
|
|
|
|
enUS: '英文'
|
|
|
|
|
},
|
|
|
|
|
about: {
|
|
|
|
|
appName: '必硕生管系统',
|
|
|
|
|
version: '版本信息',
|
|
|
|
|
email: '官方邮箱',
|
|
|
|
|
hotline: '服务热线',
|
|
|
|
|
website: '公司网站'
|
|
|
|
|
},
|
|
|
|
|
help: {
|
|
|
|
|
appUserQuestion: 'APP用户问题',
|
|
|
|
|
otherQuestion: '其他问题',
|
|
|
|
|
appFeatureQuestion: 'APP支持的功能业务有哪些?',
|
|
|
|
|
appFeatureAnswer: '计划开工、生产报工、投料记录、生产记录',
|
|
|
|
|
reportQuestion: '生产报工如何报工?',
|
|
|
|
|
reportAnswer: '可以',
|
|
|
|
|
planQuestion: '计划管理如何进行?',
|
|
|
|
|
planAnswer: '计划管理',
|
|
|
|
|
materialQuestion: '投料记录如何进行?',
|
|
|
|
|
materialAnswer: '投料记录',
|
|
|
|
|
logoutQuestion: '如何退出登录?',
|
|
|
|
|
logoutAnswer: '请点击[我的] - [应用设置] - [退出登录]即可退出登录',
|
|
|
|
|
avatarQuestion: '如何修改用户头像?',
|
|
|
|
|
avatarAnswer: '请点击[我的] - [选择头像] - [点击提交]即可更换用户头像',
|
|
|
|
|
passwordQuestion: '如何修改登录密码?',
|
|
|
|
|
passwordAnswer: '请点击[我的] - [应用设置] - [修改密码]即可修改登录密码'
|
|
|
|
|
},
|
|
|
|
|
info: {
|
|
|
|
|
username: '用户名称',
|
|
|
|
|
nickname: '昵称',
|
|
|
|
|
gender: '性别',
|
|
|
|
|
male: '男',
|
|
|
|
|
female: '女',
|
|
|
|
|
phone: '手机号码',
|
|
|
|
|
email: '邮箱',
|
|
|
|
|
createdAt: '创建日期'
|
|
|
|
|
},
|
|
|
|
|
editInfo: {
|
|
|
|
|
nickname: '用户昵称',
|
|
|
|
|
nicknamePlaceholder: '请输入昵称',
|
|
|
|
|
phone: '手机号码',
|
|
|
|
|
phonePlaceholder: '请输入手机号码',
|
|
|
|
|
email: '邮箱',
|
|
|
|
|
emailPlaceholder: '请输入邮箱',
|
|
|
|
|
gender: '性别',
|
|
|
|
|
nicknameRequired: '用户昵称不能为空',
|
|
|
|
|
phoneRequired: '手机号码不能为空',
|
|
|
|
|
phoneInvalid: '请输入正确的手机号码',
|
|
|
|
|
emailRequired: '邮箱地址不能为空',
|
|
|
|
|
emailInvalid: '请输入正确的邮箱地址'
|
|
|
|
|
},
|
|
|
|
|
pwd: {
|
|
|
|
|
oldPassword: '旧密码',
|
|
|
|
|
newPassword: '新密码',
|
|
|
|
|
confirmPassword: '确认密码',
|
|
|
|
|
oldPasswordPlaceholder: '请输入旧密码',
|
|
|
|
|
newPasswordPlaceholder: '请输入新密码',
|
|
|
|
|
confirmPasswordPlaceholder: '请确认新密码',
|
|
|
|
|
oldPasswordRequired: '旧密码不能为空',
|
|
|
|
|
newPasswordRequired: '新密码不能为空',
|
|
|
|
|
passwordLength: '长度在 6 到 20 个字符',
|
|
|
|
|
confirmPasswordRequired: '确认密码不能为空',
|
|
|
|
|
passwordNotMatch: '两次输入的密码不一致'
|
|
|
|
|
},
|
|
|
|
|
avatar: {
|
|
|
|
|
chooseAvatar: '选择头像'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'en-US': {
|
|
|
|
|
common: {
|
|
|
|
|
submit: 'Submit',
|
|
|
|
|
close: 'Close',
|
|
|
|
|
exit: 'Exit',
|
|
|
|
|
notice: 'Notice',
|
|
|
|
|
moduleBuilding: 'This module is under construction',
|
|
|
|
|
updateSuccess: 'Updated successfully',
|
|
|
|
|
confirmLogout: 'Are you sure you want to log out?',
|
|
|
|
|
languageSwitched: 'Language switched'
|
|
|
|
|
},
|
|
|
|
|
tab: {
|
|
|
|
|
home: 'Home',
|
|
|
|
|
report: 'Reports',
|
|
|
|
|
work: 'Manage',
|
|
|
|
|
mine: 'Mine'
|
|
|
|
|
},
|
|
|
|
|
nav: {
|
|
|
|
|
home: 'Home',
|
|
|
|
|
mine: 'Profile',
|
|
|
|
|
avatar: 'Edit Avatar',
|
|
|
|
|
info: 'Profile',
|
|
|
|
|
editInfo: 'Edit Profile',
|
|
|
|
|
pwd: 'Change Password',
|
|
|
|
|
setting: 'App Settings',
|
|
|
|
|
help: 'FAQ',
|
|
|
|
|
about: 'About'
|
|
|
|
|
},
|
|
|
|
|
dashboard: {
|
|
|
|
|
welcome: 'Welcome to',
|
|
|
|
|
subtitle: 'Besure Digital Intelligent Control Platform',
|
|
|
|
|
functionNav: 'Function Navigation',
|
|
|
|
|
productionOverview: 'Production Overview',
|
|
|
|
|
productionPlan: 'Production Plans',
|
|
|
|
|
collapseList: 'Collapse',
|
|
|
|
|
viewMore: 'View More ›',
|
|
|
|
|
productName: 'Product',
|
|
|
|
|
pipeline: 'Production Line',
|
|
|
|
|
planNumber: 'Planned Qty',
|
|
|
|
|
planStart: 'Start',
|
|
|
|
|
planEnd: 'End',
|
|
|
|
|
back: 'Back',
|
|
|
|
|
todoTitle: 'To-do Tasks',
|
|
|
|
|
noTodo: 'No pending tasks',
|
|
|
|
|
taskCode: 'Task Code: {value}',
|
|
|
|
|
taskType: 'Task Type: {value}',
|
|
|
|
|
taskTarget: 'Target: {value}',
|
|
|
|
|
createTime: 'Created At: {value}',
|
|
|
|
|
all: 'Total',
|
|
|
|
|
pending: 'Pending',
|
|
|
|
|
running: 'In Progress',
|
|
|
|
|
finished: 'Done',
|
|
|
|
|
mold: 'Mold',
|
|
|
|
|
equipment: 'Equipment',
|
|
|
|
|
keypart: 'Key Part',
|
|
|
|
|
spare: 'Spare Part',
|
|
|
|
|
product: 'Product Material',
|
|
|
|
|
statusScheduled: 'Scheduled',
|
|
|
|
|
statusTrial: 'Trial',
|
|
|
|
|
statusMass: 'Mass',
|
|
|
|
|
statusPause: 'Paused',
|
|
|
|
|
statusWaitStockIn: 'Waiting Stock-in',
|
|
|
|
|
viewPlan: 'View Plan: {code}'
|
|
|
|
|
},
|
|
|
|
|
functionCommon: {
|
|
|
|
|
search: 'Search',
|
|
|
|
|
cancel: 'Cancel',
|
|
|
|
|
save: 'Save',
|
|
|
|
|
loading: 'Loading...',
|
|
|
|
|
loadingMore: 'Loading more...',
|
|
|
|
|
noMoreData: 'No more data',
|
|
|
|
|
noIdView: 'Missing ID, cannot view details',
|
|
|
|
|
noIdEdit: 'Missing ID, cannot edit',
|
|
|
|
|
noIdDelete: 'Missing ID, cannot delete',
|
|
|
|
|
loadFailed: 'Load failed',
|
|
|
|
|
deleteSuccess: 'Deleted successfully',
|
|
|
|
|
deleteFailed: 'Delete failed',
|
|
|
|
|
saveFailed: 'Save failed',
|
|
|
|
|
createSuccess: 'Created successfully',
|
|
|
|
|
updateSuccess: 'Updated successfully',
|
|
|
|
|
confirmDelete: 'Confirm deletion',
|
|
|
|
|
uploading: 'Uploading',
|
|
|
|
|
uploadImageFailed: 'Image upload failed',
|
|
|
|
|
yes: 'Yes',
|
|
|
|
|
no: 'No'
|
|
|
|
|
},
|
|
|
|
|
mine: {
|
|
|
|
|
clickLogin: 'Tap to sign in',
|
|
|
|
|
username: 'Username: {name}',
|
|
|
|
|
profile: 'Profile',
|
|
|
|
|
feedback: 'Feedback',
|
|
|
|
|
service: 'Support',
|
|
|
|
|
changePassword: 'Change Password',
|
|
|
|
|
logout: 'Log Out',
|
|
|
|
|
editProfile: 'Edit Profile',
|
|
|
|
|
faq: 'FAQ',
|
|
|
|
|
about: 'About',
|
|
|
|
|
appSettings: 'Settings'
|
|
|
|
|
},
|
|
|
|
|
setting: {
|
|
|
|
|
language: 'System Language',
|
|
|
|
|
currentLanguage: 'Current: {language}',
|
|
|
|
|
switchLanguage: 'Switch Language',
|
|
|
|
|
checkUpdate: 'Check Updates',
|
|
|
|
|
cleanCache: 'Clear Cache',
|
|
|
|
|
logout: 'Log Out',
|
|
|
|
|
zhCN: 'Chinese',
|
|
|
|
|
enUS: 'English'
|
|
|
|
|
},
|
|
|
|
|
about: {
|
|
|
|
|
appName: 'Besure Production System',
|
|
|
|
|
version: 'Version',
|
|
|
|
|
email: 'Official Email',
|
|
|
|
|
hotline: 'Service Hotline',
|
|
|
|
|
website: 'Website'
|
|
|
|
|
},
|
|
|
|
|
help: {
|
|
|
|
|
appUserQuestion: 'App User Questions',
|
|
|
|
|
otherQuestion: 'Other Questions',
|
|
|
|
|
appFeatureQuestion: 'What business features are supported by the app?',
|
|
|
|
|
appFeatureAnswer: 'Plan start, production report, material feeding records, production records',
|
|
|
|
|
reportQuestion: 'How can I submit a production report?',
|
|
|
|
|
reportAnswer: 'You can submit it on the report page.',
|
|
|
|
|
planQuestion: 'How is plan management handled?',
|
|
|
|
|
planAnswer: 'Use the plan management module.',
|
|
|
|
|
materialQuestion: 'How to manage feeding records?',
|
|
|
|
|
materialAnswer: 'Use the feeding record module.',
|
|
|
|
|
logoutQuestion: 'How do I log out?',
|
|
|
|
|
logoutAnswer: 'Go to [Mine] - [App Settings] - [Log Out] to sign out.',
|
|
|
|
|
avatarQuestion: 'How do I change my avatar?',
|
|
|
|
|
avatarAnswer: 'Go to [Mine] - [Choose Avatar] - [Submit] to update your avatar.',
|
|
|
|
|
passwordQuestion: 'How do I change my login password?',
|
|
|
|
|
passwordAnswer: 'Go to [Mine] - [App Settings] - [Change Password] to update your password.'
|
|
|
|
|
},
|
|
|
|
|
info: {
|
|
|
|
|
username: 'Username',
|
|
|
|
|
nickname: 'Nickname',
|
|
|
|
|
gender: 'Gender',
|
|
|
|
|
male: 'Male',
|
|
|
|
|
female: 'Female',
|
|
|
|
|
phone: 'Mobile',
|
|
|
|
|
email: 'Email',
|
|
|
|
|
createdAt: 'Created At'
|
|
|
|
|
},
|
|
|
|
|
editInfo: {
|
|
|
|
|
nickname: 'Nickname',
|
|
|
|
|
nicknamePlaceholder: 'Enter nickname',
|
|
|
|
|
phone: 'Mobile',
|
|
|
|
|
phonePlaceholder: 'Enter mobile number',
|
|
|
|
|
email: 'Email',
|
|
|
|
|
emailPlaceholder: 'Enter email',
|
|
|
|
|
gender: 'Gender',
|
|
|
|
|
nicknameRequired: 'Nickname is required',
|
|
|
|
|
phoneRequired: 'Mobile number is required',
|
|
|
|
|
phoneInvalid: 'Please enter a valid mobile number',
|
|
|
|
|
emailRequired: 'Email is required',
|
|
|
|
|
emailInvalid: 'Please enter a valid email'
|
|
|
|
|
},
|
|
|
|
|
pwd: {
|
|
|
|
|
oldPassword: 'Current Password',
|
|
|
|
|
newPassword: 'New Password',
|
|
|
|
|
confirmPassword: 'Confirm Password',
|
|
|
|
|
oldPasswordPlaceholder: 'Enter current password',
|
|
|
|
|
newPasswordPlaceholder: 'Enter new password',
|
|
|
|
|
confirmPasswordPlaceholder: 'Confirm new password',
|
|
|
|
|
oldPasswordRequired: 'Current password is required',
|
|
|
|
|
newPasswordRequired: 'New password is required',
|
|
|
|
|
passwordLength: 'Length must be between 6 and 20 characters',
|
|
|
|
|
confirmPasswordRequired: 'Please confirm password',
|
|
|
|
|
passwordNotMatch: 'The two passwords do not match'
|
|
|
|
|
},
|
|
|
|
|
avatar: {
|
|
|
|
|
chooseAvatar: 'Choose Avatar'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function normalizeLocale(locale) {
|
|
|
|
|
if (locale === 'zh' || locale === 'zh_CN' || locale === 'zh-Hans') return 'zh-CN'
|
|
|
|
|
if (locale === 'en' || locale === 'en_US') return 'en-US'
|
|
|
|
|
return locale === 'en-US' ? 'en-US' : 'zh-CN'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getSavedLocale() {
|
|
|
|
|
try {
|
|
|
|
|
const locale = uni.getStorageSync(LOCALE_STORAGE_KEY)
|
|
|
|
|
if (locale) {
|
|
|
|
|
return normalizeLocale(locale)
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
}
|
|
|
|
|
const systemLocale = typeof uni.getLocale === 'function' ? uni.getLocale() : DEFAULT_LOCALE
|
|
|
|
|
return normalizeLocale(systemLocale)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const i18n = createI18n({
|
|
|
|
|
legacy: false,
|
|
|
|
|
locale: getSavedLocale(),
|
|
|
|
|
fallbackLocale: DEFAULT_LOCALE,
|
|
|
|
|
globalInjection: true,
|
|
|
|
|
messages
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const literalMap = {
|
|
|
|
|
'首页': 'nav.home',
|
|
|
|
|
'报表': 'tab.report',
|
|
|
|
|
'管理': 'tab.work',
|
|
|
|
|
'我的': 'tab.mine',
|
|
|
|
|
'返回': 'dashboard.back',
|
|
|
|
|
'查询': 'functionCommon.search',
|
|
|
|
|
'取消': 'functionCommon.cancel',
|
|
|
|
|
'保存': 'functionCommon.save',
|
|
|
|
|
'加载中...': 'functionCommon.loading',
|
|
|
|
|
'正在加载更多...': 'functionCommon.loadingMore',
|
|
|
|
|
'没有更多数据了': 'functionCommon.noMoreData',
|
|
|
|
|
'缺少ID,无法查看详情': 'functionCommon.noIdView',
|
|
|
|
|
'缺少ID,无法编辑': 'functionCommon.noIdEdit',
|
|
|
|
|
'缺少ID,无法删除': 'functionCommon.noIdDelete',
|
|
|
|
|
'加载失败': 'functionCommon.loadFailed',
|
|
|
|
|
'删除成功': 'functionCommon.deleteSuccess',
|
|
|
|
|
'删除失败': 'functionCommon.deleteFailed',
|
|
|
|
|
'保存失败': 'functionCommon.saveFailed',
|
|
|
|
|
'新增成功': 'functionCommon.createSuccess',
|
|
|
|
|
'更新成功': 'functionCommon.updateSuccess',
|
|
|
|
|
'确认删除': 'functionCommon.confirmDelete',
|
|
|
|
|
'上传中': 'functionCommon.uploading',
|
|
|
|
|
'图片上传失败': 'functionCommon.uploadImageFailed',
|
|
|
|
|
'是': 'functionCommon.yes',
|
|
|
|
|
'否': 'functionCommon.no',
|
|
|
|
|
'暂无待办任务': 'dashboard.noTodo'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function applyTabBarLanguage() {
|
|
|
|
|
const labels = [
|
|
|
|
|
i18n.global.t('tab.home'),
|
|
|
|
|
i18n.global.t('tab.report'),
|
|
|
|
|
i18n.global.t('tab.work'),
|
|
|
|
|
i18n.global.t('tab.mine')
|
|
|
|
|
]
|
|
|
|
|
labels.forEach((text, index) => {
|
|
|
|
|
uni.setTabBarItem({
|
|
|
|
|
index,
|
|
|
|
|
text
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getCurrentLocale() {
|
|
|
|
|
return i18n.global.locale.value
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function setLocale(locale) {
|
|
|
|
|
const nextLocale = normalizeLocale(locale)
|
|
|
|
|
i18n.global.locale.value = nextLocale
|
|
|
|
|
uni.setStorageSync(LOCALE_STORAGE_KEY, nextLocale)
|
|
|
|
|
if (typeof uni.setLocale === 'function') {
|
|
|
|
|
uni.setLocale(nextLocale)
|
|
|
|
|
}
|
|
|
|
|
applyTabBarLanguage()
|
|
|
|
|
uni.$emit(LOCALE_CHANGE_EVENT, nextLocale)
|
|
|
|
|
return nextLocale
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function translateLiteral(text) {
|
|
|
|
|
if (typeof text !== 'string') return text
|
|
|
|
|
const key = literalMap[text]
|
|
|
|
|
if (key) return i18n.global.t(key)
|
|
|
|
|
return text
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function initializeLocale() {
|
|
|
|
|
setLocale(getSavedLocale())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function setNavigationTitle(key) {
|
|
|
|
|
uni.setNavigationBarTitle({
|
|
|
|
|
title: i18n.global.t(key)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function onLocaleChange(callback) {
|
|
|
|
|
uni.$on(LOCALE_CHANGE_EVENT, callback)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function offLocaleChange(callback) {
|
|
|
|
|
uni.$off(LOCALE_CHANGE_EVENT, callback)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default i18n
|