Skip to content

Commit 372e88b

Browse files
authored
Merge pull request #1057 from yassinesos/fix/i18n-translation-issues
fix(native-federation): fix i18n translation for lazy chunks and Windows #1055
2 parents 8972940 + 443b0da commit 372e88b

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

  • libs/native-federation/src/utils

libs/native-federation/src/utils/i18n.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,18 @@ export async function translateFederationArtefacts(
7878

7979
const translationOutPath = path.join(outputPath, 'browser', '{{LOCALE}}');
8080

81-
const federationFiles = [
82-
...federationResult.shared.map((s) => s.outFileName),
83-
...federationResult.exposes.map((e) => e.outFileName),
84-
];
85-
86-
// Here, we use a glob with an exhaustive list i/o `"*.js"`
87-
// to improve performance
88-
const sourcePattern = '{' + federationFiles.join(',') + '}';
81+
// Use *.js to translate ALL JS files, including lazy-loaded chunks
82+
// that may contain $localize markers from exposed modules
83+
const sourcePattern = '*.js';
8984

9085
const sourceLocalePath = path.join(outputPath, 'browser', sourceLocale);
9186

9287
const localizeTranslate = path.resolve(
9388
'node_modules/.bin/localize-translate',
9489
);
9590

96-
const cmd = `${localizeTranslate} -r ${sourceLocalePath} -s "${sourcePattern}" -t ${translationFiles} -o ${translationOutPath} --target-locales ${targetLocales} -l ${sourceLocale}`;
91+
// Quote paths to handle spaces (Windows compatibility)
92+
const cmd = `"${localizeTranslate}" -r "${sourceLocalePath}" -s "${sourcePattern}" -t ${translationFiles} -o "${translationOutPath}" --target-locales ${targetLocales} -l ${sourceLocale}`;
9793

9894
ensureDistFolders(locales, outputPath);
9995
copyRemoteEntry(locales, outputPath, sourceLocalePath);

0 commit comments

Comments
 (0)