This is an automated email from the ASF dual-hosted git repository. linkinstar pushed a commit to branch dev in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
commit 255f985cd498c521b2e4c6ec931d8fe15ec37f04 Author: hgaol <[email protected]> AuthorDate: Tue May 7 11:33:35 2024 +0800 add i18n --- i18n/en_US.yaml | 5 +++++ i18n/zh_CN.yaml | 5 +++++ ui/src/pages/Questions/Detail/components/Reactions/index.tsx | 8 ++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml index 58bc6c77..6442818d 100644 --- a/i18n/en_US.yaml +++ b/i18n/en_US.yaml @@ -765,6 +765,11 @@ ui: day: day hours: hours days: days + reaction: + heart: heart + smile: smile + frown: frown + tooltip: " and {{count}} more..." comment: btn_add_comment: Add comment reply_to: Reply to diff --git a/i18n/zh_CN.yaml b/i18n/zh_CN.yaml index a2459da5..56db05c2 100644 --- a/i18n/zh_CN.yaml +++ b/i18n/zh_CN.yaml @@ -747,6 +747,11 @@ ui: day: 天 hours: 小时 days: 日 + reaction: + heart: 爱心 + smile: 笑脸 + frown: 难过 + tooltip: " 以及另外 {{count}} 个..." comment: btn_add_comment: 添加评论 reply_to: 回复 diff --git a/ui/src/pages/Questions/Detail/components/Reactions/index.tsx b/ui/src/pages/Questions/Detail/components/Reactions/index.tsx index 5668682a..f7318dd8 100644 --- a/ui/src/pages/Questions/Detail/components/Reactions/index.tsx +++ b/ui/src/pages/Questions/Detail/components/Reactions/index.tsx @@ -36,7 +36,7 @@ const Index: FC<Props> = ({ handleClickComment, }) => { const [reactions, setReactions] = useState<Record<string, string[]>>(); - const { t } = useTranslation('translation', { keyPrefix: 'comment' }); + const { t } = useTranslation('translation'); useEffect(() => { queryReactions(objectId).then((res) => { @@ -64,7 +64,7 @@ const Index: FC<Props> = ({ } } if (names.length > 5) { - ret += ` and ${names.length - 5} more...`; + ret += t('reaction.tooltip', { count: names.length - 5 }); } return ret; }; @@ -95,7 +95,7 @@ const Index: FC<Props> = ({ size="sm" onClick={handleClickComment}> <Icon name="chat-text-fill" /> - <span className="ms-1">{t('btn_add_comment')}</span> + <span className="ms-1">{t('comment.btn_add_comment')}</span> </Button> )} @@ -120,7 +120,7 @@ const Index: FC<Props> = ({ overlay={ <Tooltip> <div className="text-start"> - <b>{emoji.name}</b> <br />{' '} + <b>{t(`reaction.${emoji.name}`)}</b> <br />{' '} {convertToTooltip(reactions[emoji.name])} </div> </Tooltip>
