Skip to content

Commit

Permalink
perf: 框架核心代码国际化全量覆盖(仅需处理业务代码国际化即可) (#1082)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxian521 authored Apr 17, 2024
1 parent d1d2bca commit a402d33
Show file tree
Hide file tree
Showing 28 changed files with 254 additions and 99 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
- 修复`windwos`下点击注册页面会出现滚动条问题
- 修复`windows`下页面切换,内容区会出现滚动条问题
- 修复`pure-table`带状态表格在深色整体风格下状态样式消失的问题
- 修复项目配置中开启灰色模式和深色整体风格,刷新页面整体风格异常
- 修复系统配置中开启灰色模式和深色整体风格,刷新页面整体风格异常

### 🍏 Perf

Expand Down Expand Up @@ -84,7 +84,7 @@
- 所有`search`搜索图标统一替换为`@iconify-icons/ri/search-line`它比较常用将其放入全局离线图标中
- 移除`iframe`在暗模式下的滤镜效果
- 带来更美观精致的首页
- 更干净整洁的项目配置右侧弹出面板
- 更干净整洁的系统配置右侧弹出面板
- 重构关于页面,整体更紧致,关键信息更突出

### 🎫 Feat
Expand Down
52 changes: 51 additions & 1 deletion locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buttons:
pureAccountSettings: Account
pureLoginOut: LoginOut
pureLogin: Login
pureSystemSet: Open ProjectConfig
pureOpenSystemSet: Open System Configs
pureReload: Reload
pureCloseCurrentTab: Close CurrentTab
pureCloseLeftTabs: Close LeftTabs
Expand All @@ -11,6 +11,54 @@ buttons:
pureCloseAllTabs: Close AllTabs
pureContentFullScreen: Content FullScreen
pureContentExitFullScreen: Content ExitFullScreen
pureClickCollapse: Collapse
pureClickExpand: Expand
pureConfirm: Confirm
pureSwitch: Switch
pureClose: Close
pureBackTop: BackTop
pureOpenText: Open
pureCloseText: Close
search:
pureTotal: Total
pureHistory: History
pureCollect: Collect
pureDragSort: (Drag Sort)
pureEmpty: Empty
purePlaceholder: Search Menu
panel:
pureSystemSet: System Configs
pureCloseSystemSet: Close System Configs
pureClearCacheAndToLogin: Clear cache and return to login page
pureClearCache: Clear Cache
pureOverallStyle: Overall Style
pureOverallStyleLight: Light
pureOverallStyleLightTip: Set sail freshly and light up the comfortable work interface
pureOverallStyleDark: Dark
pureOverallStyleDarkTip: Moonlight Overture, indulge in the tranquility and elegance of the night
pureOverallStyleSystem: Auto
pureOverallStyleSystemTip: Synchronize time, the interface naturally responds to morning and dusk
pureThemeColor: Theme Color
pureLayoutModel: Layout Model
pureVerticalTip: The menu on the left is familiar and friendly
pureHorizontalTip: Top menu, concise overview
pureMixTip: Mixed menu, flexible
pureStretch: Stretch Page
pureStretchFixed: Fixed
pureStretchFixedTip: Compact pages make it easy to find the information you need
pureStretchCustom: Custom
pureStretchCustomTip: Minimum 1280, maximum 1600
pureTagsStyle: Tags Style
pureTagsStyleSmart: Smart
pureTagsStyleSmartTip: Smart tags add fun and brilliance
pureTagsStyleCard: Card
pureTagsStyleCardTip: Card tags for efficient browsing
pureInterfaceDisplay: Interface Display
pureGreyModel: Grey Model
pureWeakModel: Weak Model
pureHiddenTags: Hidden Tags
pureHiddenFooter: Hidden Footer
pureMultiTagsCache: MultiTags Cache
menus:
pureHome: Home
pureLogin: Login
Expand Down Expand Up @@ -136,6 +184,7 @@ menus:
pureChildMenuOverflow: Child Menu Overflow Show Tooltip Text
status:
pureLoad: Loading...
pureNoMessage: No Message
login:
pureUsername: Username
purePassword: Password
Expand All @@ -160,6 +209,7 @@ login:
pureTip: After scanning the code, click "Confirm" to complete the login
pureDefinite: Definite
pureLoginSuccess: Login Success
pureLoginFail: Login Fail
pureRegisterSuccess: Regist Success
pureTickPrivacy: Please tick Privacy Policy
pureReadAccept: I have read it carefully and accept
Expand Down
54 changes: 52 additions & 2 deletions locales/zh-CN.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buttons:
pureAccountSettings: 账户设置
pureLoginOut: 退出系统
pureLogin: 登录
pureSystemSet: 打开项目配置
pureOpenSystemSet: 打开系统配置
pureReload: 重新加载
pureCloseCurrentTab: 关闭当前标签页
pureCloseLeftTabs: 关闭左侧标签页
Expand All @@ -11,6 +11,54 @@ buttons:
pureCloseAllTabs: 关闭全部标签页
pureContentFullScreen: 内容区全屏
pureContentExitFullScreen: 内容区退出全屏
pureClickCollapse: 点击折叠
pureClickExpand: 点击展开
pureConfirm: 确认
pureSwitch: 切换
pureClose: 关闭
pureBackTop: 回到顶部
pureOpenText:
pureCloseText:
search:
pureTotal:
pureHistory: 搜索历史
pureCollect: 收藏
pureDragSort: (可拖拽排序)
pureEmpty: 暂无搜索结果
purePlaceholder: 搜索菜单(支持拼音搜索)
panel:
pureSystemSet: 系统配置
pureCloseSystemSet: 关闭配置
pureClearCacheAndToLogin: 清空缓存并返回登录页
pureClearCache: 清空缓存
pureOverallStyle: 整体风格
pureOverallStyleLight: 浅色
pureOverallStyleLightTip: 清新启航,点亮舒适的工作界面
pureOverallStyleDark: 深色
pureOverallStyleDarkTip: 月光序曲,沉醉于夜的静谧雅致
pureOverallStyleSystem: 自动
pureOverallStyleSystemTip: 同步时光,界面随晨昏自然呼应
pureThemeColor: 主题色
pureLayoutModel: 导航模式
pureVerticalTip: 左侧菜单,亲切熟悉
pureHorizontalTip: 顶部菜单,简洁概览
pureMixTip: 混合菜单,灵活多变
pureStretch: 页宽
pureStretchFixed: 固定
pureStretchFixedTip: 紧凑页面,轻松找到所需信息
pureStretchCustom: 自定义
pureStretchCustomTip: 最小1280、最大1600
pureTagsStyle: 页签风格
pureTagsStyleSmart: 灵动
pureTagsStyleSmartTip: 灵动标签,添趣生辉
pureTagsStyleCard: 卡片
pureTagsStyleCardTip: 卡片标签,高效浏览
pureInterfaceDisplay: 界面显示
pureGreyModel: 灰色模式
pureWeakModel: 色弱模式
pureHiddenTags: 隐藏标签页
pureHiddenFooter: 隐藏页脚
pureMultiTagsCache: 页签持久化
menus:
pureHome: 首页
pureLogin: 登录
Expand Down Expand Up @@ -136,6 +184,7 @@ menus:
pureChildMenuOverflow: 菜单超出显示 Tooltip 文字提示
status:
pureLoad: 加载中...
pureNoMessage: 暂无消息
login:
pureUsername: 账号
purePassword: 密码
Expand All @@ -160,6 +209,7 @@ login:
pureTip: 扫码后点击"确认",即可完成登录
pureDefinite: 确定
pureLoginSuccess: 登录成功
pureLoginFail: 登录失败
pureRegisterSuccess: 注册成功
pureTickPrivacy: 请勾选隐私政策
pureReadAccept: 我已仔细阅读并接受
Expand All @@ -176,4 +226,4 @@ login:
purePassWordRuleReg: 密码格式应为8-18位数字、字母、符号的任意两种组合
purePassWordSureReg: 请输入确认密码
purePassWordDifferentReg: 两次密码不一致!
purePassWordUpdateReg: 修改密码成功
purePassWordUpdateReg: 修改密码成功
2 changes: 1 addition & 1 deletion src/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type UserResult = {
data: {
/** 用户名 */
username: string;
/** 当前登陆用户的角色 */
/** 当前登录用户的角色 */
roles: Array<string>;
/** `token` */
accessToken: string;
Expand Down
7 changes: 6 additions & 1 deletion src/components/ReSegmented/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ const props = {
disabled: {
type: Boolean,
default: false
},
/** 当内容发生变化时,设置 `resize` 可使其自适应容器位置 */
resize: {
type: Boolean,
default: false
}
};

Expand Down Expand Up @@ -108,7 +113,7 @@ export default defineComponent({
});
}

props.block && handleResizeInit();
(props.block || props.resize) && handleResizeInit();

watch(
() => curIndex.value,
Expand Down
2 changes: 1 addition & 1 deletion src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const getPlatformConfig = async (app: App): Promise<undefined> => {
})
.then(({ data: config }) => {
let $config = app.config.globalProperties.$config;
// 自动注入项目配置
// 自动注入系统配置
if (app && $config && typeof config === "object") {
$config = Object.assign($config, config);
app.config.globalProperties.$config = $config;
Expand Down
4 changes: 3 additions & 1 deletion src/layout/components/appMain.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from "vue-i18n";
import Footer from "./footer/index.vue";
import { useGlobal, isNumber } from "@pureadmin/utils";
import KeepAliveFrame from "./keepAliveFrame/index.vue";
Expand All @@ -10,6 +11,7 @@ const props = defineProps({
fixedHeader: Boolean
});
const { t } = useI18n();
const { $storage, $config } = useGlobal<GlobalPropertiesApi>();
const isKeepAlive = computed(() => {
Expand Down Expand Up @@ -121,7 +123,7 @@ const transitionMain = defineComponent({
}"
>
<el-backtop
title="回到顶部"
:title="t('buttons.pureBackTop')"
target=".app-main .el-scrollbar__wrap"
>
<backTop />
Expand Down
2 changes: 1 addition & 1 deletion src/layout/components/navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
</el-dropdown>
<span
class="set-icon navbar-bg-hover"
:title="t('buttons.pureSystemSet')"
:title="t('buttons.pureOpenSystemSet')"
@click="onPanel"
>
<IconifyIconOffline :icon="Setting" />
Expand Down
4 changes: 3 additions & 1 deletion src/layout/components/notice/index.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<script setup lang="ts">
import { ref } from "vue";
import { useI18n } from "vue-i18n";
import { noticesData } from "./data";
import NoticeList from "./noticeList.vue";
import Bell from "@iconify-icons/ep/bell";
const { t } = useI18n();
const noticesNum = ref(0);
const notices = ref(noticesData);
const activeKey = ref(noticesData[0].key);
Expand All @@ -30,7 +32,7 @@ notices.value.map(v => (noticesNum.value += v.list.length));
>
<el-empty
v-if="notices.length === 0"
description="暂无消息"
:description="t('status.pureNoMessage')"
:image-size="60"
/>
<span v-else>
Expand Down
5 changes: 4 additions & 1 deletion src/layout/components/notice/noticeList.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { PropType } from "vue";
import { ListItem } from "./data";
import { useI18n } from "vue-i18n";
import NoticeItem from "./noticeItem.vue";
const props = defineProps({
Expand All @@ -9,6 +10,8 @@ const props = defineProps({
default: () => []
}
});
const { t } = useI18n();
</script>

<template>
Expand All @@ -19,5 +22,5 @@ const props = defineProps({
:noticeItem="item"
/>
</div>
<el-empty v-else description="暂无消息" />
<el-empty v-else :description="t('status.pureNoMessage')" />
</template>
12 changes: 8 additions & 4 deletions src/layout/components/panel/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from "vue-i18n";
import { emitter } from "@/utils/mitt";
import { onClickOutside } from "@vueuse/core";
import { ref, computed, onMounted, onBeforeUnmount } from "vue";
Expand All @@ -25,6 +26,7 @@ const iconClass = computed(() => {
];
});
const { t } = useI18n();
const { onReset } = useDataThemeChange();
onClickOutside(target, (event: any) => {
Expand All @@ -51,10 +53,12 @@ onBeforeUnmount(() => {
<div
class="project-configuration border-b-[1px] border-solid border-[var(--pure-border-color)]"
>
<h4 class="dark:text-white">项目配置</h4>
<h4 class="dark:text-white">
{{ t("panel.pureSystemSet") }}
</h4>
<span
v-tippy="{
content: '关闭配置',
content: t('panel.pureCloseSystemSet'),
placement: 'bottom-start',
zIndex: 41000
}"
Expand All @@ -78,7 +82,7 @@ onBeforeUnmount(() => {
>
<el-button
v-tippy="{
content: '清空缓存并返回登录页',
content: t('panel.pureClearCacheAndToLogin'),
placement: 'left-start',
zIndex: 41000
}"
Expand All @@ -87,7 +91,7 @@ onBeforeUnmount(() => {
bg
@click="onReset"
>
清空缓存
{{ t("panel.pureClearCache") }}
</el-button>
</div>
</div>
Expand Down
10 changes: 6 additions & 4 deletions src/layout/components/search/components/SearchFooter.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useI18n } from "vue-i18n";
import { useNav } from "@/layout/hooks/useNav";
import mdiKeyboardEsc from "@/assets/svg/keyboard_esc.svg?component";
import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
Expand All @@ -9,29 +10,30 @@ const props = withDefaults(defineProps<{ total: number }>(), {
total: 0
});
const { t } = useI18n();
const { device } = useNav();
</script>

<template>
<div class="search-footer text-[#333] dark:text-white">
<span class="search-footer-item">
<enterOutlined class="icon" />
确认
{{ t("buttons.pureConfirm") }}
</span>
<span class="search-footer-item">
<IconifyIconOffline :icon="ArrowUpLine" class="icon" />
<IconifyIconOffline :icon="ArrowDownLine" class="icon" />
切换
{{ t("buttons.pureSwitch") }}
</span>
<span class="search-footer-item">
<mdiKeyboardEsc class="icon" />
关闭
{{ t("buttons.pureClose") }}
</span>
<p
v-if="device !== 'mobile' && props.total > 0"
class="search-footer-total"
>
{{ props.total }}
{{ `${t("search.pureTotal")} ${props.total}` }}
</p>
</div>
</template>
Expand Down
Loading

0 comments on commit a402d33

Please sign in to comment.