fix: i18n runtime error (#1376)
This commit is contained in:
@@ -1,23 +1,26 @@
|
||||
'use client'
|
||||
|
||||
import type { FC } from 'react'
|
||||
import React from 'react'
|
||||
import '@/i18n/i18next-config'
|
||||
import React, { useEffect } from 'react'
|
||||
import { changeLanguage } from '@/i18n/i18next-config'
|
||||
import I18NContext from '@/context/i18n'
|
||||
import type { Locale } from '@/i18n'
|
||||
import { getLocaleOnClient, setLocaleOnClient } from '@/i18n/client'
|
||||
import { setLocaleOnClient } from '@/i18n/client'
|
||||
|
||||
export type II18nProps = {
|
||||
locale: Locale
|
||||
dictionary: Record<string, any>
|
||||
children: React.ReactNode
|
||||
setLocaleOnClient: (locale: Locale) => void
|
||||
}
|
||||
const I18n: FC<II18nProps> = ({
|
||||
locale,
|
||||
dictionary,
|
||||
children,
|
||||
}) => {
|
||||
const locale = getLocaleOnClient()
|
||||
useEffect(() => {
|
||||
changeLanguage(locale)
|
||||
}, [locale])
|
||||
|
||||
return (
|
||||
<I18NContext.Provider value={{
|
||||
locale,
|
||||
|
Reference in New Issue
Block a user