mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(i18n): download english trending for fallback (#48652)
* fix(i18n): download english trending for fallback Co-authored-by: Kristofer Koishigawa <scissorsneedfoodtoo@gmail.com> * fix: prevent duplicate download for english Co-authored-by: Kristofer Koishigawa <scissorsneedfoodtoo@gmail.com> Co-authored-by: Kristofer Koishigawa <scissorsneedfoodtoo@gmail.com>
This commit is contained in:
committed by
GitHub
parent
a6c4e39dc1
commit
0b644afb0e
@@ -9,7 +9,7 @@ const { clientLocale } = envData;
|
||||
const createCdnUrl = (lang: string) =>
|
||||
`https://cdn.freecodecamp.org/universal/trending/${lang}.yaml`;
|
||||
|
||||
const download = async () => {
|
||||
const download = async (clientLocale: string) => {
|
||||
const url = createCdnUrl(clientLocale);
|
||||
const res = await fetch(url);
|
||||
if (!res.ok) {
|
||||
@@ -44,4 +44,7 @@ const download = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
void download();
|
||||
void download(clientLocale);
|
||||
// TODO: remove the need to fallback to english once we're confident it's
|
||||
// unnecessary (client/i18n/config.js will need all references to 'en' removing)
|
||||
if (clientLocale !== 'english') void download('english');
|
||||
|
||||
Reference in New Issue
Block a user