fix: i18n
This commit is contained in:
parent
9025e85ca5
commit
21b3703bd8
@ -10,6 +10,7 @@ import Description from './base/description'
|
|||||||
import Placeholder from './base/placeholder'
|
import Placeholder from './base/placeholder'
|
||||||
import cn from '@/utils/classnames'
|
import cn from '@/utils/classnames'
|
||||||
import { useGetLanguage } from '@/context/i18n'
|
import { useGetLanguage } from '@/context/i18n'
|
||||||
|
import { getLanguage } from '@/i18n/language'
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
className?: string
|
className?: string
|
||||||
@ -39,7 +40,7 @@ const Card = ({
|
|||||||
locale: localeFromProps,
|
locale: localeFromProps,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const defaultLocale = useGetLanguage()
|
const defaultLocale = useGetLanguage()
|
||||||
const locale = localeFromProps || defaultLocale
|
const locale = localeFromProps ? getLanguage(localeFromProps) : defaultLocale
|
||||||
|
|
||||||
const { type, name, org, label, brief, icon, verified } = payload
|
const { type, name, org, label, brief, icon, verified } = payload
|
||||||
|
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
import { useTranslation as translate } from '@/i18n/server'
|
import {
|
||||||
|
getLocaleOnServer,
|
||||||
|
useTranslation as translate,
|
||||||
|
} from '@/i18n/server'
|
||||||
|
|
||||||
type DescriptionProps = {
|
type DescriptionProps = {
|
||||||
locale?: string
|
locale?: string
|
||||||
}
|
}
|
||||||
const Description = async ({
|
const Description = async ({
|
||||||
locale = 'en-US',
|
locale: localeFromProps,
|
||||||
}: DescriptionProps) => {
|
}: DescriptionProps) => {
|
||||||
const { t } = await translate(locale, 'plugin')
|
const localeDefault = getLocaleOnServer()
|
||||||
|
const { t } = await translate(localeFromProps || localeDefault, 'plugin')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
Loading…
Reference in New Issue
Block a user