Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

add i18n

hgaol255f985cd498
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>