Skip to content

Commit

Permalink
Merge pull request #445 from cofacts/unify-reply-type-title
Browse files Browse the repository at this point in the history
Unify all occurrences of "Reference" to depend on reply type
  • Loading branch information
MrOrz committed Aug 25, 2021
2 parents 07c6a23 + 6064b1a commit 712af7c
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 40 deletions.
14 changes: 7 additions & 7 deletions components/ArticleReply/ArticleReply.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { makeStyles } from '@material-ui/core/styles';

import { nl2br, linkify } from 'lib/text';
import getTermsString from 'lib/terms';
import { TYPE_NAME } from 'constants/replyType';
import { TYPE_NAME, TYPE_REFERENCE_TITLE } from 'constants/replyType';
import ExpandableText from 'components/ExpandableText';
import ArticleReplyFeedbackControl from 'components/ArticleReplyFeedbackControl';
import ArticleReplySummary from 'components/ArticleReplySummary';
Expand Down Expand Up @@ -103,10 +103,12 @@ const ArticleReply = React.memo(
`【${t`Reason`}${(reply.text || '').trim()}\n` +
`↓${t`Details`}↓\n` +
`${articleUrl}\n` +
`↓${t`Reference`}↓\n` +
`${reply.reference}\n` +
(TYPE_REFERENCE_TITLE[reply.type]
? `↓${TYPE_REFERENCE_TITLE[reply.type]}↓\n` +
`${reply.reference}\n`
: '') +
`--\n` +
`ℹ️ ${getTermsString('此資訊')}\n`
`ℹ️ ${getTermsString(/* t: terms subject */ t`This info`)}\n`
: '';

return (
Expand All @@ -128,9 +130,7 @@ const ArticleReply = React.memo(
const reference = reply.reference;
return (
<section className={classes.root}>
<h3>
{replyType === 'OPINIONATED' ? t`Different opinion` : t`Reference`}
</h3>
<h3>{TYPE_REFERENCE_TITLE[replyType]}</h3>
{reference
? nl2br(linkify(reference))
: `⚠️️ ${t`There is no reference for this reply. Its truthfulness may be doubtful.`}`}
Expand Down
3 changes: 2 additions & 1 deletion components/NewReplySection/Mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Avatar from 'components/AppLayout/Widgets/Avatar';
import { TypeSelect, ReasonEditor, Submit } from './ReplyForm';
import ReplyFormContext from './ReplyForm/context';
import { nl2br, linkify } from 'lib/text';
import { TYPE_REFERENCE_TITLE } from 'constants/replyType';

import ReferenceInput from './ReplyForm/ReferenceInput';
import ReplySearch from './ReplySearch';
Expand Down Expand Up @@ -170,7 +171,7 @@ export default function Mobile({
<CustomTab label={c('Mobile editor tab').t`Message`} />
<CustomTab label={c('Mobile editor tab').t`Compose`} />
{replyType !== 'NOT_ARTICLE' && (
<CustomTab label={c('Mobile editor tab').t`References`} />
<CustomTab label={TYPE_REFERENCE_TITLE[replyType]} />
)}
</Tabs>
<Box display="flex" flexDirection="column" flexGrow={1}>
Expand Down
11 changes: 2 additions & 9 deletions components/NewReplySection/ReplyForm/ReferenceInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { t } from 'ttag';
import { Box } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import { EDITOR_REFERENCE } from 'constants/urls';
import { TYPE_REFERENCE_TITLE } from 'constants/replyType';
import Hint from './Hint';

const useStyles = makeStyles(theme => ({
Expand Down Expand Up @@ -58,15 +59,7 @@ const ReferenceInput = ({ replyType, value, onChange }) => {
justifyContent={{ xs: 'center', md: 'space-between' }}
>
<label className={classes.label} htmlFor="reference">
<strong>
{(() => {
if (replyType === 'OPINIONATED') {
return t`Opinion Sources`;
} else {
return t`References`;
}
})()}
</strong>
<strong>{TYPE_REFERENCE_TITLE[replyType]}</strong>
</label>
<Hint>{t`Inserting blank lines between reference items can improve readability in LINE.`}</Hint>
</Box>
Expand Down
6 changes: 6 additions & 0 deletions constants/replyType.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,9 @@ export const TYPE_SUGGESTION_OPTIONS = {
},
],
};

export const TYPE_REFERENCE_TITLE = {
OPINIONATED: t`Opinion Sources`,
RUMOR: t`References`,
NOT_RUMOR: t`References`,
};
40 changes: 18 additions & 22 deletions i18n/zh_TW.po
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ msgid "Cofacts"
msgstr "Cofacts 真的假的"

#: components/ArticleCategories/DownVoteDialog.js:98
#: components/NewReplySection/Mobile.js:138
#: components/NewReplySection/Mobile.js:139
#: components/ProfilePage/EditAvatarDialog.js:236
#: components/ProfilePage/EditProfileDialog.js:93
msgid "Cancel"
Expand Down Expand Up @@ -81,8 +81,6 @@ msgstr "理由"
msgid "Details"
msgstr "詳細解釋"

#: components/ArticleReply/ArticleReply.js:106
#: components/ArticleReply/ArticleReply.js:132
#: pages/api/articles/[feed].js:178
#. https://stackoverflow.com/a/54905457/1582110
msgid "Reference"
Expand All @@ -93,10 +91,6 @@ msgstr "出處"
msgid "Someone"
msgstr "有人"

#: components/ArticleReply/ArticleReply.js:132
msgid "Different opinion"
msgstr "不同意見"

#: components/ArticleReply/ArticleReply.js:136
msgid "There is no reference for this reply. Its truthfulness may be doubtful."
msgstr "這則回應沒有出處,請自行斟酌其真實性。"
Expand Down Expand Up @@ -547,7 +541,7 @@ msgid "Related messages and replies"
msgstr "相關可疑訊息及回應"

#: components/NewReplySection/Desktop.js:124
#: components/NewReplySection/Mobile.js:233
#: components/NewReplySection/Mobile.js:234
msgid "Use this reply"
msgstr "直接用此回應"

Expand All @@ -567,7 +561,7 @@ msgstr "全部回應"
msgid "My replies"
msgstr "我的回應"

#: components/NewReplySection/ReplyForm/ReferenceInput.js:71
#: components/NewReplySection/ReplyForm/ReferenceInput.js:64
msgid ""
"Inserting blank lines between reference items can improve readability in "
"LINE."
Expand Down Expand Up @@ -657,12 +651,12 @@ msgid "Mark"
msgstr "新增標註"

#: components/NewReplySection/Desktop.js:69
#: components/NewReplySection/Mobile.js:148
#: components/NewReplySection/Mobile.js:149
msgid "Compose a new reply"
msgstr "撰寫新回應"

#: components/NewReplySection/Desktop.js:73
#: components/NewReplySection/Mobile.js:151
#: components/NewReplySection/Mobile.js:152
msgid "Use existing replies"
msgstr "使用現有回應"

Expand Down Expand Up @@ -982,15 +976,16 @@ msgstr ""
msgid "Earn ${ pointsLeft } EXP to next level"
msgstr ""

#: components/NewReplySection/ReplyForm/ReferenceInput.js:64
#: constants/replyType.js:117
msgid "Opinion Sources"
msgstr "不同意見出處"

#: components/NewReplySection/ReplyForm/ReferenceInput.js:66
#: constants/replyType.js:118
#: constants/replyType.js:119
msgid "References"
msgstr "資料佐證"

#: components/NewReplySection/ReplyForm/ReferenceInput.js:50
#: components/NewReplySection/ReplyForm/ReferenceInput.js:51
msgid ""
"One line summary\n"
"» Source URL"
Expand Down Expand Up @@ -1045,7 +1040,7 @@ msgstr "CC授權 姓名標示-相同方式分享 4.0"
#: components/AppLayout/AppFooter.js:114
#: components/AppLayout/LoginModal.js:94
msgid "User Agreement"
msgstr ""
msgstr "使用者條款"

#: components/AppLayout/LoginModal.js:152
#, javascript-format
Expand Down Expand Up @@ -2372,6 +2367,12 @@ msgstr "出處內容"
msgid "In linked text"
msgstr "所附網址的網頁內容"

#: components/ArticleReply/ArticleReply.js:111
#: pages/article/[id].js:238
#. t: terms subject
msgid "This info"
msgstr "此資訊"

#: pages/index.js:29
msgctxt "site title"
msgid "Cofacts"
Expand Down Expand Up @@ -2410,21 +2411,16 @@ msgctxt "impact"
msgid "More"
msgstr "了解更多"

#: components/NewReplySection/Mobile.js:170
#: components/NewReplySection/Mobile.js:171
msgctxt "Mobile editor tab"
msgid "Message"
msgstr "原始文章"

#: components/NewReplySection/Mobile.js:171
#: components/NewReplySection/Mobile.js:172
msgctxt "Mobile editor tab"
msgid "Compose"
msgstr "撰寫回應"

#: components/NewReplySection/Mobile.js:173
msgctxt "Mobile editor tab"
msgid "References"
msgstr "資料來源"

#: components/ListPageDisplays/ArticleCard.js:113
msgctxt "Info box"
msgid "replies"
Expand Down
2 changes: 1 addition & 1 deletion pages/article/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ function ArticlePage() {
'text/plain',
selection.toString() +
`\n📋 節錄自 Cofacts 真的假的:${articleUrl}` +
`\nℹ️ ${getTermsString('此資訊')}`
`\nℹ️ ${getTermsString(/* t: terms subject */ t`This info`)}`
);
e.preventDefault();
}, []);
Expand Down

0 comments on commit 712af7c

Please sign in to comment.