Skip to content

Commit 00dbb0e

Browse files
committed
change BUILD_LOCALES env var to be public
1 parent 563a65b commit 00dbb0e

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ IS_PREVIEW_DEPLOY=false
2929
# Build pages only for the specified langs. Leave it empty to build all the langs
3030
# e.g. `en,fr` will only build English and French pages
3131
# Note: always include `en` as it is the default lang of the site
32-
BUILD_LOCALES=
32+
NEXT_PUBLIC_BUILD_LOCALES=
3333

3434
# If resource constraints are being hit during builds, change LIMIT_CPUS to a
3535
# fixed number of CPUs (e.g. 2) to limit the demand during build time

src/components/LanguagePicker/useLanguagePicker.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ import { useTranslation } from "@/hooks/useTranslation"
1616
export const useLanguagePicker = (handleClose?: () => void) => {
1717
const { t } = useTranslation("common")
1818
const locale = useLocale()
19-
const rawLocales = LOCALES_CODES
2019

2120
const languages = useMemo<LocaleDisplayInfo[]>(() => {
22-
const locales = filterRealLocales(rawLocales)
21+
const locales = filterRealLocales(LOCALES_CODES)
2322

2423
// Get the preferred languages for the users browser
2524
const navLangs = typeof navigator !== "undefined" ? navigator.languages : []
@@ -63,7 +62,7 @@ export const useLanguagePicker = (handleClose?: () => void) => {
6362
return b.approvalProgress - a.approvalProgress
6463
}) || []
6564
)
66-
}, [locale, rawLocales, t])
65+
}, [locale, t])
6766

6867
const { isOpen, setValue, ...menu } = useDisclosure()
6968

src/lib/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const NULL_VALUE = "—"
1919
export const DEFAULT_LOCALE = "en"
2020
export const FAKE_LOCALE = "default"
2121
// Sorted list of supported locales codes, defined in `i18n.config.json`
22-
const BUILD_LOCALES = process.env.BUILD_LOCALES
22+
const BUILD_LOCALES = process.env.NEXT_PUBLIC_BUILD_LOCALES
2323
export const LOCALES_CODES = BUILD_LOCALES
2424
? BUILD_LOCALES.split(",")
2525
: i18nConfig.map(({ code }) => code)

0 commit comments

Comments
 (0)