added mail service
This commit is contained in:
26
components/TranslateClientFragment.tsx
Normal file
26
components/TranslateClientFragment.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { useI18n } from '@/locales/client'
|
||||
|
||||
type Props = {
|
||||
message: string
|
||||
}
|
||||
|
||||
const _ = (message: string): string => {
|
||||
const t = useI18n()
|
||||
if (message.startsWith('["')) {
|
||||
const data = JSON.parse(message)
|
||||
if (data.length > 1) {
|
||||
message = data.shift()
|
||||
// @ts-ignore
|
||||
return t(message, ...data)
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
return t(message)
|
||||
}
|
||||
|
||||
const TranslateClientFragment = ({ message }: Props) => {
|
||||
return <>{_(message)}</>
|
||||
}
|
||||
|
||||
export default TranslateClientFragment
|
||||
Reference in New Issue
Block a user