Skip to content

Commit

Permalink
perf: 📝 翻译设备列表
Browse files Browse the repository at this point in the history
  • Loading branch information
viarotel committed Oct 24, 2023
1 parent 249fc05 commit aeae0c6
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
"dist-release/win-arm64-unpacked/locales",
"dist-release/win-unpacked/locales"
],
"i18n-ally.sourceLanguage": "en"
"i18n-ally.sourceLanguage": "zh"
}
6 changes: 3 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ export default {
return {
tabsModel: [
{
label: this.$t('devices'),
label: this.$t('devices.name'),
prop: 'Device',
},
{
label: this.$t('preferences'),
label: this.$t('preferences.name'),
prop: 'Preference',
},
{
label: this.$t('about'),
label: this.$t('about.name'),
prop: 'About',
},
],
Expand Down
16 changes: 8 additions & 8 deletions src/components/Device/ControlBar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,46 +36,46 @@ export default {
return {
controlModel: [
{
label: '切换键',
label: this.$t('devices.operates.switch'),
elIcon: 'Switch',
command: 'input keyevent KEYCODE_APP_SWITCH',
},
{
label: '主屏幕键',
label: this.$t('devices.operates.home'),
elIcon: 'HomeFilled',
command: 'input keyevent KEYCODE_HOME',
},
{
label: '返回键',
label: this.$t('devices.operates.return'),
elIcon: 'Back',
command: 'input keyevent KEYCODE_BACK',
},
{
label: '通知栏',
label: this.$t('devices.operates.notification'),
elIcon: 'Notification',
command: 'cmd statusbar expand-notifications',
tips: '打开下拉菜单选项',
},
{
label: '电源键',
label: this.$t('devices.operates.power'),
elIcon: 'SwitchButton',
command: 'input keyevent KEYCODE_POWER',
tips: '可以用来开启或关闭屏幕',
},
{
label: '重启设备',
label: this.$t('devices.operates.reboot'),
elIcon: 'RefreshLeft',
command: 'reboot',
tips: '可以用来开启或关闭屏幕',
},
{
label: '截取屏幕',
label: this.$t('devices.operates.capture'),
elIcon: 'Crop',
handle: this.handleScreenCap,
tips: '',
},
{
label: '安装应用',
label: this.$t('devices.operates.install'),
svgIcon: 'install',
handle: this.handleInstall,
tips: '',
Expand Down
4 changes: 3 additions & 1 deletion src/components/Device/Remark/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
<el-icon>
<EditPen />
</el-icon>
<span class="pl-1">{{ device.$remark || "备注" }}</span>
<span class="pl-1">{{
device.$remark || $t("devices.device.remark")
}}</span>
</div>
</el-tag>
</template>
Expand Down
72 changes: 47 additions & 25 deletions src/components/Device/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
clearable
>
<template #prepend>
无线连接
{{ $t("devices.wireless.name") }}
</template>
</el-input>
<div class="text-gray-500 text-sm">
Expand All @@ -30,18 +30,18 @@
:loading="connectLoading"
@click="handleConnect"
>
连接设备
{{ $t("devices.wireless.connect") }}
</el-button>
<el-button
type="primary"
:icon="loading ? '' : 'Refresh'"
:loading="loading"
@click="handleRefresh"
>
刷新设备
{{ $t("devices.refresh") }}
</el-button>
<el-button type="warning" icon="RefreshRight" @click="handleRestart">
重启服务
{{ $t("devices.restart") }}
</el-button>
</div>
<div class="pt-4 flex-1 h-0 overflow-hidden">
Expand All @@ -56,16 +56,20 @@
row-key="id"
>
<template #empty>
<el-empty description="设备列表为空" />
<el-empty :description="$t('devices.empty')" />
</template>
<el-table-column
prop="id"
label="设备 ID"
:label="$t('devices.device.id')"
show-overflow-tooltip
align="left"
width="200"
/>
<el-table-column label="设备名称" show-overflow-tooltip align="left">
<el-table-column
:label="$t('devices.device.name')"
show-overflow-tooltip
align="left"
>
<template #default="{ row }">
<div class="flex items-center">
<el-tooltip
Expand All @@ -90,7 +94,11 @@
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="400" align="left">
<el-table-column
:label="$t('devices.operates.name')"
width="400"
align="left"
>
<template #default="{ row }">
<el-button
type="primary"
Expand All @@ -100,7 +108,11 @@
:icon="row.$loading ? '' : 'Monitor'"
@click="handleMirror(row)"
>
{{ row.$loading ? "正在镜像" : "开始镜像" }}
{{
row.$loading
? $t("devices.operates.mirroring")
: $t("devices.operates.mirror")
}}
</el-button>

<el-button
Expand All @@ -111,7 +123,11 @@
:icon="row.$recordLoading ? '' : 'VideoCamera'"
@click="handleRecord(row)"
>
{{ row.$recordLoading ? "正在录制" : "开始录制" }}
{{
row.$recordLoading
? $t("devices.operates.recording")
: $t("devices.operates.record")
}}
</el-button>

<el-button
Expand All @@ -126,7 +142,7 @@
<template #icon>
<svg-icon name="wifi"></svg-icon>
</template>
无线模式
{{ $t("devices.operates.wireless") }}
</el-button>

<el-button
Expand All @@ -138,13 +154,17 @@
:icon="row.$stopLoading ? '' : 'CircleClose'"
@click="handleStop(row)"
>
{{ row.$stopLoading ? "正在断开" : "断开连接" }}
{{
row.$stopLoading
? $t("devices.operates.disconnecting")
: $t("devices.operates.disconnect")
}}
</el-button>
</template>
</el-table-column>
<el-table-column type="expand">
<template #header>
<el-icon class="" title="设备交互">
<el-icon class="" :title="$t('devices.operates.more')">
<Operation class="" />
</el-icon>
</template>
Expand Down Expand Up @@ -177,7 +197,7 @@ export default {
const adbCache = storage.get('adbCache') || {}
return {
loading: false,
loadingText: '努力加载中...',
loadingText: this.$t('devices.loading'),
connectLoading: false,
deviceList: [],
formData: {
Expand Down Expand Up @@ -367,20 +387,22 @@ export default {
try {
await this.$confirm(
`
<div class="pb-4 text-sm text-red-500">错误详情:${message}</div>
<div>可能有以下原因:</div>
<div>1. IP地址或端口号错误</div>
<div>2. 设备未与当前电脑配对成功</div>
<div>3. 电脑网络和提供的设备网络IP不在同一个局域网中</div>
<div>4. adb 依赖路径错误</div>
<div>5. 其他未知错误</div>
<div class="pb-4 text-sm text-red-500">${this.$t(
'devices.wireless.error.detail',
)}${message}</div>
<div>${this.$t('devices.wireless.error.reasons[0]')}:</div>
<div>1. ${this.$t('devices.wireless.error.reasons[1]')} </div>
<div>2. ${this.$t('devices.wireless.error.reasons[2]')} </div>
<div>3. ${this.$t('devices.wireless.error.reasons[3]')} </div>
<div>4. ${this.$t('devices.wireless.error.reasons[4]')} </div>
<div>5. ${this.$t('devices.wireless.error.reasons[5]')} </div>
`,
'连接设备失败',
this.$t('devices.wireless.error.title'),
{
dangerouslyUseHTMLString: true,
closeOnClickModal: false,
confirmButtonText: '无线配对',
cancelButtonText: '取消',
confirmButtonText: this.$t('devices.wireless.error.confirm'),
cancelButtonText: this.$t('devices.wireless.error.cancel'),
type: 'warning',
},
)
Expand Down Expand Up @@ -432,7 +454,7 @@ export default {
}
}
this.loading = false
this.loadingText = '正在获取设备列表...'
this.loadingText = ''
},
},
}
Expand Down
Loading

0 comments on commit aeae0c6

Please sign in to comment.