@@ -202,40 +202,46 @@ export async function configureI18nBuild<T extends BrowserBuilderSchema | Server
202202 const loader = await createTranslationLoader ( ) ;
203203 const usedFormats = new Set < string > ( ) ;
204204 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+ }
217208
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+ }
225217
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 ) ) ;
229223
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 } ` ,
234228 ) ;
235229 } else {
236- desc . dataPath = localeDataPath ;
230+ context . logger . warn ( `WARNING [ ${ desc . file } ]: ${ diagnostics . message } ` ) ;
237231 }
238232 }
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 ;
239245 }
240246
241247 // Legacy message id's require the format of the translations
0 commit comments