From 2cd9fc04b0a17e16845e0abfc60d479a1cbfab98 Mon Sep 17 00:00:00 2001 From: Kevin Koech Date: Fri, 5 Jul 2024 12:43:50 +0300 Subject: [PATCH] Fix --- apps/charterafrica/.env | 1 + .../src/lib/data/common/processPageTools.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/charterafrica/.env b/apps/charterafrica/.env index af886893b..fe1e23b4a 100644 --- a/apps/charterafrica/.env +++ b/apps/charterafrica/.env @@ -6,3 +6,4 @@ PAYLOAD_PUBLIC_LOCALES="en, fr, pt" SENTRY_ENVIRONMENT=local SENTRY_ORG=code-for-africa SENTRY_PROJECT=charterafrica +NEXT_PUBLIC_DEFAULT_LOCALE=en diff --git a/apps/charterafrica/src/lib/data/common/processPageTools.js b/apps/charterafrica/src/lib/data/common/processPageTools.js index 16d3344ba..a784597f9 100644 --- a/apps/charterafrica/src/lib/data/common/processPageTools.js +++ b/apps/charterafrica/src/lib/data/common/processPageTools.js @@ -3,11 +3,22 @@ import { TOOL_COLLECTION, ORGANIZATION_COLLECTION, } from "@/charterafrica/payload/utils/collections"; -import { defaultLocale, locales } from "@/charterafrica/payload/utils/locales"; import queryString from "@/charterafrica/utils/ecosystem/queryString"; import formatDateTime from "@/charterafrica/utils/formatDate"; import labelsPerLocale from "@/charterafrica/utils/translationConstants"; +const locales = ( + process.env.NEXT_PUBLIC_LOCALES || process.env.PAYLOAD_PUBLIC_LOCALES +) + ?.split(",") + ?.map((l) => l.trim()) + .filter(Boolean); +const defaultLocale = + ( + process.env.NEXT_PUBLIC_DEFAULT_LOCALE || + process.env.PAYLOAD_PUBLIC_DEFAULT_LOCALE + )?.trim() || locales?.[0]; + const queryBuilder = (query) => { const { search, theme, homeCountry, classification } = query; const where = {};