@@ -137,32 +137,36 @@ async function configureI18nBuild(context, options) {
137
137
const loader = await load_translations_1 . createTranslationLoader ( ) ;
138
138
const usedFormats = new Set ( ) ;
139
139
for ( const [ locale , desc ] of Object . entries ( i18n . locales ) ) {
140
- if ( i18n . inlineLocales . has ( locale ) && desc . file ) {
141
- const result = loader ( path . join ( context . workspaceRoot , desc . file ) ) ;
142
- for ( const diagnostics of result . diagnostics . messages ) {
143
- if ( diagnostics . type === 'error' ) {
144
- throw new Error ( `Error parsing translation file '${ desc . file } ': ${ diagnostics . message } ` ) ;
145
- }
146
- else {
147
- context . logger . warn ( `WARNING [${ desc . file } ]: ${ diagnostics . message } ` ) ;
148
- }
149
- }
150
- usedFormats . add ( result . format ) ;
151
- if ( usedFormats . size > 1 && tsConfig . options . enableI18nLegacyMessageIdFormat !== false ) {
152
- // This limitation is only for legacy message id support (defaults to true as of 9.0)
153
- throw new Error ( 'Localization currently only supports using one type of translation file format for the entire application.' ) ;
154
- }
155
- desc . format = result . format ;
156
- desc . translation = result . translation ;
157
- desc . integrity = result . integrity ;
158
- const localeDataPath = findLocaleDataPath ( locale , localeDataBasePath ) ;
159
- if ( ! localeDataPath ) {
160
- context . logger . warn ( `Locale data for '${ locale } ' cannot be found. No locale data will be included for this locale.` ) ;
140
+ if ( ! i18n . inlineLocales . has ( locale ) ) {
141
+ continue ;
142
+ }
143
+ const localeDataPath = findLocaleDataPath ( locale , localeDataBasePath ) ;
144
+ if ( ! localeDataPath ) {
145
+ context . logger . warn ( `Locale data for '${ locale } ' cannot be found. No locale data will be included for this locale.` ) ;
146
+ }
147
+ else {
148
+ desc . dataPath = localeDataPath ;
149
+ }
150
+ if ( ! desc . file ) {
151
+ continue ;
152
+ }
153
+ const result = loader ( path . join ( context . workspaceRoot , desc . file ) ) ;
154
+ for ( const diagnostics of result . diagnostics . messages ) {
155
+ if ( diagnostics . type === 'error' ) {
156
+ throw new Error ( `Error parsing translation file '${ desc . file } ': ${ diagnostics . message } ` ) ;
161
157
}
162
158
else {
163
- desc . dataPath = localeDataPath ;
159
+ context . logger . warn ( `WARNING [ ${ desc . file } ]: ${ diagnostics . message } ` ) ;
164
160
}
165
161
}
162
+ usedFormats . add ( result . format ) ;
163
+ if ( usedFormats . size > 1 && tsConfig . options . enableI18nLegacyMessageIdFormat !== false ) {
164
+ // This limitation is only for legacy message id support (defaults to true as of 9.0)
165
+ throw new Error ( 'Localization currently only supports using one type of translation file format for the entire application.' ) ;
166
+ }
167
+ desc . format = result . format ;
168
+ desc . translation = result . translation ;
169
+ desc . integrity = result . integrity ;
166
170
}
167
171
// Legacy message id's require the format of the translations
168
172
if ( usedFormats . size > 0 ) {
0 commit comments