Skip to content

Commit

Permalink
add i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
hgaol committed May 7, 2024
1 parent 5bf8dc8 commit 25db06d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions i18n/en_US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions i18n/zh_CN.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,11 @@ ui:
day:
hours: 小时
days:
reaction:
heart: 爱心
smile: 笑脸
frown: 难过
tooltip: " 以及另外 {{count}} 个..."
comment:
btn_add_comment: 添加评论
reply_to: 回复
Expand Down
8 changes: 4 additions & 4 deletions ui/src/pages/Questions/Detail/components/Reactions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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;
};
Expand Down Expand Up @@ -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>
)}

Expand All @@ -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>
Expand Down

0 comments on commit 25db06d

Please sign in to comment.