Skip to content

Commit

Permalink
feat(projects): globalSearch add i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
yanbowe committed Mar 6, 2024
1 parent 04aa10b commit 0126da4
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
<script lang="ts" setup>
import { $t } from '@/locales';
defineOptions({ name: 'SearchFooter' });
</script>

<template>
<div class="h-44px flex-y-center px-24px">
<span class="mr-14px flex-y-center">
<icon-mdi-keyboard-return class="icon mr-6px p-2px text-20px" />
<span>确认</span>
<span>{{ $t('common.confirm') }}</span>
</span>
<span class="mr-14px flex-y-center">
<icon-mdi-arrow-up-thin class="icon mr-5px p-2px text-20px" />
<icon-mdi-arrow-down-thin class="icon mr-6px p-2px text-20px" />
<span>切换</span>
<span>{{ $t('common.switch') }}</span>
</span>
<span class="flex-y-center">
<icon-mdi-keyboard-esc class="icon mr-6px p-2px text-20px" />
<span>关闭</span>
<span>{{ $t('common.close') }}</span>
</span>
</div>
</template>
Expand Down
6 changes: 3 additions & 3 deletions src/layouts/modules/global-search/components/search-modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ onKeyStroke('ArrowDown', handleDown);
@after-leave="handleClose"
>
<NInputGroup>
<NInput v-model:value="keyword" clearable placeholder="请输入关键词搜索" @input="handleSearch">
<NInput v-model:value="keyword" clearable :placeholder="$t('common.keywordSearch')" @input="handleSearch">
<template #prefix>
<icon-uil-search class="text-15px text-#c2c2c2" />
</template>
</NInput>
<NButton v-if="isMobile" type="primary" ghost @click="handleClose">取消</NButton>
<NButton v-if="isMobile" type="primary" ghost @click="handleClose">{{ $t('common.cancel') }}</NButton>
</NInputGroup>

<div class="mt-20px">
<NEmpty v-if="resultOptions.length === 0" description="暂无搜索结果" />
<NEmpty v-if="resultOptions.length === 0" :description="$t('common.noData')" />
<SearchResult v-else v-model:path="activePath" :options="resultOptions" @enter="handleEnter" />
</div>
<template #footer>
Expand Down
3 changes: 2 additions & 1 deletion src/layouts/modules/global-search/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import { useBoolean } from '@sa/hooks';
import { $t } from '@/locales';
import SearchModal from './components/search-modal.vue';
defineOptions({ name: 'GlobalSearch' });
Expand All @@ -11,7 +12,7 @@ function handleSearch() {
</script>

<template>
<ButtonIcon tooltip-content="搜索" @click="handleSearch">
<ButtonIcon :tooltip-content="$t('common.search')" @click="handleSearch">
<icon-uil-search class="text-20px" />
</ButtonIcon>
<SearchModal v-model:show="show" />
Expand Down
4 changes: 4 additions & 0 deletions src/locales/langs/en-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const local: App.I18n.Schema = {
backToHome: 'Back to home',
batchDelete: 'Batch Delete',
cancel: 'Cancel',
close: 'Close',
check: 'Check',
columnSetting: 'Column Setting',
confirm: 'Confirm',
Expand All @@ -17,16 +18,19 @@ const local: App.I18n.Schema = {
confirmDelete: 'Are you sure you want to delete?',
edit: 'Edit',
index: 'Index',
keywordSearch: 'Please enter keyword',
logout: 'Logout',
logoutConfirm: 'Are you sure you want to log out?',
lookForward: 'Coming soon',
modify: 'Modify',
modifySuccess: 'Modify Success',
noData: 'No Data',
operate: 'Operate',
pleaseCheckValue: 'Please check whether the value is valid',
refresh: 'Refresh',
reset: 'Reset',
search: 'Search',
switch: 'Switch',
tip: 'Tip',
update: 'Update',
updateSuccess: 'Update Success',
Expand Down
4 changes: 4 additions & 0 deletions src/locales/langs/zh-cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const local: App.I18n.Schema = {
backToHome: '返回首页',
batchDelete: '批量删除',
cancel: '取消',
close: '关闭',
check: '勾选',
columnSetting: '列设置',
confirm: '确认',
Expand All @@ -17,16 +18,19 @@ const local: App.I18n.Schema = {
confirmDelete: '确认删除吗?',
edit: '编辑',
index: '序号',
keywordSearch: '请输入关键词搜索',
logout: '退出登录',
logoutConfirm: '确认退出登录吗?',
lookForward: '敬请期待',
modify: '修改',
modifySuccess: '修改成功',
noData: '无数据',
operate: '操作',
pleaseCheckValue: '请检查输入的值是否合法',
refresh: '刷新',
reset: '重置',
search: '搜索',
switch: '切换',
tip: '提示',
update: '更新',
updateSuccess: '更新成功',
Expand Down
4 changes: 4 additions & 0 deletions src/typings/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ declare namespace App {
backToHome: string;
batchDelete: string;
cancel: string;
close: string;
check: string;
columnSetting: string;
confirm: string;
Expand All @@ -263,16 +264,19 @@ declare namespace App {
confirmDelete: string;
edit: string;
index: string;
keywordSearch: string;
logout: string;
logoutConfirm: string;
lookForward: string;
modify: string;
modifySuccess: string;
noData: string;
operate: string;
pleaseCheckValue: string;
refresh: string;
reset: string;
search: string;
switch: string;
tip: string;
update: string;
updateSuccess: string;
Expand Down

0 comments on commit 0126da4

Please sign in to comment.