@@ -216,6 +216,7 @@ function deleteTempDirectory(tempPath) {
216216 catch { }
217217}
218218function loadTranslations ( locale , desc , workspaceRoot , loader , logger , usedFormats , duplicateTranslation ) {
219+ let translations = undefined ;
219220 for ( const file of desc . files ) {
220221 const loadResult = loader ( path_1 . default . join ( workspaceRoot , file . path ) ) ;
221222 for ( const diagnostics of loadResult . diagnostics . messages ) {
@@ -232,10 +233,10 @@ function loadTranslations(locale, desc, workspaceRoot, loader, logger, usedForma
232233 usedFormats === null || usedFormats === void 0 ? void 0 : usedFormats . add ( loadResult . format ) ;
233234 file . format = loadResult . format ;
234235 file . integrity = loadResult . integrity ;
235- if ( desc . translation ) {
236+ if ( translations ) {
236237 // Merge translations
237238 for ( const [ id , message ] of Object . entries ( loadResult . translations ) ) {
238- if ( desc . translation [ id ] !== undefined ) {
239+ if ( translations [ id ] !== undefined ) {
239240 const duplicateTranslationMessage = `[${ file . path } ]: Duplicate translations for message '${ id } ' when merging.` ;
240241 switch ( duplicateTranslation ) {
241242 case schema_1 . I18NTranslation . Ignore :
@@ -249,13 +250,14 @@ function loadTranslations(locale, desc, workspaceRoot, loader, logger, usedForma
249250 break ;
250251 }
251252 }
252- desc . translation [ id ] = message ;
253+ translations [ id ] = message ;
253254 }
254255 }
255256 else {
256257 // First or only translation file
257- desc . translation = loadResult . translations ;
258+ translations = loadResult . translations ;
258259 }
259260 }
261+ desc . translation = translations ;
260262}
261263exports . loadTranslations = loadTranslations ;
0 commit comments