Unverified Commit 4db01403 authored by crazywoola's avatar crazywoola Committed by GitHub

feat: add missing i18n (#130)

parent d8425f3f
'use client' 'use client'
import React from 'react'
import { useState, FC, ChangeEvent } from 'react'
import data from '@emoji-mart/data' import data from '@emoji-mart/data'
import { init, SearchIndex } from 'emoji-mart' import { init, SearchIndex } from 'emoji-mart'
// import AppIcon from '@/app/components/base/app-icon'
import cn from 'classnames' import cn from 'classnames'
import Divider from '@/app/components/base/divider' import Divider from '@/app/components/base/divider'
import Button from '@/app/components/base/button' import Button from '@/app/components/base/button'
import s from './style.module.css' import s from './style.module.css'
import { useState, FC, ChangeEvent } from 'react'
import { import {
MagnifyingGlassIcon MagnifyingGlassIcon
} from '@heroicons/react/24/outline' } from '@heroicons/react/24/outline'
import React from 'react'
import Modal from '@/app/components/base/modal' import Modal from '@/app/components/base/modal'
import { useTranslation } from 'react-i18next'
declare global { declare global {
namespace JSX { namespace JSX {
...@@ -69,6 +69,7 @@ const EmojiPicker: FC<IEmojiPickerProps> = ({ ...@@ -69,6 +69,7 @@ const EmojiPicker: FC<IEmojiPickerProps> = ({
onClose onClose
}) => { }) => {
const { t } = useTranslation()
const { categories } = data as any const { categories } = data as any
const [selectedEmoji, setSelectedEmoji] = useState('') const [selectedEmoji, setSelectedEmoji] = useState('')
const [selectedBackground, setSelectedBackground] = useState(backgroundColors[0]) const [selectedBackground, setSelectedBackground] = useState(backgroundColors[0])
...@@ -187,7 +188,7 @@ const EmojiPicker: FC<IEmojiPickerProps> = ({ ...@@ -187,7 +188,7 @@ const EmojiPicker: FC<IEmojiPickerProps> = ({
<Button type="default" className='w-full' onClick={() => { <Button type="default" className='w-full' onClick={() => {
onClose && onClose() onClose && onClose()
}}> }}>
Cancel {t('app.emoji.cancel')}
</Button> </Button>
<Button <Button
disabled={selectedEmoji == ''} disabled={selectedEmoji == ''}
...@@ -196,7 +197,7 @@ const EmojiPicker: FC<IEmojiPickerProps> = ({ ...@@ -196,7 +197,7 @@ const EmojiPicker: FC<IEmojiPickerProps> = ({
onClick={() => { onClick={() => {
onSelect && onSelect(selectedEmoji, selectedBackground) onSelect && onSelect(selectedEmoji, selectedBackground)
}}> }}>
OK {t('app.emoji.ok')}
</Button> </Button>
</div> </div>
</Modal> : <> </Modal> : <>
......
...@@ -35,6 +35,10 @@ const translation = { ...@@ -35,6 +35,10 @@ const translation = {
appCreated: 'App created', appCreated: 'App created',
appCreateFailed: 'Failed to create app', appCreateFailed: 'Failed to create app',
}, },
emoji: {
ok: 'OK',
cancel: 'Cancel',
}
} }
export default translation export default translation
...@@ -34,6 +34,10 @@ const translation = { ...@@ -34,6 +34,10 @@ const translation = {
appCreated: '应用已创建', appCreated: '应用已创建',
appCreateFailed: '应用创建失败', appCreateFailed: '应用创建失败',
}, },
emoji: {
ok: '确认',
cancel: '取消',
}
} }
export default translation export default translation
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment