Skip to content

Commit

Permalink
return fresh (including user defined) translations when cache is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmannmartin committed Dec 15, 2023
1 parent a1ed3c0 commit 205491b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
7 changes: 0 additions & 7 deletions storefront/i18n-translator.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export async function getLocalTranslates(locale, namespace) {
let localTranslates = (await import(`./public/locales/${locale}/${namespace}.json`)).default;

return fillEmptyTranslatesWithKeys(localTranslates);
}

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export async function getFreshTranslates(locale, namespace) {
const [localTranslatesResponse, userTranslatesResponse] = await Promise.all([
Expand Down
2 changes: 1 addition & 1 deletion storefront/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ module.exports = {
}
}

return (await import('./i18n-translator')).getLocalTranslates(locale, namespace);
return (await import('./i18n-translator')).getFreshTranslates(locale, namespace);
},
};

0 comments on commit 205491b

Please sign in to comment.