Set locale cookie on alpha modal

This commit is contained in:
Riordan Panayides 2022-08-05 13:52:56 +01:00
parent 643f786cae
commit 145bc7dc97
1 changed files with 3 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import Checkbox from './Checkbox'
import { useRouter } from 'next/router'
import { LANGS } from './SettingsModal'
import { RadioGroup } from '@headlessui/react'
import dayjs from 'dayjs'
export const ALPHA_MODAL_KEY = 'mangoAlphaAccepted-3.06'
@ -34,7 +35,9 @@ const AlphaModal = ({
const handleLanguageSelect = () => {
setSavedLanguage(language)
document.cookie = `NEXT_LOCALE=${savedLanguage}; max-age=31536000; path=/`
router.push({ pathname, query }, asPath, { locale: language })
dayjs.locale(savedLanguage == 'zh_tw' ? 'zh-tw' : savedLanguage)
}
const handleGetStarted = () => {