Skip to content

Commit 24fe942

Browse files
committed
Automatically remove unmaintained locales when running gulp importl10n
It's not particularly common for locales to be removed from Firefox, but it has happened occasionally in the past. Currently the `downloadL10n` function logs a message about any unmaintained locales, but after PR 20749 that code is running in GitHub Actions (rather than locally by a contributor) which makes it much less likely for the message to be seen.
1 parent e5656e4 commit 24fe942

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

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)