@@ -202,40 +202,46 @@ export async function configureI18nBuild<T extends BrowserBuilderSchema | Server
202
202
const loader = await createTranslationLoader ( ) ;
203
203
const usedFormats = new Set < string > ( ) ;
204
204
for ( const [ locale , desc ] of Object . entries ( i18n . locales ) ) {
205
- if ( i18n . inlineLocales . has ( locale ) && desc . file ) {
206
- const result = loader ( path . join ( context . workspaceRoot , desc . file ) ) ;
207
-
208
- for ( const diagnostics of result . diagnostics . messages ) {
209
- if ( diagnostics . type === 'error' ) {
210
- throw new Error (
211
- `Error parsing translation file '${ desc . file } ': ${ diagnostics . message } ` ,
212
- ) ;
213
- } else {
214
- context . logger . warn ( `WARNING [${ desc . file } ]: ${ diagnostics . message } ` ) ;
215
- }
216
- }
205
+ if ( ! i18n . inlineLocales . has ( locale ) ) {
206
+ continue ;
207
+ }
217
208
218
- usedFormats . add ( result . format ) ;
219
- if ( usedFormats . size > 1 && tsConfig . options . enableI18nLegacyMessageIdFormat !== false ) {
220
- // This limitation is only for legacy message id support (defaults to true as of 9.0)
221
- throw new Error (
222
- 'Localization currently only supports using one type of translation file format for the entire application.' ,
223
- ) ;
224
- }
209
+ const localeDataPath = findLocaleDataPath ( locale , localeDataBasePath ) ;
210
+ if ( ! localeDataPath ) {
211
+ context . logger . warn (
212
+ `Locale data for '${ locale } ' cannot be found. No locale data will be included for this locale.` ,
213
+ ) ;
214
+ } else {
215
+ desc . dataPath = localeDataPath ;
216
+ }
225
217
226
- desc . format = result . format ;
227
- desc . translation = result . translation ;
228
- desc . integrity = result . integrity ;
218
+ if ( ! desc . file ) {
219
+ continue ;
220
+ }
221
+
222
+ const result = loader ( path . join ( context . workspaceRoot , desc . file ) ) ;
229
223
230
- const localeDataPath = findLocaleDataPath ( locale , localeDataBasePath ) ;
231
- if ( ! localeDataPath ) {
232
- context . logger . warn (
233
- `Locale data for '${ locale } ' cannot be found. No locale data will be included for this locale. ` ,
224
+ for ( const diagnostics of result . diagnostics . messages ) {
225
+ if ( diagnostics . type === 'error' ) {
226
+ throw new Error (
227
+ `Error parsing translation file '${ desc . file } ': ${ diagnostics . message } ` ,
234
228
) ;
235
229
} else {
236
- desc . dataPath = localeDataPath ;
230
+ context . logger . warn ( `WARNING [ ${ desc . file } ]: ${ diagnostics . message } ` ) ;
237
231
}
238
232
}
233
+
234
+ usedFormats . add ( result . format ) ;
235
+ if ( usedFormats . size > 1 && tsConfig . options . enableI18nLegacyMessageIdFormat !== false ) {
236
+ // This limitation is only for legacy message id support (defaults to true as of 9.0)
237
+ throw new Error (
238
+ 'Localization currently only supports using one type of translation file format for the entire application.' ,
239
+ ) ;
240
+ }
241
+
242
+ desc . format = result . format ;
243
+ desc . translation = result . translation ;
244
+ desc . integrity = result . integrity ;
239
245
}
240
246
241
247
// Legacy message id's require the format of the translations
0 commit comments