Skip to content

Commit

Permalink
Merge pull request #22 from BKWLD/improve-ssg-translation-loading
Browse files Browse the repository at this point in the history
Improve SSG translation loading
  • Loading branch information
weotch authored Jun 11, 2024
2 parents 28724a8 + bf69240 commit 56b0694
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/fetch-translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default async function({ i18n, $craft, $config }, localeCode) {

// If JSON files are generated and this is being invoked on the client, use
// those JSON files.
if ($config.cloak.i18n.generateJson && process.client) {
if ($config.cloak.i18n.generateJson && process.client && process.static) {
try {
const generateDir = $config._app.basePath || "/";
const response = await fetch(`${generateDir}i18n/${localeCode}.json`);
Expand All @@ -18,7 +18,7 @@ export default async function({ i18n, $craft, $config }, localeCode) {

// If not found, fallback to the CMS
} catch (e) {
console.error(e);
console.error("Couldn't load translations", e);
}
}

Expand Down

0 comments on commit 56b0694

Please sign in to comment.