File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
packages/vue-i18n-core/src Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { isArray , isObject , hasOwn , isPlainObject } from '@intlify/shared'
2
+ import {
3
+ isArray ,
4
+ isObject ,
5
+ hasOwn ,
6
+ isPlainObject ,
7
+ isString
8
+ } from '@intlify/shared'
3
9
import { I18nErrorCodes , createI18nError } from './errors'
4
10
5
11
import type { Locale , MessageResolver } from '@intlify/core-base'
@@ -83,12 +89,17 @@ export function getLocaleMessages<Messages = {}>(
83
89
84
90
// merge locale messages of i18n custom block
85
91
if ( isArray ( __i18n ) ) {
86
- __i18n . forEach ( ( { locale, resource } ) => {
87
- if ( locale ) {
88
- ret [ locale ] = ret [ locale ] || { }
89
- deepCopy ( resource , ret [ locale ] )
92
+ __i18n . forEach ( custom => {
93
+ if ( 'locale' in custom && 'resource' in custom ) {
94
+ const { locale, resource } = custom
95
+ if ( locale ) {
96
+ ret [ locale ] = ret [ locale ] || { }
97
+ deepCopy ( resource , ret [ locale ] )
98
+ } else {
99
+ deepCopy ( resource , ret )
100
+ }
90
101
} else {
91
- deepCopy ( resource , ret )
102
+ isString ( custom ) && deepCopy ( JSON . parse ( custom ) , ret )
92
103
}
93
104
} )
94
105
}
You can’t perform that action at this time.
0 commit comments