feat: support vscode i18n-ally plugin

This commit is contained in:
vben
2020-12-01 23:51:39 +08:00
parent 41a4b827a2
commit 962f90de44
39 changed files with 263 additions and 259 deletions

View File

@@ -9,7 +9,7 @@ import { getSlot } from '/@/utils/helper/tsxHelper';
import { useI18n } from '/@/hooks/web/useI18n';
import { propTypes } from '/@/utils/propTypes';
const { t } = useI18n('component.form');
const { t } = useI18n();
export default defineComponent({
name: 'BasicFormAction',
@@ -38,14 +38,14 @@ export default defineComponent({
setup(props, { slots, emit }) {
const getResetBtnOptionsRef = computed(() => {
return {
text: t('resetButton'),
text: t('component.form.resetButton'),
...props.resetButtonOptions,
};
});
const getSubmitBtnOptionsRef = computed(() => {
return {
text: t('submitButton'),
text: t('component.form.submitButton'),
// htmlType: 'submit',
...props.submitButtonOptions,
};
@@ -77,7 +77,7 @@ export default defineComponent({
<Button type="default" class="mr-2" onClick={toggleAdvanced}>
{() => (
<>
{isAdvanced ? t('putAway') : t('unfold')}
{isAdvanced ? t('component.form.putAway') : t('component.form.unfold')}
<BasicArrow expand={!isAdvanced} top />
</>
)}

View File

@@ -47,7 +47,7 @@ export default defineComponent({
},
},
setup(props, { slots }) {
const { t } = useI18n('component.form');
const { t } = useI18n();
// @ts-ignore
const itemLabelWidthRef = useItemLabelWidth(toRef(props, 'schema'), toRef(props, 'formProps'));
@@ -175,7 +175,7 @@ export default defineComponent({
const characterInx = rules.findIndex((val) => val.max);
if (characterInx !== -1 && !rules[characterInx].validator) {
rules[characterInx].message =
rules[characterInx].message || t('maxTip', [rules[characterInx].max]);
rules[characterInx].message || t('component.form.maxTip', [rules[characterInx].max]);
}
return rules;
}

View File

@@ -1,17 +1,17 @@
import type { ComponentType } from './types/index';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n('component.form');
const { t } = useI18n();
/**
* @description: 生成placeholder
*/
export function createPlaceholderMessage(component: ComponentType) {
if (component.includes('Input') || component.includes('Complete')) {
return t('input');
return t('component.form.input');
}
if (component.includes('Picker')) {
return t('choose');
return t('component.form.choose');
}
if (
component.includes('Select') ||
@@ -21,7 +21,7 @@ export function createPlaceholderMessage(component: ComponentType) {
component.includes('Switch')
) {
// return `请选择${label}`;
return t('choose');
return t('component.form.choose');
}
return '';
}