Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 38 additions & 38 deletions packages/angular/build/src/builders/application/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

/**
Expand Down
Loading