Skip to content

Commit

Permalink
refactor(components): add common text
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinplemelon committed Nov 28, 2024
1 parent 28dce4f commit 14206d6
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 10 deletions.
1 change: 0 additions & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"dev": "vite",
"build": "vue-tsc && vite build",
"preview": "vite preview",
"test": "vitest run --coverage",
"version:patch": "npm version patch",
"version:minor": "npm version minor",
"version:major": "npm version major",
Expand Down
1 change: 0 additions & 1 deletion packages/components/streaming/StreamForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<el-form-item prop="stream_name">
<template #label>
{{ t('streaming.streamName') }}
{{ t('Base.username') }}
<component v-if="tipComponent" :is="tipComponent" :content="t('streaming.streamNameTip')" />
</template>
<el-input v-model="record.stream_name" />
Expand Down
18 changes: 14 additions & 4 deletions packages/components/streaming/StreamingACLForm.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<el-form :model="record" label-position="top">
<el-form-item prop="principal_name" :label="$t('auth.username')">
<el-form-item prop="principal_name" :label="t('common.username')">
<el-input v-model="record.principal_name" />
</el-form-item>
<el-form-item prop="host" :label="tl('host')">
Expand All @@ -15,7 +15,12 @@
</el-form-item>
<el-form-item prop="resource_type" :label="tl('aclResourceType')">
<el-radio-group v-model="record.resource_type" @change="changeResourceType">
<el-radio v-for="item in resourceTypeOptions" :key="item.value" :value="item.value">
<el-radio
v-for="item in resourceTypeOptions"
:key="item.value"
:value="item.value"
:label="item.value"
>
{{ item.label }}
</el-radio>
</el-radio-group>
Expand Down Expand Up @@ -46,9 +51,14 @@
/>
</el-select>
</el-form-item>
<el-form-item prop="permission" :label="$t('acl.access')">
<el-form-item prop="permission" :label="t('common.access')">
<el-radio-group v-model="record.permission">
<el-radio v-for="item in permissionOptions" :key="item.value" :value="item.value">
<el-radio
v-for="item in permissionOptions"
:key="item.value"
:value="item.value"
:label="item.value"
>
{{ item.label }}
</el-radio>
</el-radio-group>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/streaming/StreamingAuthForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<el-option v-for="item in authTypeList" :key="item" :label="item" :value="item" />
</el-select>
</el-form-item>
<el-form-item prop="user_name" :label="t('auth.username')">
<el-form-item prop="user_name" :label="t('common.username')">
<el-input v-model="record.user_name" clearable :disabled="isEdit" />
</el-form-item>
<el-form-item prop="password" :label="t('common.password')">
Expand Down
1 change: 0 additions & 1 deletion packages/constants/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"test": "vitest run --coverage",
"version:patch": "npm version patch",
"version:minor": "npm version minor",
"version:major": "npm version major",
Expand Down
6 changes: 6 additions & 0 deletions packages/i18n/lib/enCommon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const enCommon = {
access: 'Permission',
topic: 'Topic',
username: 'Username',
password: 'Password',
}
3 changes: 3 additions & 0 deletions packages/i18n/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ export * from './enIntegrationDesc'
export * from './enStreaming'
export * from './zhStreaming'
export * from './jaStreaming'
export * from './enCommon'
export * from './zhCommon'
export * from './jaCommon'
6 changes: 6 additions & 0 deletions packages/i18n/lib/jaCommon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const jaCommon = {
access: '許可/拒否',
topic: 'トピック',
username: 'ユーザー名',
password: 'パスワード',
}
6 changes: 6 additions & 0 deletions packages/i18n/lib/zhCommon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const zhCommon = {
access: '是否允许',
topic: '主题',
username: '用户名',
password: '密码',
}
12 changes: 11 additions & 1 deletion packages/utils/lib/useLocale.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { jaStreaming, enStreaming, zhStreaming } from '@emqx/shared-ui-i18n'
import {
jaStreaming,
enStreaming,
zhStreaming,
enCommon,
zhCommon,
jaCommon,
} from '@emqx/shared-ui-i18n'
import { createI18n } from 'vue-i18n'
import type { ComposerTranslation } from 'vue-i18n'

Expand All @@ -9,12 +16,15 @@ export const useLocale = (locale: string): { t: ComposerTranslation } => {
messages: {
en: {
streaming: enStreaming,
common: enCommon,
},
zh: {
streaming: zhStreaming,
common: zhCommon,
},
ja: {
streaming: jaStreaming,
common: jaCommon,
},
},
}).global
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/lib/useStreamingAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const useStreamingAuth = (lang: string) => {
]
const resourceTypeOptions = [
{
label: t('acl.topic'),
label: t('common.topic'),
value: StreamResourceType.Topic,
},
{
Expand Down

0 comments on commit 14206d6

Please sign in to comment.