Commit 962f90de445d7935ad76ea7b74a98f12ce9a7498

Authored by vben
1 parent 41a4b827

feat: support vscode i18n-ally plugin

Showing 39 changed files with 263 additions and 259 deletions
.vscode/extensions.json
... ... @@ -5,8 +5,8 @@
5 5 "stylelint.vscode-stylelint",
6 6 "DavidAnson.vscode-markdownlint",
7 7 "esbenp.prettier-vscode",
8   - "mrmlnc.vscode-scss",
9 8 "mrmlnc.vscode-less",
  9 + "antfu.i18n-ally",
10 10 "cpylua.language-postcss",
11 11 "Orta.vscode-jest",
12 12 "antfu.iconify",
... ...
.vscode/settings.json
... ... @@ -10,14 +10,13 @@
10 10 "editor.smoothScrolling": true,
11 11 "editor.cursorBlinking": "phase",
12 12 "editor.cursorSmoothCaretAnimation": true,
13   - "editor.detectIndentation": false, // vscode默认启用了根据文件类型自动设置tabsize的选项
  13 + "editor.detectIndentation": false,
14 14 "diffEditor.ignoreTrimWhitespace": false,
15   - "editor.formatOnPaste": true, //自动格式化粘贴的内容
16   - "editor.formatOnSave": true, //保存自动格式化
  15 + "editor.formatOnPaste": true,
  16 + "editor.formatOnSave": true,
17 17 "editor.suggestSelection": "first",
18 18 "editor.trimAutoWhitespace": true,
19 19 "editor.quickSuggestions": {
20   - // 快速提示
21 20 "other": true,
22 21 "comments": true,
23 22 "strings": true
... ... @@ -25,41 +24,33 @@
25 24 //===========================================
26 25 //============= Other =======================
27 26 //===========================================
28   - "breadcrumbs.enabled": true, // 启用/禁用导航路径
29   - "open-in-browser.default": "chrome", // 默认浏览器
  27 + "breadcrumbs.enabled": true,
  28 + "open-in-browser.default": "chrome",
30 29 //===========================================
31 30 //============= emmet =======================
32 31 //===========================================
33   - "emmet.triggerExpansionOnTab": true, // 配置emmet是否启用tab展开缩写
  32 + "emmet.triggerExpansionOnTab": true,
34 33 "emmet.showAbbreviationSuggestions": true,
35 34 "emmet.showExpandedAbbreviation": "always",
36 35 "emmet.syntaxProfiles": {
37   - // 配置emmet对文件类型的支持,比如vue后缀文件按照html文件来进行emmet扩写
38 36 "vue-html": "html",
39 37 "vue": "html",
40 38 "javascript": "javascriptreact",
41   - // xml类型文件默认都是单引号,开启对非单引号的emmet识别
42 39 "xml": {
43 40 "attr_quotes": "single"
44 41 }
45 42 },
46 43 "emmet.includeLanguages": {
47   - // 在react的jsx中添加对emmet的支持
48 44 "jsx-sublime-babel-tags": "javascriptreact"
49 45 },
50 46 //===========================================
51 47 //============= files =======================
52 48 //===========================================
53   - // "files.autoSave": "onWindowChange", // 窗口失去焦点自动保存
54   - // "files.autoSaveDelay": 1000, // 自动保存时间
55   - "files.trimTrailingWhitespace": true, // 启用后,将在保存文件时剪裁尾随空格。
56   - // 文件末尾插入新行
  49 + "files.trimTrailingWhitespace": true,
57 50 "files.insertFinalNewline": true,
58   - // 删除文件末尾多余的新行
59 51 "files.trimFinalNewlines": true,
60 52 "files.eol": "\n",
61 53 "search.exclude": {
62   - // 搜索排除这些区域
63 54 "**/node_modules": true,
64 55 "**/*.log": true,
65 56 "**/*.log*": true,
... ... @@ -76,8 +67,6 @@
76 67 "**/tmp": true
77 68 },
78 69 "files.exclude": {
79   - // 排除文件搜索区域,比如node_modules(默认设置已经屏蔽了)
80   - // "**/node_modules": true,
81 70 "**/bower_components": true,
82 71 "**/.idea": true,
83 72 "**/yarn.lock": true,
... ... @@ -100,7 +89,6 @@
100 89 "**/yarn.lock": true
101 90 },
102 91 "files.associations": {
103   - // 配置文件关联,以便启用对应的智能提示,比如wxss使用css
104 92 "*.vue": "vue",
105 93 "*.wxss": "css"
106 94 },
... ... @@ -109,13 +97,11 @@
109 97 "css.validate": true,
110 98 "less.validate": true,
111 99 "scss.validate": true,
112   - // ↓↓↓↓↓↓↓↓↓↓↓↓↓ 以下为插件设置 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
113   - // ↓↓↓↓↓↓↓↓↓↓↓↓↓ 需要安装对应的插件 ↓↓↓↓↓↓↓↓↓↓↓↓
114 100 // ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
115 101 // ===========================================
116 102 // ================ Eslint ===================
117 103 // ===========================================
118   - "eslint.enable": true, // 是否开启eslint
  104 + "eslint.enable": true,
119 105 "eslint.options": {
120 106 // 配置
121 107 "plugins": [
... ... @@ -126,53 +112,41 @@
126 112 "typescript"
127 113 ]
128 114 },
129   - "eslint.autoFixOnSave": true, // 保存自动格式化
  115 + "eslint.autoFixOnSave": true,
130 116 // ===========================================
131 117 // ================ Vetur ====================
132 118 // ===========================================
133 119 "vetur.experimental.templateInterpolationService": true,
134 120 "vetur.format.options.tabSize": 2,
135   - "vetur.format.defaultFormatter.html": "js-beautify-html", // 使用js-beautify-html格式化
136   - "vetur.format.defaultFormatter.scss": "prettier", // 使用js-beautify-html格式化
137   - "vetur.format.defaultFormatter.css": "prettier", // 使用js-beautify-html格式化
138   - // "vetur.format.defaultFormatter.html": "prettyhtml",
  121 + "vetur.format.defaultFormatter.html": "js-beautify-html",
  122 + "vetur.format.defaultFormatter.scss": "prettier",
  123 + "vetur.format.defaultFormatter.css": "prettier",
139 124 "vetur.format.defaultFormatter.ts": "prettier-tslint",
140 125 "vetur.format.defaultFormatter.js": "prettier",
141   - "vetur.languageFeatures.codeActions": false,
142   - // "vetur.useWorkspaceDependencies": true,
  126 + "vetur.languageFeatures.codeActions": false,
143 127 "vetur.format.defaultFormatterOptions": {
144 128 "js-beautify-html": {
145   - // "wrap_attributes": "force-aligned", // 单行
146   - "wrap_attributes": "force-expand-multiline" // 属性强制折行对齐 多行
  129 + "wrap_attributes": "force-expand-multiline"
147 130 },
148 131 "prettier": {
149   - "eslintIntegration": true, // 让perttier使用eslint的格式进行检查
150   - "arrowParens": "always", // 箭头函数参数括号 默认avoid 可选 avoid | always
151   - "semi": false, // 使用分号, 默认true
152   - "singleQuote": true // 使用单引号, 默认false(在jsx中配置无效, 默认都是双引号)
  132 + "eslintIntegration": true,
  133 + "arrowParens": "always",
  134 + "semi": false,
  135 + "singleQuote": true
153 136 }
154 137 },
155   - // 函数注释
156   - //===========================================
157   - //============= Code Runner =================
158   - //===========================================
159 138 "javascript.updateImportsOnFileMove.enabled": "never",
160 139 "liveServer.settings.donotShowInfoMsg": true,
161   - "[javascript]": {
162   - "editor.defaultFormatter": "esbenp.prettier-vscode"
163   - },
164   - "terminal.integrated.rendererType": "dom", //关闭liveserver提示
  140 + "terminal.integrated.rendererType": "dom",
165 141 "telemetry.enableCrashReporter": false,
166 142 "telemetry.enableTelemetry": false,
167 143 "workbench.settings.enableNaturalLanguageSearch": false,
168   - // 引用路径设置
169 144 "path-intellisense.mappings": {
170 145 "/@/": "${workspaceRoot}/src"
171 146 },
172 147 "prettier.requireConfig": true,
173 148 "typescript.updateImportsOnFileMove.enabled": "always",
174 149 "workbench.sideBar.location": "left",
175   -
176 150 "[javascriptreact]": {
177 151 "editor.defaultFormatter": "esbenp.prettier-vscode"
178 152 },
... ... @@ -203,8 +177,18 @@
203 177 "[markdown]": {
204 178 "editor.defaultFormatter": "esbenp.prettier-vscode"
205 179 },
206   -
207 180 "editor.codeActionsOnSave": {
208 181 "source.fixAll.eslint": true
209   - }
210   -}
  182 + },
  183 + "i18n-ally.localesPaths": [
  184 + "src/locales/lang",
  185 + ],
  186 + "i18n-ally.keystyle": "nested",
  187 + "i18n-ally.sortKeys": true,
  188 + "i18n-ally.namespace": true,
  189 + "i18n-ally.pathMatcher":"{locale}/{namespaces}.{ext}",
  190 + "i18n-ally.enabledParsers": [
  191 + "ts"
  192 + ],
  193 + "i18n-ally.sourceLanguage": "zh"
  194 +}
211 195 \ No newline at end of file
... ...
CHANGELOG.zh_CN.md
... ... @@ -3,6 +3,7 @@
3 3 ### ✨ Features
4 4  
5 5 - 还原 antdv 默认 loading,重构 `Loading` 组件,增加`useLoading`和`v-loading`指令。并增加示例
  6 +- i18n 支持 vscode `i18n-ally`插件
6 7  
7 8 ### 🎫 Chores
8 9  
... ...
src/components/Drawer/src/BasicDrawer.tsx
... ... @@ -29,7 +29,7 @@ export default defineComponent({
29 29 const visibleRef = ref(false);
30 30 const propsRef = ref<Partial<Nullable<DrawerProps>>>(null);
31 31  
32   - const { t } = useI18n('component.drawer');
  32 + const { t } = useI18n();
33 33  
34 34 const getMergeProps = computed(
35 35 (): DrawerProps => {
... ... @@ -228,7 +228,11 @@ export default defineComponent({
228 228 default: () => (
229 229 <>
230 230 <div ref={scrollRef} style={unref(getScrollContentStyle)}>
231   - <Loading absolute tip={t('loadingText')} loading={unref(getLoading)} />
  231 + <Loading
  232 + absolute
  233 + tip={t('component.drawer.loadingText')}
  234 + loading={unref(getLoading)}
  235 + />
232 236 {getSlot(slots)}
233 237 </div>
234 238 {renderFooter()}
... ...
src/components/Drawer/src/props.ts
... ... @@ -2,7 +2,7 @@ import type { PropType } from &#39;vue&#39;;
2 2  
3 3 import { useI18n } from '/@/hooks/web/useI18n';
4 4 import { propTypes } from '/@/utils/propTypes';
5   -const { t } = useI18n('component.drawer');
  5 +const { t } = useI18n();
6 6  
7 7 export const footerProps = {
8 8 confirmLoading: propTypes.bool,
... ... @@ -11,13 +11,13 @@ export const footerProps = {
11 11 */
12 12 showCancelBtn: propTypes.bool.def(true),
13 13 cancelButtonProps: Object as PropType<any>,
14   - cancelText: propTypes.string.def(t('cancelText')),
  14 + cancelText: propTypes.string.def(t('component.drawer.cancelText')),
15 15 /**
16 16 * @description: Show confirmation button
17 17 */
18 18 showOkBtn: propTypes.bool.def(true),
19 19 okButtonProps: propTypes.any,
20   - okText: propTypes.string.def(t('okText')),
  20 + okText: propTypes.string.def(t('component.drawer.okText')),
21 21 okType: propTypes.string.def('primary'),
22 22 showFooter: propTypes.bool,
23 23 footerHeight: {
... ...
src/components/Excel/src/ExportExcelModel.vue
1 1 <template>
2 2 <BasicModal
3 3 v-bind="$attrs"
4   - :title="t('exportModalTitle')"
  4 + :title="t('component.excel.exportModalTitle')"
5 5 @ok="handleOk"
6 6 @register="registerModal"
7 7 >
... ... @@ -21,19 +21,19 @@
21 21  
22 22 import { useI18n } from '/@/hooks/web/useI18n';
23 23  
24   - const { t } = useI18n('component.excel');
  24 + const { t } = useI18n();
25 25  
26 26 const schemas: FormSchema[] = [
27 27 {
28 28 field: 'filename',
29 29 component: 'Input',
30   - label: t('fileName'),
  30 + label: t('component.excel.fileName'),
31 31 rules: [{ required: true }],
32 32 },
33 33 {
34 34 field: 'bookType',
35 35 component: 'Select',
36   - label: t('fileType'),
  36 + label: t('component.excel.fileType'),
37 37 defaultValue: 'xlsx',
38 38 rules: [{ required: true }],
39 39 componentProps: {
... ...
src/components/Form/src/FormAction.tsx
... ... @@ -9,7 +9,7 @@ import { getSlot } from &#39;/@/utils/helper/tsxHelper&#39;;
9 9 import { useI18n } from '/@/hooks/web/useI18n';
10 10 import { propTypes } from '/@/utils/propTypes';
11 11  
12   -const { t } = useI18n('component.form');
  12 +const { t } = useI18n();
13 13  
14 14 export default defineComponent({
15 15 name: 'BasicFormAction',
... ... @@ -38,14 +38,14 @@ export default defineComponent({
38 38 setup(props, { slots, emit }) {
39 39 const getResetBtnOptionsRef = computed(() => {
40 40 return {
41   - text: t('resetButton'),
  41 + text: t('component.form.resetButton'),
42 42 ...props.resetButtonOptions,
43 43 };
44 44 });
45 45  
46 46 const getSubmitBtnOptionsRef = computed(() => {
47 47 return {
48   - text: t('submitButton'),
  48 + text: t('component.form.submitButton'),
49 49 // htmlType: 'submit',
50 50 ...props.submitButtonOptions,
51 51 };
... ... @@ -77,7 +77,7 @@ export default defineComponent({
77 77 <Button type="default" class="mr-2" onClick={toggleAdvanced}>
78 78 {() => (
79 79 <>
80   - {isAdvanced ? t('putAway') : t('unfold')}
  80 + {isAdvanced ? t('component.form.putAway') : t('component.form.unfold')}
81 81 <BasicArrow expand={!isAdvanced} top />
82 82 </>
83 83 )}
... ...
src/components/Form/src/FormItem.tsx
... ... @@ -47,7 +47,7 @@ export default defineComponent({
47 47 },
48 48 },
49 49 setup(props, { slots }) {
50   - const { t } = useI18n('component.form');
  50 + const { t } = useI18n();
51 51 // @ts-ignore
52 52 const itemLabelWidthRef = useItemLabelWidth(toRef(props, 'schema'), toRef(props, 'formProps'));
53 53  
... ... @@ -175,7 +175,7 @@ export default defineComponent({
175 175 const characterInx = rules.findIndex((val) => val.max);
176 176 if (characterInx !== -1 && !rules[characterInx].validator) {
177 177 rules[characterInx].message =
178   - rules[characterInx].message || t('maxTip', [rules[characterInx].max]);
  178 + rules[characterInx].message || t('component.form.maxTip', [rules[characterInx].max]);
179 179 }
180 180 return rules;
181 181 }
... ...
src/components/Form/src/helper.ts
1 1 import type { ComponentType } from './types/index';
2 2 import { useI18n } from '/@/hooks/web/useI18n';
3 3  
4   -const { t } = useI18n('component.form');
  4 +const { t } = useI18n();
5 5  
6 6 /**
7 7 * @description: 生成placeholder
8 8 */
9 9 export function createPlaceholderMessage(component: ComponentType) {
10 10 if (component.includes('Input') || component.includes('Complete')) {
11   - return t('input');
  11 + return t('component.form.input');
12 12 }
13 13 if (component.includes('Picker')) {
14   - return t('choose');
  14 + return t('component.form.choose');
15 15 }
16 16 if (
17 17 component.includes('Select') ||
... ... @@ -21,7 +21,7 @@ export function createPlaceholderMessage(component: ComponentType) {
21 21 component.includes('Switch')
22 22 ) {
23 23 // return `请选择${label}`;
24   - return t('choose');
  24 + return t('component.form.choose');
25 25 }
26 26 return '';
27 27 }
... ...
src/components/Menu/src/SearchInput.vue
1 1 <template>
2 2 <section class="menu-search-input" @Click="handleClick" :class="searchClass">
3 3 <a-input-search
4   - :placeholder="t('search')"
  4 + :placeholder="t('component.menu.search')"
5 5 class="menu-search-input__search"
6 6 allowClear
7 7 @change="handleChange"
... ... @@ -29,7 +29,7 @@
29 29 },
30 30 },
31 31 setup(props, { emit }) {
32   - const { t } = useI18n('component.menu');
  32 + const { t } = useI18n();
33 33  
34 34 const [debounceEmitChange] = useDebounce(emitChange, 200);
35 35  
... ...
src/components/Modal/src/props.ts
... ... @@ -3,15 +3,15 @@ import { ButtonProps } from &#39;ant-design-vue/es/button/buttonTypes&#39;;
3 3  
4 4 import { useI18n } from '/@/hooks/web/useI18n';
5 5 import { propTypes } from '/@/utils/propTypes';
6   -const { t } = useI18n('component.modal');
  6 +const { t } = useI18n();
7 7  
8 8 export const modalProps = {
9 9 visible: propTypes.bool,
10 10 // open drag
11 11 draggable: propTypes.bool.def(true),
12 12 centered: propTypes.bool,
13   - cancelText: propTypes.string.def(t('cancelText')),
14   - okText: propTypes.string.def(t('okText')),
  13 + cancelText: propTypes.string.def(t('component.modal.cancelText')),
  14 + okText: propTypes.string.def(t('component.modal.okText')),
15 15  
16 16 closeFunc: Function as PropType<() => Promise<boolean>>,
17 17 };
... ...
src/components/Table/src/components/TableSetting.vue
... ... @@ -4,27 +4,27 @@
4 4  
5 5 <Tooltip placement="top" v-if="getSetting.redo">
6 6 <template #title>
7   - <span>{{ t('settingRedo') }}</span>
  7 + <span>{{ t('component.table.settingRedo') }}</span>
8 8 </template>
9 9 <RedoOutlined @click="redo" />
10 10 </Tooltip>
11 11  
12 12 <Tooltip placement="top" v-if="getSetting.size">
13 13 <template #title>
14   - <span>{{ t('settingDens') }}</span>
  14 + <span>{{ t('component.table.settingDens') }}</span>
15 15 </template>
16 16 <Dropdown placement="bottomCenter" :trigger="['click']">
17 17 <ColumnHeightOutlined />
18 18 <template #overlay>
19 19 <Menu @click="handleTitleClick" selectable v-model:selectedKeys="selectedKeysRef">
20 20 <MenuItem key="default">
21   - <span>{{ t('settingDensDefault') }}</span>
  21 + <span>{{ t('component.table.settingDensDefault') }}</span>
22 22 </MenuItem>
23 23 <MenuItem key="middle">
24   - <span>{{ t('settingDensMiddle') }}</span>
  24 + <span>{{ t('component.table.settingDensMiddle') }}</span>
25 25 </MenuItem>
26 26 <MenuItem key="small">
27   - <span>{{ t('settingDensSmall') }}</span>
  27 + <span>{{ t('component.table.settingDensSmall') }}</span>
28 28 </MenuItem>
29 29 </Menu>
30 30 </template>
... ... @@ -140,7 +140,7 @@
140 140 defaultCheckList: [],
141 141 });
142 142  
143   - const { t } = useI18n('component.table');
  143 + const { t } = useI18n();
144 144  
145 145 watchEffect(() => {
146 146 const columns = table.getColumns();
... ...
src/components/Table/src/hooks/useColumns.ts
... ... @@ -6,7 +6,7 @@ import { PAGE_SIZE } from &#39;../const&#39;;
6 6 import { useProps } from './useProps';
7 7 import { useI18n } from '/@/hooks/web/useI18n';
8 8  
9   -const { t } = useI18n('component.table');
  9 +const { t } = useI18n();
10 10 export function useColumns(
11 11 refProps: ComputedRef<BasicTableProps>,
12 12 getPaginationRef: ComputedRef<false | PaginationProps>
... ... @@ -44,7 +44,7 @@ export function useColumns(
44 44 columns.unshift({
45 45 flag: 'INDEX',
46 46 width: 50,
47   - title: t('index'),
  47 + title: t('component.table.index'),
48 48 align: 'center',
49 49 customRender: ({ index }) => {
50 50 const getPagination = unref(getPaginationRef);
... ...
src/components/Table/src/hooks/usePagination.tsx
... ... @@ -10,7 +10,7 @@ import { PAGE_SIZE, PAGE_SIZE_OPTIONS } from &#39;../const&#39;;
10 10 import { useProps } from './useProps';
11 11 import { useI18n } from '/@/hooks/web/useI18n';
12 12  
13   -const { t } = useI18n('component.table');
  13 +const { t } = useI18n();
14 14 export function usePagination(refProps: ComputedRef<BasicTableProps>) {
15 15 const configRef = ref<PaginationProps>({});
16 16 const { propsRef } = useProps(refProps);
... ... @@ -25,7 +25,7 @@ export function usePagination(refProps: ComputedRef&lt;BasicTableProps&gt;) {
25 25 pageSize: PAGE_SIZE,
26 26 size: 'small',
27 27 defaultPageSize: PAGE_SIZE,
28   - showTotal: (total) => t('total', { total }),
  28 + showTotal: (total) => t('component.table.total', { total }),
29 29 showSizeChanger: true,
30 30 pageSizeOptions: PAGE_SIZE_OPTIONS,
31 31 itemRender: ({ page, type, originalElement }) => {
... ...
src/components/Upload/src/BasicUpload.vue
... ... @@ -2,11 +2,11 @@
2 2 <div>
3 3 <a-button-group>
4 4 <a-button type="primary" @click="openUploadModal" preIcon="ant-design:cloud-upload-outlined">
5   - {{ t('upload') }}
  5 + {{ t('component.upload.upload') }}
6 6 </a-button>
7 7 <Tooltip placement="bottom" v-if="showPreview">
8 8 <template #title>
9   - {{ t('uploaded') }}
  9 + {{ t('component.upload.uploaded') }}
10 10 <template v-if="fileListRef.length">{{ fileListRef.length }}</template>
11 11 </template>
12 12 <a-button @click="openPreviewModal">
... ... @@ -46,7 +46,7 @@
46 46 components: { UploadModal, UploadPreviewModal, Icon, Tooltip },
47 47 props: uploadContainerProps,
48 48 setup(props, { emit, attrs }) {
49   - const { t } = useI18n('component.upload');
  49 + const { t } = useI18n();
50 50 // 上传modal
51 51 const [registerUploadModal, { openModal: openUploadModal }] = useModal();
52 52  
... ...
src/components/Upload/src/UploadModal.vue
1 1 <template>
2 2 <BasicModal
3 3 width="800px"
4   - :title="t('upload')"
5   - :okText="t('save')"
  4 + :title="t('component.upload.upload')"
  5 + :okText="t('component.upload.save')"
6 6 v-bind="$attrs"
7 7 @register="register"
8 8 @ok="handleOk"
... ... @@ -31,7 +31,7 @@
31 31 :before-upload="beforeUpload"
32 32 class="upload-modal-toolbar__btn"
33 33 >
34   - <a-button type="primary"> {{ t('choose') }} </a-button>
  34 + <a-button type="primary"> {{ t('component.upload.choose') }} </a-button>
35 35 </Upload>
36 36 </div>
37 37 <FileList :dataSource="fileListRef" :columns="columns" :actionColumn="actionColumn" />
... ... @@ -64,7 +64,7 @@
64 64 props: basicProps,
65 65 setup(props, { emit }) {
66 66 // 是否正在上传
67   - const { t } = useI18n('component.upload');
  67 + const { t } = useI18n();
68 68  
69 69 const isUploadingRef = ref(false);
70 70 const fileListRef = ref<FileItem[]>([]);
... ... @@ -105,10 +105,10 @@
105 105 (item) => item.status === UploadResultStatus.ERROR
106 106 );
107 107 return isUploadingRef.value
108   - ? t('uploading')
  108 + ? t('component.upload.uploading')
109 109 : someError
110   - ? t('reUploadFailed')
111   - : t('startUpload');
  110 + ? t('component.upload.reUploadFailed')
  111 + : t('component.upload.startUpload');
112 112 });
113 113  
114 114 // 上传前校验
... ... @@ -119,13 +119,13 @@
119 119  
120 120 // 设置最大值,则判断
121 121 if (maxSize && file.size / 1024 / 1024 >= maxSize) {
122   - createMessage.error(t('maxSizeMultiple', [maxSize]));
  122 + createMessage.error(t('component.upload.maxSizeMultiple', [maxSize]));
123 123 return false;
124 124 }
125 125  
126 126 // 设置类型,则判断
127 127 if (accept.length > 0 && !checkFileType(file, accept)) {
128   - createMessage.error!(t('acceptUpload', [accept.join(',')]));
  128 + createMessage.error!(t('acomponent.upload.cceptUpload', [accept.join(',')]));
129 129 return false;
130 130 }
131 131 const commonItem = {
... ... @@ -206,7 +206,7 @@
206 206 async function handleStartUpload() {
207 207 const { maxNumber } = props;
208 208 if (fileListRef.value.length > maxNumber) {
209   - return createMessage.warning(t('maxNumber', [maxNumber]));
  209 + return createMessage.warning(t('component.upload.maxNumber', [maxNumber]));
210 210 }
211 211 try {
212 212 isUploadingRef.value = true;
... ... @@ -233,10 +233,10 @@
233 233 const { maxNumber } = props;
234 234  
235 235 if (fileListRef.value.length > maxNumber) {
236   - return createMessage.warning(t('maxNumber', [maxNumber]));
  236 + return createMessage.warning(t('component.upload.maxNumber', [maxNumber]));
237 237 }
238 238 if (isUploadingRef.value) {
239   - return createMessage.warning(t('saveWarn'));
  239 + return createMessage.warning(t('component.upload.saveWarn'));
240 240 }
241 241 const fileList: string[] = [];
242 242  
... ... @@ -248,7 +248,7 @@
248 248 }
249 249 // 存在一个上传成功的即可保存
250 250 if (fileList.length <= 0) {
251   - return createMessage.warning(t('saveError'));
  251 + return createMessage.warning(t('component.upload.saveError'));
252 252 }
253 253 fileListRef.value = [];
254 254 closeModal();
... ... @@ -261,7 +261,7 @@
261 261 fileListRef.value = [];
262 262 return true;
263 263 } else {
264   - createMessage.warning(t('uploadWait'));
  264 + createMessage.warning(t('component.upload.uploadWait'));
265 265 return false;
266 266 }
267 267 }
... ...
src/components/Upload/src/UploadPreviewModal.vue
1 1 <template>
2 2 <BasicModal
3 3 width="800px"
4   - :title="t('preview')"
  4 + :title="t('component.upload.preview')"
5 5 wrapClassName="upload-preview-modal"
6 6 v-bind="$attrs"
7 7 @register="register"
... ... @@ -30,7 +30,7 @@
30 30 props: previewProps,
31 31 setup(props, { emit }) {
32 32 const [register, { closeModal }] = useModalInner();
33   - const { t } = useI18n('component.upload');
  33 + const { t } = useI18n();
34 34  
35 35 const fileListRef = ref<PreviewFileItem[]>([]);
36 36 watch(
... ...
src/components/Upload/src/data.tsx
... ... @@ -7,14 +7,14 @@ import { Progress, Tag } from &#39;ant-design-vue&#39;;
7 7 import TableAction from '/@/components/Table/src/components/TableAction';
8 8  
9 9 import { useI18n } from '/@/hooks/web/useI18n';
10   -const { t } = useI18n('component.upload');
  10 +const { t } = useI18n();
11 11  
12 12 // 文件上传列表
13 13 export function createTableColumns(): BasicColumn[] {
14 14 return [
15 15 {
16 16 dataIndex: 'thumbUrl',
17   - title: t('legend'),
  17 + title: t('component.upload.legend'),
18 18 width: 100,
19 19 customRender: ({ record }) => {
20 20 const { thumbUrl, type } = (record as FileItem) || {};
... ... @@ -23,7 +23,7 @@ export function createTableColumns(): BasicColumn[] {
23 23 },
24 24 {
25 25 dataIndex: 'name',
26   - title: t('fileName'),
  26 + title: t('component.upload.fileName'),
27 27 align: 'left',
28 28 customRender: ({ text, record }) => {
29 29 const { percent, status: uploadStatus } = (record as FileItem) || {};
... ... @@ -47,7 +47,7 @@ export function createTableColumns(): BasicColumn[] {
47 47 },
48 48 {
49 49 dataIndex: 'size',
50   - title: t('fileSize'),
  50 + title: t('component.upload.fileSize'),
51 51 width: 100,
52 52 customRender: ({ text = 0 }) => {
53 53 return text && (text / 1024).toFixed(2) + 'KB';
... ... @@ -60,15 +60,15 @@ export function createTableColumns(): BasicColumn[] {
60 60 // },
61 61 {
62 62 dataIndex: 'status',
63   - title: t('fileStatue'),
  63 + title: t('component.upload.fileStatue'),
64 64 width: 100,
65 65 customRender: ({ text }) => {
66 66 if (text === UploadResultStatus.SUCCESS) {
67   - return <Tag color="green">{() => t('uploadSuccess')}</Tag>;
  67 + return <Tag color="green">{() => t('component.upload.uploadSuccess')}</Tag>;
68 68 } else if (text === UploadResultStatus.ERROR) {
69   - return <Tag color="red">{() => t('uploadError')}</Tag>;
  69 + return <Tag color="red">{() => t('component.upload.uploadError')}</Tag>;
70 70 } else if (text === UploadResultStatus.UPLOADING) {
71   - return <Tag color="blue">{() => t('uploading')}</Tag>;
  71 + return <Tag color="blue">{() => t('component.upload.uploading')}</Tag>;
72 72 }
73 73  
74 74 return text;
... ... @@ -79,20 +79,20 @@ export function createTableColumns(): BasicColumn[] {
79 79 export function createActionColumn(handleRemove: Function, handlePreview: Function): BasicColumn {
80 80 return {
81 81 width: 120,
82   - title: t('operating'),
  82 + title: t('component.upload.operating'),
83 83 dataIndex: 'action',
84 84 fixed: false,
85 85 customRender: ({ record }) => {
86 86 const actions: ActionItem[] = [
87 87 {
88   - label: t('del'),
  88 + label: t('component.upload.del'),
89 89 color: 'error',
90 90 onClick: handleRemove.bind(null, record),
91 91 },
92 92 ];
93 93 if (checkImgType(record)) {
94 94 actions.unshift({
95   - label: t('preview'),
  95 + label: t('component.upload.preview'),
96 96 onClick: handlePreview.bind(null, record),
97 97 });
98 98 }
... ... @@ -105,7 +105,7 @@ export function createPreviewColumns(): BasicColumn[] {
105 105 return [
106 106 {
107 107 dataIndex: 'url',
108   - title: t('legend'),
  108 + title: t('component.upload.legend'),
109 109 width: 100,
110 110 customRender: ({ record }) => {
111 111 const { url, type } = (record as PreviewFileItem) || {};
... ... @@ -116,7 +116,7 @@ export function createPreviewColumns(): BasicColumn[] {
116 116 },
117 117 {
118 118 dataIndex: 'name',
119   - title: t('fileName'),
  119 + title: t('component.upload.fileName'),
120 120 align: 'left',
121 121 },
122 122 ];
... ... @@ -133,7 +133,7 @@ export function createPreviewActionColumn({
133 133 }): BasicColumn {
134 134 return {
135 135 width: 160,
136   - title: t('operating'),
  136 + title: t('component.upload.operating'),
137 137 dataIndex: 'action',
138 138 fixed: false,
139 139 customRender: ({ record }) => {
... ... @@ -141,18 +141,18 @@ export function createPreviewActionColumn({
141 141  
142 142 const actions: ActionItem[] = [
143 143 {
144   - label: t('del'),
  144 + label: t('component.upload.del'),
145 145 color: 'error',
146 146 onClick: handleRemove.bind(null, record),
147 147 },
148 148 {
149   - label: t('download'),
  149 + label: t('component.upload.download'),
150 150 onClick: handleDownload.bind(null, record),
151 151 },
152 152 ];
153 153 if (isImgTypeByName(url)) {
154 154 actions.unshift({
155   - label: t('preview'),
  155 + label: t('component.upload.preview'),
156 156 onClick: handlePreview.bind(null, record),
157 157 });
158 158 }
... ...
src/components/Upload/src/useUpload.ts
1 1 import { Ref, unref, computed } from 'vue';
2 2 import { useI18n } from '/@/hooks/web/useI18n';
3   -const { t } = useI18n('component.upload');
  3 +const { t } = useI18n();
4 4 export function useUploadType({
5 5 acceptRef,
6 6 // uploadTypeRef,
... ... @@ -38,17 +38,17 @@ export function useUploadType({
38 38  
39 39 const accept = unref(acceptRef);
40 40 if (accept.length > 0) {
41   - helpTexts.push(t('accept', [accept.join(',')]));
  41 + helpTexts.push(t('component.upload.accept', [accept.join(',')]));
42 42 }
43 43  
44 44 const maxSize = unref(maxSizeRef);
45 45 if (maxSize) {
46   - helpTexts.push(t('maxSize', [maxSize]));
  46 + helpTexts.push(t('component.upload.maxSize', [maxSize]));
47 47 }
48 48  
49 49 const maxNumber = unref(maxNumberRef);
50 50 if (maxNumber && maxNumber !== Infinity) {
51   - helpTexts.push(t('maxNumber', [maxNumber]));
  51 + helpTexts.push(t('component.upload.maxNumber', [maxNumber]));
52 52 }
53 53 return helpTexts.join(',');
54 54 });
... ...
src/components/Verify/src/ImgRotate.tsx
... ... @@ -30,7 +30,7 @@ export default defineComponent({
30 30 endTime: 0,
31 31 draged: false,
32 32 });
33   - const { t } = useI18n('component.verify');
  33 + const { t } = useI18n();
34 34  
35 35 watch(
36 36 () => state.isPassing,
... ... @@ -146,7 +146,9 @@ export default defineComponent({
146 146 />
147 147 {state.showTip && (
148 148 <span class={[`ir-dv-img__tip`, state.isPassing ? 'success' : 'error']}>
149   - {state.isPassing ? t('time', { time: time.toFixed(1) }) : t('error')}
  149 + {state.isPassing
  150 + ? t('component.verify.time', { time: time.toFixed(1) })
  151 + : t('component.verify.error')}
150 152 </span>
151 153 )}
152 154 {!state.showTip && !state.draged && (
... ...
src/components/Verify/src/props.ts
1 1 import type { PropType } from 'vue';
2 2 import { useI18n } from '/@/hooks/web/useI18n';
3 3  
4   -const { t } = useI18n('component.verify');
  4 +const { t } = useI18n();
5 5 export const basicProps = {
6 6 value: {
7 7 type: Boolean as PropType<boolean>,
... ... @@ -15,11 +15,11 @@ export const basicProps = {
15 15  
16 16 text: {
17 17 type: [String] as PropType<string>,
18   - default: t('dragText'),
  18 + default: t('component.verify.dragText'),
19 19 },
20 20 successText: {
21 21 type: [String] as PropType<string>,
22   - default: t('successText'),
  22 + default: t('component.verify.successText'),
23 23 },
24 24 height: {
25 25 type: [Number, String] as PropType<number | string>,
... ...
src/layouts/default/footer/index.tsx
... ... @@ -13,16 +13,16 @@ import { useI18n } from &#39;/@/hooks/web/useI18n&#39;;
13 13 export default defineComponent({
14 14 name: 'LayoutContent',
15 15 setup() {
16   - const { t } = useI18n('layout.footer');
  16 + const { t } = useI18n();
17 17 return () => {
18 18 return (
19 19 <Layout.Footer class="layout-footer">
20 20 {() => (
21 21 <>
22 22 <div class="layout-footer__links">
23   - <a onClick={() => openWindow(SITE_URL)}>{t('onlinePreview')}</a>
  23 + <a onClick={() => openWindow(SITE_URL)}>{t('layout.footer.onlinePreview')}</a>
24 24 <GithubFilled onClick={() => openWindow(GITHUB_URL)} class="github" />
25   - <a onClick={() => openWindow(DOC_URL)}>{t('onlineDocument')}</a>
  25 + <a onClick={() => openWindow(DOC_URL)}>{t('layout.footer.onlineDocument')}</a>
26 26 </div>
27 27 <div>Copyright &copy;2020 Vben Admin</div>
28 28 </>
... ...
src/layouts/default/header/LayoutHeader.tsx
... ... @@ -66,7 +66,7 @@ export default defineComponent({
66 66 const logoWidthRef = ref(200);
67 67 const logoRef = ref<ComponentRef>(null);
68 68 const { refreshPage } = useTabs();
69   - const { t } = useI18n('layout.header');
  69 + const { t } = useI18n();
70 70  
71 71 const { getShowTopMenu, getShowHeaderTrigger, getSplit, getTopMenuAlign } = useMenuSetting();
72 72  
... ...
src/layouts/default/header/UserDropdown.tsx
... ... @@ -44,7 +44,7 @@ const MenuItem: FunctionalComponent&lt;MenuItemProps&gt; = (props) =&gt; {
44 44 export default defineComponent({
45 45 name: 'UserDropdown',
46 46 setup() {
47   - const { t } = useI18n('layout.header');
  47 + const { t } = useI18n();
48 48 const { getShowDoc } = useHeaderSetting();
49 49  
50 50 const getUserInfo = computed(() => {
... ... @@ -91,12 +91,18 @@ export default defineComponent({
91 91 <Menu onClick={handleMenuClick}>
92 92 {() => (
93 93 <>
94   - {showDoc && <MenuItem key="doc" text={t('dropdownItemDoc')} icon="gg:loadbar-doc" />}
  94 + {showDoc && (
  95 + <MenuItem
  96 + key="doc"
  97 + text={t('layout.header.dropdownItemDoc')}
  98 + icon="gg:loadbar-doc"
  99 + />
  100 + )}
95 101 {/* @ts-ignore */}
96 102 {showDoc && <Menu.Divider />}
97 103 <MenuItem
98 104 key="loginOut"
99   - text={t('dropdownItemLoginOut')}
  105 + text={t('layout.header.dropdownItemLoginOut')}
100 106 icon="ant-design:poweroff-outlined"
101 107 />
102 108 </>
... ...
src/layouts/default/lock/LockAction.tsx
... ... @@ -15,7 +15,7 @@ const prefixCls = &#39;lock-modal&#39;;
15 15 export default defineComponent({
16 16 name: 'LockModal',
17 17 setup(_, { attrs }) {
18   - const { t } = useI18n('layout.header');
  18 + const { t } = useI18n();
19 19 const [register, { closeModal }] = useModalInner();
20 20  
21 21 const [registerForm, { validateFields, resetFields }] = useForm({
... ... @@ -23,7 +23,7 @@ export default defineComponent({
23 23 schemas: [
24 24 {
25 25 field: 'password',
26   - label: t('lockScreenPassword'),
  26 + label: t('layout.header.lockScreenPassword'),
27 27 component: 'InputPassword',
28 28 required: true,
29 29 },
... ... @@ -53,7 +53,7 @@ export default defineComponent({
53 53 return () => (
54 54 <BasicModal
55 55 footer={null}
56   - title={t('lockScreen')}
  56 + title={t('layout.header.lockScreen')}
57 57 {...attrs}
58 58 class={prefixCls}
59 59 onRegister={register}
... ... @@ -69,10 +69,10 @@ export default defineComponent({
69 69  
70 70 <div class={`${prefixCls}__footer`}>
71 71 <Button type="primary" block class="mt-2" onClick={lock}>
72   - {() => t('lockScreenBtn')}
  72 + {() => t('layout.header.lockScreenBtn')}
73 73 </Button>
74 74 <Button block class="mt-2" onClick={lock.bind(null, false)}>
75   - {() => t('notLockScreenPassword')}
  75 + {() => t('layout.header.notLockScreenPassword')}
76 76 </Button>
77 77 </div>
78 78 </div>
... ...
src/layouts/default/multitabs/TabContent.tsx
... ... @@ -59,7 +59,7 @@ export default defineComponent({
59 59 },
60 60 },
61 61 setup(props) {
62   - const { t } = useI18n('layout.multipleTab');
  62 + const { t } = useI18n();
63 63 const { getShowMenu } = useMenuSetting();
64 64 const { getShowHeader } = useHeaderSetting();
65 65 const { getShowQuick } = useMultipleTabSetting();
... ... @@ -76,7 +76,7 @@ export default defineComponent({
76 76  
77 77 return () => {
78 78 const scaleAction = getScaleAction(
79   - unref(getIsScale) ? t('putAway') : t('unfold'),
  79 + unref(getIsScale) ? t('layout.multipleTab.putAway') : t('layout.multipleTab.unfold'),
80 80 unref(getIsScale)
81 81 );
82 82 const dropMenuList = unref(getDropMenuList) || [];
... ...
src/layouts/default/multitabs/data.ts
... ... @@ -4,7 +4,7 @@ import type { TabItem } from &#39;/@/store/modules/tab&#39;;
4 4  
5 5 import { useI18n } from '/@/hooks/web/useI18n';
6 6  
7   -const { t } = useI18n('layout.multipleTab');
  7 +const { t } = useI18n();
8 8  
9 9 export enum TabContentEnum {
10 10 TAB_TYPE,
... ... @@ -41,40 +41,40 @@ export function getActions() {
41 41 const REFRESH_PAGE: DropMenu = {
42 42 icon: 'ant-design:reload-outlined',
43 43 event: MenuEventEnum.REFRESH_PAGE,
44   - text: t('redo'),
  44 + text: t('layout.multipleTab.redo'),
45 45 disabled: false,
46 46 };
47 47 const CLOSE_CURRENT: DropMenu = {
48 48 icon: 'ant-design:close-outlined',
49 49 event: MenuEventEnum.CLOSE_CURRENT,
50   - text: t('close'),
  50 + text: t('layout.multipleTab.close'),
51 51 disabled: false,
52 52 divider: true,
53 53 };
54 54 const CLOSE_LEFT: DropMenu = {
55 55 icon: 'ant-design:pic-left-outlined',
56 56 event: MenuEventEnum.CLOSE_LEFT,
57   - text: t('closeLeft'),
  57 + text: t('layout.multipleTab.closeLeft'),
58 58 disabled: false,
59 59 divider: false,
60 60 };
61 61 const CLOSE_RIGHT: DropMenu = {
62 62 icon: 'ant-design:pic-right-outlined',
63 63 event: MenuEventEnum.CLOSE_RIGHT,
64   - text: t('closeRight'),
  64 + text: t('layout.multipleTab.closeRight'),
65 65 disabled: false,
66 66 divider: true,
67 67 };
68 68 const CLOSE_OTHER: DropMenu = {
69 69 icon: 'ant-design:pic-center-outlined',
70 70 event: MenuEventEnum.CLOSE_OTHER,
71   - text: t('closeOther'),
  71 + text: t('layout.multipleTab.closeOther'),
72 72 disabled: false,
73 73 };
74 74 const CLOSE_ALL: DropMenu = {
75 75 icon: 'ant-design:line-outlined',
76 76 event: MenuEventEnum.CLOSE_ALL,
77   - text: t('closeAll'),
  77 + text: t('layout.multipleTab.closeAll'),
78 78 disabled: false,
79 79 };
80 80 return [REFRESH_PAGE, CLOSE_CURRENT, CLOSE_LEFT, CLOSE_RIGHT, CLOSE_OTHER, CLOSE_ALL];
... ...
src/layouts/default/setting/SettingDrawer.tsx
... ... @@ -56,7 +56,7 @@ interface ThemePickerProps {
56 56 }
57 57  
58 58 const { createSuccessModal, createMessage } = useMessage();
59   -const { t } = useI18n('layout.setting');
  59 +const { t } = useI18n();
60 60  
61 61 /**
62 62 * Menu type Picker comp
... ... @@ -122,8 +122,8 @@ const FooterButton: FunctionalComponent = () =&gt; {
122 122 const { isSuccessRef } = useCopyToClipboard(JSON.stringify(unref(getRootSetting), null, 2));
123 123 unref(isSuccessRef) &&
124 124 createSuccessModal({
125   - title: t('operatingTitle'),
126   - content: t('operatingContent'),
  125 + title: t('layout.setting.operatingTitle'),
  126 + content: t('layout.setting.operatingContent'),
127 127 });
128 128 }
129 129 function handleResetSetting() {
... ... @@ -133,7 +133,7 @@ const FooterButton: FunctionalComponent = () =&gt; {
133 133 // updateTheme(themeColor);
134 134 updateColorWeak(colorWeak);
135 135 updateGrayMode(grayMode);
136   - createMessage.success(t('resetSuccess'));
  136 + createMessage.success(t('layout.setting.resetSuccess'));
137 137 } catch (error) {
138 138 createMessage.error(error);
139 139 }
... ... @@ -151,7 +151,7 @@ const FooterButton: FunctionalComponent = () =&gt; {
151 151 {() => (
152 152 <>
153 153 <CopyOutlined class="mr-2" />
154   - {t('copyBtn')}
  154 + {t('layout.setting.copyBtn')}
155 155 </>
156 156 )}
157 157 </Button>
... ... @@ -159,7 +159,7 @@ const FooterButton: FunctionalComponent = () =&gt; {
159 159 {() => (
160 160 <>
161 161 <RedoOutlined class="mr-2" />
162   - {t('resetBtn')}
  162 + {t('layout.setting.resetBtn')}
163 163 </>
164 164 )}
165 165 </Button>
... ... @@ -167,7 +167,7 @@ const FooterButton: FunctionalComponent = () =&gt; {
167 167 {() => (
168 168 <>
169 169 <RedoOutlined class="mr-2" />
170   - {t('clearBtn')}
  170 + {t('layout.setting.clearBtn')}
171 171 </>
172 172 )}
173 173 </Button>
... ... @@ -226,7 +226,7 @@ export default defineComponent({
226 226 return (
227 227 <>
228 228 <MenuTypePicker />
229   - {renderSwitchItem(t('splitMenu'), {
  229 + {renderSwitchItem(t('layout.setting.splitMenu'), {
230 230 handler: (e) => {
231 231 baseHandler(HandlerEnum.MENU_SPLIT, e);
232 232 },
... ... @@ -240,7 +240,7 @@ export default defineComponent({
240 240 function renderTheme() {
241 241 return (
242 242 <>
243   - <Divider>{() => t('headerTheme')}</Divider>
  243 + <Divider>{() => t('layout.setting.headerTheme')}</Divider>
244 244 <ThemePicker
245 245 colorList={HEADER_PRESET_BG_COLOR_LIST}
246 246 def={unref(getHeaderBgColor)}
... ... @@ -248,7 +248,7 @@ export default defineComponent({
248 248 baseHandler(HandlerEnum.HEADER_THEME, e);
249 249 }}
250 250 />
251   - <Divider>{() => t('sidebarTheme')}</Divider>
  251 + <Divider>{() => t('layout.setting.sidebarTheme')}</Divider>
252 252 <ThemePicker
253 253 colorList={SIDE_BAR_BG_COLOR_LIST}
254 254 def={unref(getMenuBgColor)}
... ... @@ -265,56 +265,56 @@ export default defineComponent({
265 265 */
266 266 function renderFeatures() {
267 267 return [
268   - renderSwitchItem(t('menuDrag'), {
  268 + renderSwitchItem(t('layout.setting.menuDrag'), {
269 269 handler: (e) => {
270 270 baseHandler(HandlerEnum.MENU_HAS_DRAG, e);
271 271 },
272 272 def: unref(getCanDrag),
273 273 disabled: !unref(getShowMenuRef),
274 274 }),
275   - renderSwitchItem(t('menuSearch'), {
  275 + renderSwitchItem(t('layout.setting.menuSearch'), {
276 276 handler: (e) => {
277 277 baseHandler(HandlerEnum.MENU_SHOW_SEARCH, e);
278 278 },
279 279 def: unref(getShowSearch),
280 280 disabled: !unref(getShowMenuRef),
281 281 }),
282   - renderSwitchItem(t('menuAccordion'), {
  282 + renderSwitchItem(t('layout.setting.menuAccordion'), {
283 283 handler: (e) => {
284 284 baseHandler(HandlerEnum.MENU_ACCORDION, e);
285 285 },
286 286 def: unref(getAccordion),
287 287 disabled: !unref(getShowMenuRef),
288 288 }),
289   - renderSwitchItem(t('menuCollapse'), {
  289 + renderSwitchItem(t('layout.setting.menuCollapse'), {
290 290 handler: (e) => {
291 291 baseHandler(HandlerEnum.MENU_COLLAPSED, e);
292 292 },
293 293 def: unref(getCollapsed),
294 294 disabled: !unref(getShowMenuRef),
295 295 }),
296   - renderSwitchItem(t('collapseMenuDisplayName'), {
  296 + renderSwitchItem(t('layout.setting.collapseMenuDisplayName'), {
297 297 handler: (e) => {
298 298 baseHandler(HandlerEnum.MENU_COLLAPSED_SHOW_TITLE, e);
299 299 },
300 300 def: unref(getCollapsedShowTitle),
301 301 disabled: !unref(getShowMenuRef) || !unref(getCollapsed),
302 302 }),
303   - renderSwitchItem(t('fixedHeader'), {
  303 + renderSwitchItem(t('layout.setting.fixedHeader'), {
304 304 handler: (e) => {
305 305 baseHandler(HandlerEnum.HEADER_FIXED, e);
306 306 },
307 307 def: unref(getHeaderFixed),
308 308 disabled: !unref(getShowHeader),
309 309 }),
310   - renderSwitchItem(t('fixedSideBar'), {
  310 + renderSwitchItem(t('layout.setting.fixedSideBar'), {
311 311 handler: (e) => {
312 312 baseHandler(HandlerEnum.MENU_FIXED, e);
313 313 },
314 314 def: unref(getMenuFixed),
315 315 disabled: !unref(getShowMenuRef),
316 316 }),
317   - renderSelectItem(t('topMenuLayout'), {
  317 + renderSelectItem(t('layout.setting.topMenuLayout'), {
318 318 handler: (e) => {
319 319 baseHandler(HandlerEnum.MENU_TOP_ALIGN, e);
320 320 },
... ... @@ -322,7 +322,7 @@ export default defineComponent({
322 322 options: topMenuAlignOptions,
323 323 disabled: !unref(getShowHeader) || (!unref(getIsTopMenu) && !unref(getSplit)),
324 324 }),
325   - renderSelectItem(t('menuCollapseButton'), {
  325 + renderSelectItem(t('layout.setting.menuCollapseButton'), {
326 326 handler: (e) => {
327 327 baseHandler(HandlerEnum.MENU_TRIGGER, e);
328 328 },
... ... @@ -331,7 +331,7 @@ export default defineComponent({
331 331 options: menuTriggerOptions,
332 332 }),
333 333  
334   - renderSelectItem(t('contentMode'), {
  334 + renderSelectItem(t('layout.setting.contentMode'), {
335 335 handler: (e) => {
336 336 baseHandler(HandlerEnum.CONTENT_MODE, e);
337 337 },
... ... @@ -339,7 +339,7 @@ export default defineComponent({
339 339 options: contentModeOptions,
340 340 }),
341 341 <div class={`setting-drawer__cell-item`}>
342   - <span>{t('autoScreenLock')}</span>
  342 + <span>{t('layout.setting.autoScreenLock')}</span>
343 343 <InputNumber
344 344 style="width:126px"
345 345 size="small"
... ... @@ -350,14 +350,14 @@ export default defineComponent({
350 350 defaultValue={appStore.getProjectConfig.lockTime}
351 351 formatter={(value: string) => {
352 352 if (parseInt(value) === 0) {
353   - return `0(${t('notAutoScreenLock')})`;
  353 + return `0(${t('layout.setting.notAutoScreenLock')})`;
354 354 }
355   - return `${value}${t('minute')}`;
  355 + return `${value}${t('layout.setting.minute')}`;
356 356 }}
357 357 />
358 358 </div>,
359 359 <div class={`setting-drawer__cell-item`}>
360   - <span>{t('expandedMenuWidth')}</span>
  360 + <span>{t('layout.setting.expandedMenuWidth')}</span>
361 361 <InputNumber
362 362 style="width:126px"
363 363 size="small"
... ... @@ -377,27 +377,27 @@ export default defineComponent({
377 377  
378 378 function renderContent() {
379 379 return [
380   - renderSwitchItem(t('breadcrumb'), {
  380 + renderSwitchItem(t('layout.setting.breadcrumb'), {
381 381 handler: (e) => {
382 382 baseHandler(HandlerEnum.SHOW_BREADCRUMB, e);
383 383 },
384 384 def: unref(getShowBreadCrumb),
385 385 disabled: !unref(getShowHeader),
386 386 }),
387   - renderSwitchItem(t('breadcrumbIcon'), {
  387 + renderSwitchItem(t('layout.setting.breadcrumbIcon'), {
388 388 handler: (e) => {
389 389 baseHandler(HandlerEnum.SHOW_BREADCRUMB_ICON, e);
390 390 },
391 391 def: unref(getShowBreadCrumbIcon),
392 392 disabled: !unref(getShowHeader),
393 393 }),
394   - renderSwitchItem(t('tabs'), {
  394 + renderSwitchItem(t('layout.setting.tabs'), {
395 395 handler: (e) => {
396 396 baseHandler(HandlerEnum.TABS_SHOW, e);
397 397 },
398 398 def: unref(getShowMultipleTab),
399 399 }),
400   - renderSwitchItem(t('tabsQuickBtn'), {
  400 + renderSwitchItem(t('layout.setting.tabsQuickBtn'), {
401 401 handler: (e) => {
402 402 baseHandler(HandlerEnum.TABS_SHOW_QUICK, e);
403 403 },
... ... @@ -405,14 +405,14 @@ export default defineComponent({
405 405 disabled: !unref(getShowMultipleTab),
406 406 }),
407 407  
408   - renderSwitchItem(t('sidebar'), {
  408 + renderSwitchItem(t('layout.setting.sidebar'), {
409 409 handler: (e) => {
410 410 baseHandler(HandlerEnum.MENU_SHOW_SIDEBAR, e);
411 411 },
412 412 def: unref(getShowMenu),
413 413 disabled: unref(getIsHorizontal),
414 414 }),
415   - renderSwitchItem(t('header'), {
  415 + renderSwitchItem(t('layout.setting.header'), {
416 416 handler: (e) => {
417 417 baseHandler(HandlerEnum.HEADER_SHOW, e);
418 418 },
... ... @@ -424,25 +424,25 @@ export default defineComponent({
424 424 },
425 425 def: unref(getShowLogo),
426 426 }),
427   - renderSwitchItem(t('footer'), {
  427 + renderSwitchItem(t('layout.setting.footer'), {
428 428 handler: (e) => {
429 429 baseHandler(HandlerEnum.SHOW_FOOTER, e);
430 430 },
431 431 def: unref(getShowFooter),
432 432 }),
433   - renderSwitchItem(t('fullContent'), {
  433 + renderSwitchItem(t('layout.setting.fullContent'), {
434 434 handler: (e) => {
435 435 baseHandler(HandlerEnum.FULL_CONTENT, e);
436 436 },
437 437 def: unref(getFullContent),
438 438 }),
439   - renderSwitchItem(t('grayMode'), {
  439 + renderSwitchItem(t('layout.setting.grayMode'), {
440 440 handler: (e) => {
441 441 baseHandler(HandlerEnum.GRAY_MODE, e);
442 442 },
443 443 def: unref(getGrayMode),
444 444 }),
445   - renderSwitchItem(t('colorWeak'), {
  445 + renderSwitchItem(t('layout.setting.colorWeak'), {
446 446 handler: (e) => {
447 447 baseHandler(HandlerEnum.COLOR_WEAK, e);
448 448 },
... ... @@ -454,13 +454,13 @@ export default defineComponent({
454 454 function renderTransition() {
455 455 return (
456 456 <>
457   - {renderSwitchItem(t('progress'), {
  457 + {renderSwitchItem(t('layout.setting.progress'), {
458 458 handler: (e) => {
459 459 baseHandler(HandlerEnum.OPEN_PROGRESS, e);
460 460 },
461 461 def: unref(getOpenNProgress),
462 462 })}
463   - {renderSwitchItem(t('switchLoading'), {
  463 + {renderSwitchItem(t('layout.setting.switchLoading'), {
464 464 handler: (e) => {
465 465 baseHandler(HandlerEnum.OPEN_PAGE_LOADING, e);
466 466 },
... ... @@ -468,14 +468,14 @@ export default defineComponent({
468 468 disabled: !unref(getEnableTransition),
469 469 })}
470 470  
471   - {renderSwitchItem(t('switchAnimation'), {
  471 + {renderSwitchItem(t('layout.setting.switchAnimation'), {
472 472 handler: (e) => {
473 473 baseHandler(HandlerEnum.OPEN_ROUTE_TRANSITION, e);
474 474 },
475 475 def: unref(getEnableTransition),
476 476 })}
477 477  
478   - {renderSelectItem(t('animationType'), {
  478 + {renderSelectItem(t('layout.setting.animationType'), {
479 479 handler: (e) => {
480 480 baseHandler(HandlerEnum.ROUTER_TRANSITION, e);
481 481 },
... ... @@ -519,26 +519,31 @@ export default defineComponent({
519 519 onChange={(e: any) => {
520 520 handler && handler(e);
521 521 }}
522   - checkedChildren={t('on')}
523   - unCheckedChildren={t('off')}
  522 + checkedChildren={t('layout.setting.on')}
  523 + unCheckedChildren={t('layout.setting.off')}
524 524 />
525 525 </div>
526 526 );
527 527 }
528 528  
529 529 return () => (
530   - <BasicDrawer {...attrs} title={t('drawerTitle')} width={330} wrapClassName="setting-drawer">
  530 + <BasicDrawer
  531 + {...attrs}
  532 + title={t('layout.setting.drawerTitle')}
  533 + width={330}
  534 + wrapClassName="setting-drawer"
  535 + >
531 536 {{
532 537 default: () => (
533 538 <>
534   - <Divider>{() => t('navMode')}</Divider>
  539 + <Divider>{() => t('layout.setting.navMode')}</Divider>
535 540 {renderSidebar()}
536 541 {renderTheme()}
537   - <Divider>{() => t('interfaceFunction')}</Divider>
  542 + <Divider>{() => t('layout.setting.interfaceFunction')}</Divider>
538 543 {renderFeatures()}
539   - <Divider>{() => t('interfaceDisplay')}</Divider>
  544 + <Divider>{() => t('layout.setting.interfaceDisplay')}</Divider>
540 545 {renderContent()}
541   - <Divider>{() => t('animation')}</Divider>
  546 + <Divider>{() => t('layout.setting.animation')}</Divider>
542 547 {renderTransition()}
543 548 <Divider />
544 549 <FooterButton />
... ...
src/layouts/default/setting/enum.ts
... ... @@ -6,7 +6,7 @@ import sidebarImg from &#39;/@/assets/images/layout/menu-sidebar.svg&#39;;
6 6 import menuTopImg from '/@/assets/images/layout/menu-top.svg';
7 7 import { useI18n } from '/@/hooks/web/useI18n';
8 8  
9   -const { t } = useI18n('layout.setting');
  9 +const { t } = useI18n();
10 10  
11 11 export enum HandlerEnum {
12 12 CHANGE_LAYOUT,
... ... @@ -51,41 +51,41 @@ export enum HandlerEnum {
51 51 export const contentModeOptions = [
52 52 {
53 53 value: ContentEnum.FULL,
54   - label: t('contentModeFull'),
  54 + label: t('layout.setting.contentModeFull'),
55 55 },
56 56 {
57 57 value: ContentEnum.FIXED,
58   - label: t('contentModeFixed'),
  58 + label: t('layout.setting.contentModeFixed'),
59 59 },
60 60 ];
61 61  
62 62 export const topMenuAlignOptions = [
63 63 {
64 64 value: TopMenuAlignEnum.CENTER,
65   - label: t('topMenuAlignRight'),
  65 + label: t('layout.setting.topMenuAlignRight'),
66 66 },
67 67 {
68 68 value: TopMenuAlignEnum.START,
69   - label: t('topMenuAlignLeft'),
  69 + label: t('layout.setting.topMenuAlignLeft'),
70 70 },
71 71 {
72 72 value: TopMenuAlignEnum.END,
73   - label: t('topMenuAlignCenter'),
  73 + label: t('layout.setting.topMenuAlignCenter'),
74 74 },
75 75 ];
76 76  
77 77 export const menuTriggerOptions = [
78 78 {
79 79 value: TriggerEnum.NONE,
80   - label: t('menuTriggerNone'),
  80 + label: t('layout.setting.menuTriggerNone'),
81 81 },
82 82 {
83 83 value: TriggerEnum.FOOTER,
84   - label: t('menuTriggerBottom'),
  84 + label: t('layout.setting.menuTriggerBottom'),
85 85 },
86 86 {
87 87 value: TriggerEnum.HEADER,
88   - label: t('menuTriggerTop'),
  88 + label: t('layout.setting.menuTriggerTop'),
89 89 },
90 90 ];
91 91  
... ... @@ -104,20 +104,20 @@ export const routerTransitionOptions = [
104 104  
105 105 export const menuTypeList = [
106 106 {
107   - title: t('menuTypeSidebar'),
  107 + title: t('layout.setting.menuTypeSidebar'),
108 108 mode: MenuModeEnum.INLINE,
109 109 type: MenuTypeEnum.SIDEBAR,
110 110 src: sidebarImg,
111 111 },
112 112 {
113   - title: t('menuTypeMix'),
  113 + title: t('layout.setting.menuTypeMix'),
114 114 mode: MenuModeEnum.INLINE,
115 115 type: MenuTypeEnum.MIX,
116 116 src: mixImg,
117 117 },
118 118  
119 119 {
120   - title: t('menuTypeTopMenu'),
  120 + title: t('layout.setting.menuTypeTopMenu'),
121 121 mode: MenuModeEnum.HORIZONTAL,
122 122 type: MenuTypeEnum.TOP_MENU,
123 123 src: menuTopImg,
... ...
src/store/modules/permission.ts
... ... @@ -22,7 +22,7 @@ import { useMessage } from &#39;/@/hooks/web/useMessage&#39;;
22 22 // import { warn } from '/@/utils/log';
23 23 import { useI18n } from '/@/hooks/web/useI18n';
24 24  
25   -const { t } = useI18n('sys.app');
  25 +const { t } = useI18n();
26 26  
27 27 const { createMessage } = useMessage();
28 28 const NAME = 'permission';
... ... @@ -104,7 +104,7 @@ class Permission extends VuexModule {
104 104 } else if (permissionMode === PermissionModeEnum.BACK) {
105 105 const messageKey = 'loadMenu';
106 106 createMessage.loading({
107   - content: t('menuLoading'),
  107 + content: t('sys.app.menuLoading'),
108 108 key: messageKey,
109 109 duration: 1,
110 110 });
... ...
src/store/modules/user.ts
... ... @@ -143,11 +143,11 @@ class User extends VuexModule {
143 143 @Action
144 144 async confirmLoginOut() {
145 145 const { createConfirm } = useMessage();
146   - const { t } = useI18n('sys.app');
  146 + const { t } = useI18n();
147 147 createConfirm({
148 148 iconType: 'warning',
149   - title: t('loginOutTip'),
150   - content: t('loginOutMessage'),
  149 + title: t('sys.app.loginOutTip'),
  150 + content: t('sys.app.loginOutMessage'),
151 151 onOk: async () => {
152 152 await this.loginOut(true);
153 153 },
... ...
src/utils/http/axios/checkStatus.ts
... ... @@ -5,7 +5,7 @@ const { createMessage } = useMessage();
5 5  
6 6 const error = createMessage.error!;
7 7 export function checkStatus(status: number, msg: string): void {
8   - const { t } = useI18n('sys.api');
  8 + const { t } = useI18n();
9 9 switch (status) {
10 10 case 400:
11 11 error(`${msg}`);
... ... @@ -14,39 +14,39 @@ export function checkStatus(status: number, msg: string): void {
14 14 // 未登录则跳转登录页面,并携带当前页面的路径
15 15 // 在登录成功后返回当前页面,这一步需要在登录页操作。
16 16 case 401:
17   - error(t('errMsg401'));
  17 + error(t('sys.api.errMsg401'));
18 18 userStore.loginOut(true);
19 19 break;
20 20 case 403:
21   - error(t('errMsg403'));
  21 + error(t('sys.api.errMsg403'));
22 22 break;
23 23 // 404请求不存在
24 24 case 404:
25   - error(t('errMsg404'));
  25 + error(t('sys.api.errMsg404'));
26 26 break;
27 27 case 405:
28   - error(t('errMsg405'));
  28 + error(t('sys.api.errMsg405'));
29 29 break;
30 30 case 408:
31   - error(t('errMsg408'));
  31 + error(t('sys.api.errMsg408'));
32 32 break;
33 33 case 500:
34   - error(t('errMsg500'));
  34 + error(t('sys.api.errMsg500'));
35 35 break;
36 36 case 501:
37   - error(t('errMsg501'));
  37 + error(t('sys.api.errMsg501'));
38 38 break;
39 39 case 502:
40   - error(t('errMsg502'));
  40 + error(t('sys.api.errMsg502'));
41 41 break;
42 42 case 503:
43   - error(t('errMsg503'));
  43 + error(t('sys.api.errMsg503'));
44 44 break;
45 45 case 504:
46   - error(t('errMsg504'));
  46 + error(t('sys.api.errMsg504'));
47 47 break;
48 48 case 505:
49   - error(t('errMsg505'));
  49 + error(t('sys.api.errMsg505'));
50 50 break;
51 51 default:
52 52 }
... ...
src/utils/http/axios/index.ts
... ... @@ -34,7 +34,7 @@ const transform: AxiosTransform = {
34 34 * @description: 处理请求数据
35 35 */
36 36 transformRequestData: (res: AxiosResponse<Result>, options: RequestOptions) => {
37   - const { t } = useI18n('sys.api');
  37 + const { t } = useI18n();
38 38 const { isTransformRequestResult } = options;
39 39 // 不进行任何处理,直接返回
40 40 // 用于页面代码可能需要直接获取code,data,message这些信息时开启
... ... @@ -57,7 +57,7 @@ const transform: AxiosTransform = {
57 57 if (message) {
58 58 // errorMessageMode=‘modal’的时候会显示modal错误弹窗,而不是消息提示,用于一些比较重要的错误
59 59 if (options.errorMessageMode === 'modal') {
60   - createErrorModal({ title: t('errorTip'), content: message });
  60 + createErrorModal({ title: t('sys.api.errorTip'), content: message });
61 61 } else {
62 62 createMessage.error(message);
63 63 }
... ... @@ -76,7 +76,7 @@ const transform: AxiosTransform = {
76 76 createMessage.error(data.message);
77 77 Promise.reject(new Error(message));
78 78 } else {
79   - const msg = t('errorMessage');
  79 + const msg = t('sys.api.errorMessage');
80 80 createMessage.error(msg);
81 81 Promise.reject(new Error(msg));
82 82 }
... ... @@ -84,9 +84,9 @@ const transform: AxiosTransform = {
84 84 }
85 85 // 登录超时
86 86 if (code === ResultEnum.TIMEOUT) {
87   - const timeoutMsg = t('timeoutMessage');
  87 + const timeoutMsg = t('sys.api.timeoutMessage');
88 88 createErrorModal({
89   - title: t('operationFailed'),
  89 + title: t('sys.api.operationFailed'),
90 90 content: timeoutMsg,
91 91 });
92 92 Promise.reject(new Error(timeoutMsg));
... ... @@ -154,7 +154,7 @@ const transform: AxiosTransform = {
154 154 * @description: 响应错误处理
155 155 */
156 156 responseInterceptorsCatch: (error: any) => {
157   - const { t } = useI18n('sys.api');
  157 + const { t } = useI18n();
158 158 errorStore.setupErrorHandle(error);
159 159 const { response, code, message } = error || {};
160 160 const msg: string =
... ... @@ -162,12 +162,12 @@ const transform: AxiosTransform = {
162 162 const err: string = error.toString();
163 163 try {
164 164 if (code === 'ECONNABORTED' && message.indexOf('timeout') !== -1) {
165   - createMessage.error(t('apiTimeoutMessage'));
  165 + createMessage.error(t('sys.api.apiTimeoutMessage'));
166 166 }
167 167 if (err && err.includes('Network Error')) {
168 168 createErrorModal({
169   - title: t('networkException'),
170   - content: t('networkExceptionMsg'),
  169 + title: t('sys.api.networkException'),
  170 + content: t('sys.api.networkExceptionMsg'),
171 171 });
172 172 }
173 173 } catch (error) {
... ...
src/views/sys/error-log/DetailModal.vue
1 1 <template>
2   - <BasicModal :width="800" :title="t('tableActionDesc')" v-bind="$attrs">
  2 + <BasicModal :width="800" :title="t('sys.errorLog.tableActionDesc')" v-bind="$attrs">
3 3 <Description :data="info" @register="register" />
4 4 </BasicModal>
5 5 </template>
... ... @@ -23,7 +23,7 @@
23 23 },
24 24 },
25 25 setup() {
26   - const { t } = useI18n('sys.errorLog');
  26 + const { t } = useI18n();
27 27 const [register] = useDescription({
28 28 column: 2,
29 29 schema: getDescSchema(),
... ...
src/views/sys/error-log/data.tsx
... ... @@ -3,13 +3,13 @@ import { BasicColumn } from &#39;/@/components/Table/index&#39;;
3 3 import { ErrorTypeEnum } from '/@/enums/exceptionEnum';
4 4 import { useI18n } from '/@/hooks/web/useI18n';
5 5  
6   -const { t } = useI18n('sys.errorLog');
  6 +const { t } = useI18n();
7 7  
8 8 export function getColumns(): BasicColumn[] {
9 9 return [
10 10 {
11 11 dataIndex: 'type',
12   - title: t('tableColumnType'),
  12 + title: t('sys.errorLog.tableColumnType'),
13 13 width: 80,
14 14 customRender: ({ text }) => {
15 15 const color =
... ... @@ -32,12 +32,12 @@ export function getColumns(): BasicColumn[] {
32 32 },
33 33 {
34 34 dataIndex: 'time',
35   - title: t('tableColumnDate'),
  35 + title: t('sys.errorLog.tableColumnDate'),
36 36 width: 160,
37 37 },
38 38 {
39 39 dataIndex: 'file',
40   - title: t('tableColumnFile'),
  40 + title: t('sys.errorLog.tableColumnFile'),
41 41 width: 200,
42 42 },
43 43 {
... ... @@ -47,12 +47,12 @@ export function getColumns(): BasicColumn[] {
47 47 },
48 48 {
49 49 dataIndex: 'message',
50   - title: t('tableColumnMsg'),
  50 + title: t('sys.errorLog.tableColumnMsg'),
51 51 width: 300,
52 52 },
53 53 {
54 54 dataIndex: 'stack',
55   - title: t('tableColumnStackMsg'),
  55 + title: t('sys.errorLog.tableColumnStackMsg'),
56 56 width: 300,
57 57 },
58 58 ];
... ...
src/views/sys/error-log/index.vue
... ... @@ -53,7 +53,7 @@
53 53 const rowInfoRef = ref<ErrorInfo>();
54 54 const imgListRef = ref<string[]>([]);
55 55  
56   - const { t } = useI18n('sys.errorLog');
  56 + const { t } = useI18n();
57 57  
58 58 const [register, { setTableData }] = useTable({
59 59 title: t('sys.errorLog.tableTitle'),
... ... @@ -80,7 +80,7 @@
80 80 );
81 81 const { createMessage } = useMessage();
82 82 if (isDevMode()) {
83   - createMessage.info(t('enableMessage'));
  83 + createMessage.info(t('sys.errorLog.enableMessage'));
84 84 }
85 85 // 查看详情
86 86 function handleDetail(row: ErrorInfo) {
... ...
src/views/sys/exception/Exception.tsx
... ... @@ -53,7 +53,7 @@ export default defineComponent({
53 53 const { query } = useRoute();
54 54 const go = useGo();
55 55 const redo = useRedo();
56   - const { t } = useI18n('sys.exception');
  56 + const { t } = useI18n();
57 57  
58 58 const getStatus = computed(() => {
59 59 const { status: routeStatus } = query;
... ... @@ -67,13 +67,13 @@ export default defineComponent({
67 67 }
68 68 );
69 69  
70   - const backLoginI18n = t('backLogin');
71   - const backHomeI18n = t('backHome');
  70 + const backLoginI18n = t('sys.exception.backLogin');
  71 + const backHomeI18n = t('sys.exception.backHome');
72 72  
73 73 unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_ACCESS, {
74 74 title: '403',
75 75 status: `${ExceptionEnum.PAGE_NOT_ACCESS}`,
76   - subTitle: t('subTitle403'),
  76 + subTitle: t('sys.exception.subTitle403'),
77 77 btnText: props.full ? backLoginI18n : backHomeI18n,
78 78 handler: () => (props.full ? go(PageEnum.BASE_LOGIN) : go()),
79 79 });
... ... @@ -81,7 +81,7 @@ export default defineComponent({
81 81 unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_FOUND, {
82 82 title: '404',
83 83 status: `${ExceptionEnum.PAGE_NOT_FOUND}`,
84   - subTitle: t('subTitle404'),
  84 + subTitle: t('sys.exception.subTitle404'),
85 85 btnText: props.full ? backLoginI18n : backHomeI18n,
86 86 handler: () => (props.full ? go(PageEnum.BASE_LOGIN) : go()),
87 87 });
... ... @@ -89,22 +89,22 @@ export default defineComponent({
89 89 unref(statusMapRef).set(ExceptionEnum.ERROR, {
90 90 title: '500',
91 91 status: `${ExceptionEnum.ERROR}`,
92   - subTitle: t('subTitle500'),
  92 + subTitle: t('sys.exception.subTitle500'),
93 93 btnText: backHomeI18n,
94 94 handler: () => go(),
95 95 });
96 96  
97 97 unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_DATA, {
98   - title: t('noDataTitle'),
  98 + title: t('sys.exception.noDataTitle'),
99 99 subTitle: '',
100   - btnText: t('redo'),
  100 + btnText: t('sys.exception.redo'),
101 101 handler: () => redo(),
102 102 icon: notDataImg,
103 103 });
104 104  
105 105 unref(statusMapRef).set(ExceptionEnum.NET_WORK_ERROR, {
106   - title: t('networkErrorTitle'),
107   - subTitle: t('networkErrorSubTitle'),
  106 + title: t('sys.exception.networkErrorTitle'),
  107 + subTitle: t('sys.exception.networkErrorSubTitle'),
108 108 btnText: 'Refresh',
109 109 handler: () => redo(),
110 110 icon: netWorkImg,
... ...
src/views/sys/lock/index.vue
... ... @@ -36,7 +36,7 @@
36 36 const loadingRef = ref(false);
37 37 const errMsgRef = ref(false);
38 38  
39   - const { t } = useI18n('sys.lock');
  39 + const { t } = useI18n();
40 40 const [register, { validateFields }] = useForm({
41 41 showActionButtonGroup: false,
42 42 schemas: [
... ... @@ -46,7 +46,7 @@
46 46 component: 'InputPassword',
47 47 componentProps: {
48 48 style: { width: '100%' },
49   - placeholder: t('placeholder'),
  49 + placeholder: t('sys.lock.placeholder'),
50 50 },
51 51 rules: [{ required: true }],
52 52 },
... ...
src/views/sys/login/Login.vue
... ... @@ -90,7 +90,7 @@
90 90 const globSetting = useGlobSetting();
91 91 const { locale } = useProjectSetting();
92 92 const { notification } = useMessage();
93   - const { t } = useI18n('sys.login');
  93 + const { t } = useI18n();
94 94  
95 95 // const openLoginVerifyRef = computed(() => appStore.getProjectConfig.openLoginVerify);
96 96  
... ... @@ -104,8 +104,10 @@
104 104 });
105 105  
106 106 const formRules = reactive({
107   - account: [{ required: true, message: t('accountPlaceholder'), trigger: 'blur' }],
108   - password: [{ required: true, message: t('passwordPlaceholder'), trigger: 'blur' }],
  107 + account: [{ required: true, message: t('sys.login.accountPlaceholder'), trigger: 'blur' }],
  108 + password: [
  109 + { required: true, message: t('sys.login.passwordPlaceholder'), trigger: 'blur' },
  110 + ],
109 111 // verify: unref(openLoginVerifyRef) ? [{ required: true, message: '请通过验证码校验' }] : [],
110 112 });
111 113  
... ... @@ -130,8 +132,8 @@
130 132 );
131 133 if (userInfo) {
132 134 notification.success({
133   - message: t('loginSuccessTitle'),
134   - description: `${t('loginSuccessDesc')}: ${userInfo.realName}`,
  135 + message: t('sys.login.loginSuccessTitle'),
  136 + description: `${t('sys.login.loginSuccessDesc')}: ${userInfo.realName}`,
135 137 duration: 3,
136 138 });
137 139 }
... ...