1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 22:18:07 +08:00

fix: 系统设置操作国际化

This commit is contained in:
ssongliu 2023-02-27 14:12:22 +08:00 committed by ssongliu
parent b3a69725bf
commit 70e1681bcf
3 changed files with 59 additions and 2 deletions

View File

@ -842,7 +842,7 @@ export default {
issue: 'Feedback',
doc: 'Official document',
star: 'Star',
description: '1Panel, A modern open source Linux panel.',
description: '1Panel, Modern, open source Linux server operation and maintenance management panel.',
},
app: {
app: 'Application',

View File

@ -847,7 +847,7 @@ export default {
issue: '问题反馈',
doc: '官方文档',
star: '点亮 Star',
description: '1Panel一款现代化的开源 Linux 面板',
description: '1Panel现代化开源的 Linux 服务器运维管理面板',
},
app: {
app: '应用',

View File

@ -132,6 +132,11 @@ const search = async () => {
.then((res) => {
loading.value = false;
data.value = res.data.items;
if (globalStore.language === 'zh') {
for (const item of data.value) {
item.detailZH = loadDetail(item.detailZH);
}
}
paginationConfig.total = res.data.total;
})
.catch(() => {
@ -148,6 +153,58 @@ const onClean = async () => {
confirmDialogRef.value!.acceptParams(params);
};
const loadDetail = (log: string) => {
if (log.indexOf('[enable]') !== -1) {
log = log.replace('[enable]', '[' + i18n.global.t('commons.button.enable') + ']');
}
if (log.indexOf('[disable]') !== -1) {
log = log.replace('[disable]', '[' + i18n.global.t('commons.button.disable') + ']');
}
if (log.indexOf('[light]') !== -1) {
log = log.replace('[light]', '[' + i18n.global.t('setting.light') + ']');
}
if (log.indexOf('[dark]') !== -1) {
log = log.replace('[dark]', '[' + i18n.global.t('setting.dark') + ']');
}
if (log.indexOf('[UserName]') !== -1) {
return log.replace('[UserName]', '[' + i18n.global.t('setting.user') + ']');
}
if (log.indexOf('[PanelName]') !== -1) {
return log.replace('[PanelName]', '[' + i18n.global.t('setting.title') + ']');
}
if (log.indexOf('[Language]') !== -1) {
return log.replace('[Language]', '[' + i18n.global.t('setting.language') + ']');
}
if (log.indexOf('[Theme]') !== -1) {
return log.replace('[Theme]', '[' + i18n.global.t('setting.theme') + ']');
}
if (log.indexOf('[SessionTimeout]') !== -1) {
return log.replace('[SessionTimeout]', '[' + i18n.global.t('setting.sessionTimeout') + ']');
}
if (log.indexOf('[ExpirationDays]') !== -1) {
return log.replace('[ExpirationDays]', '[' + i18n.global.t('setting.expirationTime') + ']');
}
if (log.indexOf('[ComplexityVerification]') !== -1) {
return log.replace('[ComplexityVerification]', '[' + i18n.global.t('setting.complexity') + ']');
}
if (log.indexOf('[MFAStatus]') !== -1) {
return log.replace('[MFAStatus]', '[' + i18n.global.t('setting.mfa') + ']');
}
if (log.indexOf('[MonitorStatus]') !== -1) {
return log.replace('[MonitorStatus]', '[' + i18n.global.t('setting.enableMonitor') + ']');
}
if (log.indexOf('[MonitorStoreDays]') !== -1) {
return log.replace('[MonitorStoreDays]', '[' + i18n.global.t('setting.monitor') + ']');
}
if (log.indexOf('[MonitorStoreDays]') !== -1) {
return log.replace('[MonitorStoreDays]', '[' + i18n.global.t('setting.monitor') + ']');
}
if (log.indexOf('[MonitorStoreDays]') !== -1) {
return log.replace('[MonitorStoreDays]', '[' + i18n.global.t('setting.monitor') + ']');
}
return log;
};
const onSubmitClean = async () => {
await cleanLogs({ logType: 'operation' });
search();