File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
packages/vue-i18n-core/src Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,10 @@ export const I18nErrorCodes = {
34
34
BRIDGE_SUPPORT_VUE_2_ONLY : inc ( ) , // 26
35
35
// need to define `i18n` option in `allowComposition: true` and `useScope: 'local' at `useI18n``
36
36
MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION : inc ( ) , // 27
37
+ // Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly
38
+ NOT_AVAILABLE_COMPOSITION_IN_LEGACY : inc ( ) , // 28
37
39
// for enhancement
38
- __EXTEND_POINT__ : inc ( ) // 27
40
+ __EXTEND_POINT__ : inc ( ) // 29
39
41
} as const
40
42
41
43
type I18nErrorCodes = typeof I18nErrorCodes [ keyof typeof I18nErrorCodes ]
@@ -69,5 +71,7 @@ export const errorMessages: { [code: number]: string } = {
69
71
[ I18nErrorCodes . BRIDGE_SUPPORT_VUE_2_ONLY ] :
70
72
'vue-i18n-bridge support Vue 2.x only' ,
71
73
[ I18nErrorCodes . MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION ] :
72
- 'Must define ‘i18n’ option in Composition API with using local scope in Legacy API mode'
74
+ 'Must define ‘i18n’ option in Composition API with using local scope in Legacy API mode' ,
75
+ [ I18nErrorCodes . NOT_AVAILABLE_COMPOSITION_IN_LEGACY ] :
76
+ 'Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly'
73
77
}
Original file line number Diff line number Diff line change @@ -1481,8 +1481,11 @@ function useI18nForLegacy(
1481
1481
}
1482
1482
1483
1483
onBeforeMount ( ( ) => {
1484
+ if ( instance . proxy == null || instance . proxy . $i18n == null ) {
1485
+ throw createI18nError ( I18nErrorCodes . NOT_AVAILABLE_COMPOSITION_IN_LEGACY )
1486
+ }
1484
1487
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1485
- const composer = ( _composer . value = ( instance . proxy ? .$i18n as any )
1488
+ const composer = ( _composer . value = ( instance . proxy . $i18n as any )
1486
1489
. __composer as Composer )
1487
1490
if ( scope === 'global' ) {
1488
1491
_locale . value = composer . locale . value
You can’t perform that action at this time.
0 commit comments