Skip to content

Commit 218a687

Browse files
Merge pull request #20755 from Snuffleupagus/rm-unmaintained-locales
Automatically remove unmaintained locales when running `gulp importl10n`
2 parents e5656e4 + 24fe942 commit 218a687

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

external/importL10n/locales.mjs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async function downloadL10n(root) {
9191
await downloadLanguageFiles(root, langCode);
9292
}
9393

94-
const removeCodes = [];
94+
const rmCodes = [];
9595
for (const entry of fs.readdirSync(root)) {
9696
const dirPath = path.join(root, entry),
9797
stat = fs.lstatSync(dirPath);
@@ -101,14 +101,13 @@ async function downloadL10n(root) {
101101
entry !== DEFAULT_LOCALE &&
102102
!langCodes.includes(entry)
103103
) {
104-
removeCodes.push(entry);
104+
fs.rmSync(dirPath, { recursive: true, force: true });
105+
rmCodes.push(entry);
105106
}
106107
}
107-
if (removeCodes.length) {
108+
if (rmCodes.length) {
108109
console.log(
109-
"\nConsider removing the following unmaintained locales:\n" +
110-
removeCodes.join(", ") +
111-
"\n"
110+
`\nRemoved the following unmaintained locales: ${rmCodes.join(", ")}\n`
112111
);
113112
}
114113
}

0 commit comments

Comments
 (0)