Skip to content

Commit d4f2e97

Browse files
committed
fix: modal api method i18n not work, close #6438
1 parent be90b53 commit d4f2e97

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

components/config-provider/index.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { App, Plugin, WatchStopHandle } from 'vue';
2-
import { computed, reactive, defineComponent, watchEffect } from 'vue';
2+
import { watch, computed, reactive, defineComponent, watchEffect } from 'vue';
33
import defaultRenderEmpty from './renderEmpty';
44
import type { RenderEmptyHandler } from './renderEmpty';
55
import type { Locale } from '../locale-provider';
@@ -157,6 +157,13 @@ const ConfigProvider = defineComponent({
157157
() => props.autoInsertSpaceInButton ?? parentContext.autoInsertSpaceInButton?.value,
158158
);
159159
const locale = computed(() => props.locale || parentContext.locale?.value);
160+
watch(
161+
locale,
162+
() => {
163+
globalConfigBySet.locale = locale.value;
164+
},
165+
{ immediate: true },
166+
);
160167
const direction = computed(() => props.direction || parentContext.direction?.value);
161168
const space = computed(() => props.space ?? parentContext.space?.value);
162169
const virtual = computed(() => props.virtual ?? parentContext.virtual?.value);

components/locale/index.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { App, VNode, PropType } from 'vue';
22
import { provide, defineComponent, reactive, watch } from 'vue';
33
import type { ModalLocale } from '../modal/locale';
4+
import { changeConfirmLocale } from '../modal/locale';
45
import warning from '../_util/warning';
56
import { withInstall } from '../_util/type';
67
import type { ValidateMessages } from '../form/interface';
@@ -81,9 +82,10 @@ const LocaleProvider = defineComponent({
8182
provide('localeData', state);
8283
watch(
8384
() => props.locale,
84-
() => {
85+
locale => {
86+
changeConfirmLocale(locale && locale.Modal);
8587
state.antLocale = {
86-
...props.locale,
88+
...locale,
8789
exist: true,
8890
} as any;
8991
},

0 commit comments

Comments
 (0)