Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(i18n): add some i18n text that cannot be synchronized #327

Merged
merged 2 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/composables/config/useDeleteDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ export default () => {
const { t } = useI18n()
const delDriver = async ({ name }: DriverItemInList) => {
try {
await EmqxMessageBox({ title: t('common.operateConfirm'), message: t('common.confirmDelete'), type: 'warning' })
await EmqxMessageBox({
title: t('common.operateConfirm'),
message: t('common.confirmDelete'),
type: 'warning',
confirmButtonText: t('common.confirmButtonText'),
})
await deleteDriver(name)
EmqxMessage.success(t('common.operateSuccessfully'))
return Promise.resolve()
Expand Down
18 changes: 15 additions & 3 deletions src/composables/config/useGroupList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ export default () => {
}

const delGroup = async ({ name }: GroupDataInTable) => {
await EmqxMessageBox({ title: t('common.operateConfirm'), message: t('common.confirmDelete') })
await EmqxMessageBox({
title: t('common.operateConfirm'),
message: t('common.confirmDelete'),
confirmButtonText: t('common.confirmButtonText'),
})
await deleteGroup(node.value, name)
EmqxMessage.success(t('common.operateSuccessfully'))
getGroupList()
Expand All @@ -66,12 +70,20 @@ export default () => {
}

const batchDeleteGroup = async () => {
await EmqxMessageBox({ title: t('common.operateConfirm'), message: t('common.confirmDelete') })
await EmqxMessageBox({
title: t('common.operateConfirm'),
message: t('common.confirmDelete'),
confirmButtonText: t('common.confirmButtonText'),
})
delGroupList(groupCheckedList.value)
}

const clearGroup = async () => {
await EmqxMessageBox({ title: t('common.operateConfirm'), message: t('common.confirmClear') })
await EmqxMessageBox({
title: t('common.operateConfirm'),
message: t('common.confirmClear'),
confirmButtonText: t('common.confirmButtonText'),
})
delGroupList(groupList.value)
}

Expand Down
7 changes: 6 additions & 1 deletion src/composables/config/usePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@ export const useDeletePlugin = () => {
const { t } = useI18n()
const delPlugin = async ({ name }: CreatedPlugin) => {
try {
await EmqxMessageBox({ title: t('common.operateConfirm'), message: t('common.confirmDelete'), type: 'warning' })
await EmqxMessageBox({
title: t('common.operateConfirm'),
message: t('common.confirmDelete'),
type: 'warning',
confirmButtonText: t('common.confirmButtonText'),
})
await deletePlugin(name)
EmqxMessage.success(t('common.operateSuccessfully'))
return Promise.resolve()
Expand Down
5 changes: 4 additions & 1 deletion src/composables/config/useSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export const useSubscriptionList = () => {

const unsubscribe = async (confirmText: string, data: SubscriptionData | Array<SubscriptionData>) => {
try {
await EmqxMessageBox.confirm(confirmText, t('common.operateConfirm'))
await EmqxMessageBox.confirm(confirmText, t('common.operateConfirm'), {
confirmButtonText: t('common.confirmButtonText'),
cancelButtonText: t('common.cancelButtonText'),
})
if (Array.isArray(data)) {
const requestList = data.map((groupItem: SubscriptionData) => deleteSubscription(groupItem))
await Promise.all(requestList)
Expand Down
16 changes: 13 additions & 3 deletions src/composables/config/useTagList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,19 @@ export default () => {
}

const delTag = async (item: TagDataInTable) => {
await EmqxMessageBox.confirm(t('common.confirmDelete'), t('common.operateConfirm'))
await EmqxMessageBox.confirm(t('common.confirmDelete'), t('common.operateConfirm'), {
confirmButtonText: t('common.confirmButtonText'),
cancelButtonText: t('common.cancelButtonText'),
})
const delList = OmitArrayFields([item], ['checked'])
deleteTagList(delList)
}

const batchDeleteTag = async () => {
await EmqxMessageBox.confirm(t('common.confirmDelete'), t('common.operateConfirm'))
await EmqxMessageBox.confirm(t('common.confirmDelete'), t('common.operateConfirm'), {
confirmButtonText: t('common.confirmButtonText'),
cancelButtonText: t('common.cancelButtonText'),
})
deleteTagList(tagCheckedList.value)
}

Expand All @@ -121,7 +127,11 @@ export default () => {
}

const clearTag = async () => {
await EmqxMessageBox({ title: t('common.operateConfirm'), message: t('common.confirmClear') })
await EmqxMessageBox({
title: t('common.operateConfirm'),
message: t('common.confirmClear'),
confirmButtonText: t('common.confirmButtonText'),
})
deleteTagList(totalData.value)
}

Expand Down
8 changes: 8 additions & 0 deletions src/i18n/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ export default {
zh: '确认',
en: 'Confirm',
},
confirmButtonText: {
zh: '确认',
en: 'OK',
},
cancelButtonText: {
zh: '取消',
en: 'Cancel',
},
back: {
zh: '返回',
en: 'Back',
Expand Down
2 changes: 1 addition & 1 deletion src/views/admin/Log.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<emqx-button type="primary" @click="getLogs">{{ $t('common.submit') }}</emqx-button>
</div>
<div class="table-container">
<emqx-table :data="tableData">
<emqx-table :data="tableData" :empty-text="$t('common.emptyData')">
<emqx-table-column :label="$t('admin.log')">
<template #default="{ row }">
{{ row }}
Expand Down
2 changes: 1 addition & 1 deletion src/views/config/northDriver/Group.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>
</div>
</div>
<emqx-table :data="subscriptionList">
<emqx-table :data="subscriptionList" :empty-text="$t('common.emptyData')">
<emqx-table-column :width="28">
<template #header>
<emqx-checkbox v-model="allChecked" />
Expand Down
2 changes: 1 addition & 1 deletion src/views/config/southDriver/Group.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</div>
</div>

<emqx-table :data="groupList">
<emqx-table :data="groupList" :empty-text="$t('common.emptyData')">
<emqx-table-column :width="28">
<template #header>
<emqx-checkbox v-model="allChecked" />
Expand Down
2 changes: 1 addition & 1 deletion src/views/config/southDriver/Tag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</div>

<div class="table-container">
<emqx-table :data="tagList">
<emqx-table :data="tagList" :empty-text="$t('common.emptyData')">
<emqx-table-column :width="28">
<template #header>
<emqx-checkbox v-model="allChecked" />
Expand Down