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