Skip to content

Commit 0b644af

Browse files
fix(i18n): download english trending for fallback (freeCodeCamp#48652)
* fix(i18n): download english trending for fallback Co-authored-by: Kristofer Koishigawa <[email protected]> * fix: prevent duplicate download for english Co-authored-by: Kristofer Koishigawa <[email protected]> Co-authored-by: Kristofer Koishigawa <[email protected]>
1 parent a6c4e39 commit 0b644af

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/scripts/build/download-trending.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const { clientLocale } = envData;
99
const createCdnUrl = (lang: string) =>
1010
`https://cdn.freecodecamp.org/universal/trending/${lang}.yaml`;
1111

12-
const download = async () => {
12+
const download = async (clientLocale: string) => {
1313
const url = createCdnUrl(clientLocale);
1414
const res = await fetch(url);
1515
if (!res.ok) {
@@ -44,4 +44,7 @@ const download = async () => {
4444
}
4545
};
4646

47-
void download();
47+
void download(clientLocale);
48+
// TODO: remove the need to fallback to english once we're confident it's
49+
// unnecessary (client/i18n/config.js will need all references to 'en' removing)
50+
if (clientLocale !== 'english') void download('english');

0 commit comments

Comments
 (0)