File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -91,9 +91,18 @@ async function getTranslation (id: _IdInfo, locale: string): Promise<IntlString
91
91
if ( messages instanceof Status ) {
92
92
return messages
93
93
}
94
- return id . kind !== undefined
95
- ? ( messages [ id . kind ] as Record < string , IntlString > ) ?. [ id . name ]
96
- : ( messages [ id . name ] as IntlString )
94
+ if ( id . kind !== undefined ) {
95
+ if ( ( messages [ id . kind ] as Record < string , IntlString > ) ?. [ id . name ] !== undefined ) {
96
+ return ( messages [ id . kind ] as Record < string , IntlString > ) ?. [ id . name ]
97
+ } else {
98
+ const englishMessages = await loadTranslationsForComponent ( id . component , ENGLISH_LOCALE )
99
+ if ( ! ( englishMessages instanceof Status ) ) {
100
+ return ( englishMessages [ id . kind ] as Record < string , IntlString > ) ?. [ id . name ]
101
+ }
102
+ }
103
+ } else {
104
+ return messages [ id . name ] as IntlString
105
+ }
97
106
} catch ( err ) {
98
107
const status = unknownError ( err )
99
108
await setPlatformStatus ( status )
You can’t perform that action at this time.
0 commit comments