File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -40,13 +40,17 @@ function squeezeFromI18nBlock (content: string): LocaleMessages {
40
40
41
41
return desc . customBlocks . reduce ( ( messages , block ) => {
42
42
debug ( 'i18n block attrs' , block . attrs )
43
+
43
44
if ( block . type === 'i18n' ) {
44
- const lang = block . attrs . lang as string || 'json'
45
+ let lang = block . attrs . lang
46
+ lang = ( ! lang || typeof lang !== 'string' ) ? 'json' : lang
45
47
const obj = parseContent ( block . content , lang )
46
- if ( block . attrs . locale ) {
47
- return Object . assign ( messages , { [ block . attrs . locale as string ] : obj } )
48
- } else {
48
+
49
+ const locale = block . attrs . locale
50
+ if ( ! locale || typeof locale !== 'string' ) {
49
51
return Object . assign ( messages , obj )
52
+ } else {
53
+ return Object . assign ( messages , { [ locale ] : obj } )
50
54
}
51
55
} else {
52
56
return messages
You can’t perform that action at this time.
0 commit comments