diff --git a/packages/angular/build/src/builders/application/i18n.ts b/packages/angular/build/src/builders/application/i18n.ts index ae37efa674e4..081be50e7a9f 100644 --- a/packages/angular/build/src/builders/application/i18n.ts +++ b/packages/angular/build/src/builders/application/i18n.ts @@ -123,48 +123,48 @@ export async function inlineI18n( inlineResult.prerenderedRoutes = { ...inlineResult.prerenderedRoutes, ...generatedRoutes }; updatedOutputFiles.push(...localeOutputFiles); } - } finally { - await inliner.close(); - } - // Update the result with all localized files. - executionResult.outputFiles = [ - // Root and SSR entry files are not modified. - ...unModifiedOutputFiles, - // Updated files for each locale. - ...updatedOutputFiles, - ]; - - // Assets are only changed if not using the flat output option - if (!i18nOptions.flatOutput) { - executionResult.assetFiles = updatedAssetFiles; - } - - // Inline any template updates if present - if (executionResult.templateUpdates?.size) { - // The development server only allows a single locale but issue a warning if used programmatically (experimental) - // with multiple locales and template HMR. - if (i18nOptions.inlineLocales.size > 1) { - inlineResult.warnings.push( - `Component HMR updates can only be inlined with a single locale. The first locale will be used.`, - ); + // Update the result with all localized files. + executionResult.outputFiles = [ + // Root and SSR entry files are not modified. + ...unModifiedOutputFiles, + // Updated files for each locale. + ...updatedOutputFiles, + ]; + + // Assets are only changed if not using the flat output option + if (!i18nOptions.flatOutput) { + executionResult.assetFiles = updatedAssetFiles; } - const firstLocale = [...i18nOptions.inlineLocales][0]; - - for (const [id, content] of executionResult.templateUpdates) { - const templateUpdateResult = await inliner.inlineTemplateUpdate( - firstLocale, - i18nOptions.locales[firstLocale].translation, - content, - id, - ); - executionResult.templateUpdates.set(id, templateUpdateResult.code); - inlineResult.errors.push(...templateUpdateResult.errors); - inlineResult.warnings.push(...templateUpdateResult.warnings); + + // Inline any template updates if present + if (executionResult.templateUpdates?.size) { + // The development server only allows a single locale but issue a warning if used programmatically (experimental) + // with multiple locales and template HMR. + if (i18nOptions.inlineLocales.size > 1) { + inlineResult.warnings.push( + `Component HMR updates can only be inlined with a single locale. The first locale will be used.`, + ); + } + const firstLocale = [...i18nOptions.inlineLocales][0]; + + for (const [id, content] of executionResult.templateUpdates) { + const templateUpdateResult = await inliner.inlineTemplateUpdate( + firstLocale, + i18nOptions.locales[firstLocale].translation, + content, + id, + ); + executionResult.templateUpdates.set(id, templateUpdateResult.code); + inlineResult.errors.push(...templateUpdateResult.errors); + inlineResult.warnings.push(...templateUpdateResult.warnings); + } } - } - return inlineResult; + return inlineResult; + } finally { + await inliner.close(); + } } /**