Improve translation.

This commit is contained in:
Gucheng Wang 2021-12-28 21:43:45 +08:00
parent 045d8d298e
commit 4747f60ce3
15 changed files with 102 additions and 250 deletions

View File

@ -35,4 +35,5 @@ func TestGenerateI18nStrings(t *testing.T) {
applyToOtherLanguage(dataEn, "ru") applyToOtherLanguage(dataEn, "ru")
applyToOtherLanguage(dataEn, "zh") applyToOtherLanguage(dataEn, "zh")
applyToOtherLanguage(dataEn, "zh-TW") applyToOtherLanguage(dataEn, "zh-TW")
applyToOtherLanguage(dataEn, "kk")
} }

View File

@ -224,6 +224,7 @@
"Total Replies": "Total Replies", "Total Replies": "Total Replies",
"Total Topics": "Total Topics", "Total Topics": "Total Topics",
"Watch": "Watch", "Watch": "Watch",
"You have signed out completely, no personal information is left on this computer.": "You have signed out completely, no personal information is left on this computer.",
"authorized to manage the community": "authorized to manage the community", "authorized to manage the community": "authorized to manage the community",
"member, joined on": "member, joined on", "member, joined on": "member, joined on",
"replied": "replied" "replied": "replied"
@ -250,16 +251,14 @@
"Already enabled Markdown": "Already enabled Markdown", "Already enabled Markdown": "Already enabled Markdown",
"Body": "Body", "Body": "Body",
"Hottest Nodes": "Hottest Nodes", "Hottest Nodes": "Hottest Nodes",
"MarkDown": "MarkDown", "Markdown": "Markdown",
"New Topic": "New Topic", "New Topic": "New Topic",
"Please select a node": "Please select a node", "Please select a node": "Please select a node",
"Preview": "Preview", "Preview": "Preview",
"Publish": "Publish", "Publish": "Publish",
"RichText": "RichText", "RichText": "RichText",
"Switch editor": "Switch editor", "Switch editor": "Switch editor",
"Topic Title": "Topic Title", "Topic Title": "Topic Title"
"markdown": "MarkDown",
"richtext": "RichText"
}, },
"newNodeTopic": { "newNodeTopic": {
"Preview": "Preview", "Preview": "Preview",
@ -384,6 +383,7 @@
"reply": { "reply": {
"Add a New Comment": "Add a New Comment", "Add a New Comment": "Add a New Comment",
"Back to Top": "Back to Top", "Back to Top": "Back to Top",
"Cancel reply to {username}": "Cancel reply to {username}",
"Delete": "Delete", "Delete": "Delete",
"Edit": "Edit", "Edit": "Edit",
"Make your comment helpful for others as much as possible": "Make your comment helpful for others as much as possible", "Make your comment helpful for others as much as possible": "Make your comment helpful for others as much as possible",

View File

@ -224,6 +224,7 @@
"Total Replies": "Total Replies", "Total Replies": "Total Replies",
"Total Topics": "Total Topics", "Total Topics": "Total Topics",
"Watch": "Watch", "Watch": "Watch",
"You have signed out completely, no personal information is left on this computer.": "You have signed out completely, no personal information is left on this computer.",
"authorized to manage the community": "authorized to manage the community", "authorized to manage the community": "authorized to manage the community",
"member, joined on": "member, joined on", "member, joined on": "member, joined on",
"replied": "replied" "replied": "replied"
@ -250,16 +251,14 @@
"Already enabled Markdown": "Already enabled Markdown", "Already enabled Markdown": "Already enabled Markdown",
"Body": "Body", "Body": "Body",
"Hottest Nodes": "Hottest Nodes", "Hottest Nodes": "Hottest Nodes",
"MarkDown": "MarkDown", "Markdown": "Markdown",
"New Topic": "New Topic", "New Topic": "New Topic",
"Please select a node": "Please select a node", "Please select a node": "Please select a node",
"Preview": "Preview", "Preview": "Preview",
"Publish": "Publish", "Publish": "Publish",
"RichText": "RichText", "RichText": "RichText",
"Switch editor": "Switch editor", "Switch editor": "Switch editor",
"Topic Title": "Topic Title", "Topic Title": "Topic Title"
"markdown": "markdown",
"richtext": "richtext"
}, },
"newNodeTopic": { "newNodeTopic": {
"Preview": "Preview", "Preview": "Preview",
@ -384,6 +383,7 @@
"reply": { "reply": {
"Add a New Comment": "Add a New Comment", "Add a New Comment": "Add a New Comment",
"Back to Top": "Back to Top", "Back to Top": "Back to Top",
"Cancel reply to {username}": "Cancel reply to {username}",
"Delete": "Delete", "Delete": "Delete",
"Edit": "Edit", "Edit": "Edit",
"Make your comment helpful for others as much as possible": "Make your comment helpful for others as much as possible", "Make your comment helpful for others as much as possible": "Make your comment helpful for others as much as possible",

View File

@ -224,6 +224,7 @@
"Total Replies": "Total Replies", "Total Replies": "Total Replies",
"Total Topics": "Total Topics", "Total Topics": "Total Topics",
"Watch": "Watch", "Watch": "Watch",
"You have signed out completely, no personal information is left on this computer.": "You have signed out completely, no personal information is left on this computer.",
"authorized to manage the community": "authorized to manage the community", "authorized to manage the community": "authorized to manage the community",
"member, joined on": "member, joined on", "member, joined on": "member, joined on",
"replied": "replied" "replied": "replied"
@ -250,16 +251,14 @@
"Already enabled Markdown": "Already enabled Markdown", "Already enabled Markdown": "Already enabled Markdown",
"Body": "Body", "Body": "Body",
"Hottest Nodes": "Hottest Nodes", "Hottest Nodes": "Hottest Nodes",
"MarkDown": "MarkDown", "Markdown": "Markdown",
"New Topic": "New Topic", "New Topic": "New Topic",
"Please select a node": "Please select a node", "Please select a node": "Please select a node",
"Preview": "Preview", "Preview": "Preview",
"Publish": "Publish", "Publish": "Publish",
"RichText": "RichText", "RichText": "RichText",
"Switch editor": "Switch editor", "Switch editor": "Switch editor",
"Topic Title": "Topic Title", "Topic Title": "Topic Title"
"markdown": "MarkDown",
"richtext": "RichText"
}, },
"newNodeTopic": { "newNodeTopic": {
"Preview": "Preview", "Preview": "Preview",
@ -384,6 +383,7 @@
"reply": { "reply": {
"Add a New Comment": "Add a New Comment", "Add a New Comment": "Add a New Comment",
"Back to Top": "Back to Top", "Back to Top": "Back to Top",
"Cancel reply to {username}": "Cancel reply to {username}",
"Delete": "Delete", "Delete": "Delete",
"Edit": "Edit", "Edit": "Edit",
"Make your comment helpful for others as much as possible": "Make your comment helpful for others as much as possible", "Make your comment helpful for others as much as possible": "Make your comment helpful for others as much as possible",

View File

@ -224,6 +224,7 @@
"Total Replies": "Total Replies", "Total Replies": "Total Replies",
"Total Topics": "Total Topics", "Total Topics": "Total Topics",
"Watch": "Watch", "Watch": "Watch",
"You have signed out completely, no personal information is left on this computer.": "You have signed out completely, no personal information is left on this computer.",
"authorized to manage the community": "authorized to manage the community", "authorized to manage the community": "authorized to manage the community",
"member, joined on": "member, joined on", "member, joined on": "member, joined on",
"replied": "replied" "replied": "replied"
@ -250,16 +251,14 @@
"Already enabled Markdown": "Already enabled Markdown", "Already enabled Markdown": "Already enabled Markdown",
"Body": "Body", "Body": "Body",
"Hottest Nodes": "Hottest Nodes", "Hottest Nodes": "Hottest Nodes",
"MarkDown": "MarkDown", "Markdown": "Markdown",
"New Topic": "New Topic", "New Topic": "New Topic",
"Please select a node": "Please select a node", "Please select a node": "Please select a node",
"Preview": "Preview", "Preview": "Preview",
"Publish": "Publish", "Publish": "Publish",
"RichText": "RichText", "RichText": "RichText",
"Switch editor": "Switch editor", "Switch editor": "Switch editor",
"Topic Title": "Topic Title", "Topic Title": "Topic Title"
"markdown": "MarkDown",
"richtext": "RichText"
}, },
"newNodeTopic": { "newNodeTopic": {
"Preview": "Preview", "Preview": "Preview",
@ -384,6 +383,7 @@
"reply": { "reply": {
"Add a New Comment": "Add a New Comment", "Add a New Comment": "Add a New Comment",
"Back to Top": "Back to Top", "Back to Top": "Back to Top",
"Cancel reply to {username}": "Cancel reply to {username}",
"Delete": "Delete", "Delete": "Delete",
"Edit": "Edit", "Edit": "Edit",
"Make your comment helpful for others as much as possible": "Make your comment helpful for others as much as possible", "Make your comment helpful for others as much as possible": "Make your comment helpful for others as much as possible",

View File

@ -224,6 +224,7 @@
"Total Replies": "Total Replies", "Total Replies": "Total Replies",
"Total Topics": "Total Topics", "Total Topics": "Total Topics",
"Watch": "Watch", "Watch": "Watch",
"You have signed out completely, no personal information is left on this computer.": "You have signed out completely, no personal information is left on this computer.",
"authorized to manage the community": "authorized to manage the community", "authorized to manage the community": "authorized to manage the community",
"member, joined on": "member, joined on", "member, joined on": "member, joined on",
"replied": "replied" "replied": "replied"
@ -250,16 +251,14 @@
"Already enabled Markdown": "Already enabled Markdown", "Already enabled Markdown": "Already enabled Markdown",
"Body": "Body", "Body": "Body",
"Hottest Nodes": "Hottest Nodes", "Hottest Nodes": "Hottest Nodes",
"MarkDown": "MarkDown", "Markdown": "Markdown",
"New Topic": "New Topic", "New Topic": "New Topic",
"Please select a node": "Please select a node", "Please select a node": "Please select a node",
"Preview": "Preview", "Preview": "Preview",
"Publish": "Publish", "Publish": "Publish",
"RichText": "RichText", "RichText": "RichText",
"Switch editor": "Switch editor", "Switch editor": "Switch editor",
"Topic Title": "Topic Title", "Topic Title": "Topic Title"
"markdown": "markdown",
"richtext": "richtext"
}, },
"newNodeTopic": { "newNodeTopic": {
"Preview": "Preview", "Preview": "Preview",
@ -384,6 +383,7 @@
"reply": { "reply": {
"Add a New Comment": "Add a New Comment", "Add a New Comment": "Add a New Comment",
"Back to Top": "Back to Top", "Back to Top": "Back to Top",
"Cancel reply to {username}": "Cancel reply to {username}",
"Delete": "Delete", "Delete": "Delete",
"Edit": "Edit", "Edit": "Edit",
"Make your comment helpful for others as much as possible": "Make your comment helpful for others as much as possible", "Make your comment helpful for others as much as possible": "Make your comment helpful for others as much as possible",

View File

@ -224,6 +224,7 @@
"Total Replies": "Total Replies", "Total Replies": "Total Replies",
"Total Topics": "Total Topics", "Total Topics": "Total Topics",
"Watch": "Watch", "Watch": "Watch",
"You have signed out completely, no personal information is left on this computer.": "You have signed out completely, no personal information is left on this computer.",
"authorized to manage the community": "authorized to manage the community", "authorized to manage the community": "authorized to manage the community",
"member, joined on": "member, joined on", "member, joined on": "member, joined on",
"replied": "replied" "replied": "replied"
@ -250,16 +251,14 @@
"Already enabled Markdown": "Already enabled Markdown", "Already enabled Markdown": "Already enabled Markdown",
"Body": "Body", "Body": "Body",
"Hottest Nodes": "Hottest Nodes", "Hottest Nodes": "Hottest Nodes",
"MarkDown": "MarkDown", "Markdown": "Markdown",
"New Topic": "New Topic", "New Topic": "New Topic",
"Please select a node": "Please select a node", "Please select a node": "Please select a node",
"Preview": "Preview", "Preview": "Preview",
"Publish": "Publish", "Publish": "Publish",
"RichText": "RichText", "RichText": "RichText",
"Switch editor": "Switch editor", "Switch editor": "Switch editor",
"Topic Title": "Topic Title", "Topic Title": "Topic Title"
"markdown": "MarkDown",
"richtext": "RichText"
}, },
"newNodeTopic": { "newNodeTopic": {
"Preview": "Preview", "Preview": "Preview",
@ -384,6 +383,7 @@
"reply": { "reply": {
"Add a New Comment": "Add a New Comment", "Add a New Comment": "Add a New Comment",
"Back to Top": "Back to Top", "Back to Top": "Back to Top",
"Cancel reply to {username}": "Cancel reply to {username}",
"Delete": "Delete", "Delete": "Delete",
"Edit": "Edit", "Edit": "Edit",
"Make your comment helpful for others as much as possible": "Make your comment helpful for others as much as possible", "Make your comment helpful for others as much as possible": "Make your comment helpful for others as much as possible",

View File

@ -224,6 +224,7 @@
"Total Replies": "Total Replies", "Total Replies": "Total Replies",
"Total Topics": "Total Topics", "Total Topics": "Total Topics",
"Watch": "Watch", "Watch": "Watch",
"You have signed out completely, no personal information is left on this computer.": "You have signed out completely, no personal information is left on this computer.",
"authorized to manage the community": "authorized to manage the community", "authorized to manage the community": "authorized to manage the community",
"member, joined on": "member, joined on", "member, joined on": "member, joined on",
"replied": "replied" "replied": "replied"
@ -250,16 +251,14 @@
"Already enabled Markdown": "Already enabled Markdown", "Already enabled Markdown": "Already enabled Markdown",
"Body": "Body", "Body": "Body",
"Hottest Nodes": "Hottest Nodes", "Hottest Nodes": "Hottest Nodes",
"MarkDown": "MarkDown", "Markdown": "Markdown",
"New Topic": "New Topic", "New Topic": "New Topic",
"Please select a node": "Please select a node", "Please select a node": "Please select a node",
"Preview": "Preview", "Preview": "Preview",
"Publish": "Publish", "Publish": "Publish",
"RichText": "RichText", "RichText": "RichText",
"Switch editor": "Switch editor", "Switch editor": "Switch editor",
"Topic Title": "Topic Title", "Topic Title": "Topic Title"
"markdown": "MarkDown",
"richtext": "RichText"
}, },
"newNodeTopic": { "newNodeTopic": {
"Preview": "Preview", "Preview": "Preview",
@ -384,6 +383,7 @@
"reply": { "reply": {
"Add a New Comment": "Add a New Comment", "Add a New Comment": "Add a New Comment",
"Back to Top": "Back to Top", "Back to Top": "Back to Top",
"Cancel reply to {username}": "Cancel reply to {username}",
"Delete": "Delete", "Delete": "Delete",
"Edit": "Edit", "Edit": "Edit",
"Make your comment helpful for others as much as possible": "Make your comment helpful for others as much as possible", "Make your comment helpful for others as much as possible": "Make your comment helpful for others as much as possible",

View File

@ -224,6 +224,7 @@
"Total Replies": "回復總數", "Total Replies": "回復總數",
"Total Topics": "主題總數", "Total Topics": "主題總數",
"Watch": "加入特別關註", "Watch": "加入特別關註",
"You have signed out completely, no personal information is left on this computer.": "你已經完全登出,沒有任何個人信息留在這臺電腦上。",
"authorized to manage the community": "具有管理社區的權限", "authorized to manage the community": "具有管理社區的權限",
"member, joined on": "號會員,加入於", "member, joined on": "號會員,加入於",
"replied": "回復了" "replied": "回復了"
@ -250,16 +251,14 @@
"Already enabled Markdown": "已啟用Markdown", "Already enabled Markdown": "已啟用Markdown",
"Body": "正文", "Body": "正文",
"Hottest Nodes": "最熱節點", "Hottest Nodes": "最熱節點",
"MarkDown": "MarkDown", "Markdown": "Markdown",
"New Topic": "創作新主題", "New Topic": "創作新主題",
"Please select a node": "請選擇一個節點", "Please select a node": "請選擇一個節點",
"Preview": "預覽主題", "Preview": "預覽主題",
"Publish": "發布主題", "Publish": "發布主題",
"RichText": "富文本", "RichText": "富文本",
"Switch editor": "切換編輯器", "Switch editor": "切換編輯器",
"Topic Title": "主題標題", "Topic Title": "主題標題"
"markdown": "Markdown",
"richtext": "富文本"
}, },
"newNodeTopic": { "newNodeTopic": {
"Preview": "預覽", "Preview": "預覽",
@ -384,6 +383,7 @@
"reply": { "reply": {
"Add a New Comment": "添加一條新回復", "Add a New Comment": "添加一條新回復",
"Back to Top": "回到頂部", "Back to Top": "回到頂部",
"Cancel reply to {username}": "取消對 {username} 的回復",
"Delete": "刪除", "Delete": "刪除",
"Edit": "編輯", "Edit": "編輯",
"Make your comment helpful for others as much as possible": "請盡量讓自己的回復能夠對別人有幫助", "Make your comment helpful for others as much as possible": "請盡量讓自己的回復能夠對別人有幫助",

View File

@ -224,6 +224,7 @@
"Total Replies": "回复总数", "Total Replies": "回复总数",
"Total Topics": "主题总数", "Total Topics": "主题总数",
"Watch": "加入特别关注", "Watch": "加入特别关注",
"You have signed out completely, no personal information is left on this computer.": "你已经完全登出,没有任何个人信息留在这台电脑上。",
"authorized to manage the community": "具有管理社区的权限", "authorized to manage the community": "具有管理社区的权限",
"member, joined on": "号会员,加入于", "member, joined on": "号会员,加入于",
"replied": "回复了" "replied": "回复了"
@ -250,16 +251,14 @@
"Already enabled Markdown": "已启用Markdown", "Already enabled Markdown": "已启用Markdown",
"Body": "正文", "Body": "正文",
"Hottest Nodes": "最热节点", "Hottest Nodes": "最热节点",
"MarkDown": "MarkDown", "Markdown": "Markdown",
"New Topic": "创作新主题", "New Topic": "创作新主题",
"Please select a node": "请选择一个节点", "Please select a node": "请选择一个节点",
"Preview": "预览主题", "Preview": "预览主题",
"Publish": "发布主题", "Publish": "发布主题",
"RichText": "富文本", "RichText": "富文本",
"Switch editor": "切换编辑器", "Switch editor": "切换编辑器",
"Topic Title": "主题标题", "Topic Title": "主题标题"
"markdown": "Markdown",
"richtext": "富文本"
}, },
"newNodeTopic": { "newNodeTopic": {
"Preview": "预览", "Preview": "预览",
@ -384,6 +383,7 @@
"reply": { "reply": {
"Add a New Comment": "添加一条新回复", "Add a New Comment": "添加一条新回复",
"Back to Top": "回到顶部", "Back to Top": "回到顶部",
"Cancel reply to {username}": "取消对 {username} 的回复",
"Delete": "删除", "Delete": "删除",
"Edit": "编辑", "Edit": "编辑",
"Make your comment helpful for others as much as possible": "请尽量让自己的回复能够对别人有帮助", "Make your comment helpful for others as much as possible": "请尽量让自己的回复能够对别人有帮助",

View File

@ -41,11 +41,11 @@ class EditBox extends React.Component {
form: {}, form: {},
editor: [ editor: [
{ {
text: i18next.t("new:markdown"), text: i18next.t("new:Markdown"),
id: 0, id: 0,
}, },
{ {
text: i18next.t("new:richtext"), text: i18next.t("new:RichText"),
id: 1, id: 1,
}, },
], ],
@ -99,9 +99,7 @@ class EditBox extends React.Component {
// reply // reply
ReplyBackend.editReplyContent(this.state.form).then((res) => { ReplyBackend.editReplyContent(this.state.form).then((res) => {
if (res.status === "ok") { if (res.status === "ok") {
this.props.history.push( this.props.history.push(`/t/${this.state.editObject?.topicId}#r_${this.state.editObject?.id}`);
`/t/${this.state.editObject?.topicId}#r_${this.state.editObject?.id}`
);
} else { } else {
Setting.showMessage("error", res?.msg); Setting.showMessage("error", res?.msg);
} }
@ -162,12 +160,12 @@ class EditBox extends React.Component {
if (index === 0) { if (index === 0) {
this.updateFormField("editorType", "markdown"); this.updateFormField("editorType", "markdown");
this.setState({ this.setState({
placeholder: i18next.t("new:markdown"), placeholder: i18next.t("new:Markdown"),
}); });
} else { } else {
this.updateFormField("editorType", "richtext"); this.updateFormField("editorType", "richtext");
this.setState({ this.setState({
placeholder: i18next.t("new:richtext"), placeholder: i18next.t("new:RichText"),
}); });
} }
}} }}
@ -178,10 +176,7 @@ class EditBox extends React.Component {
} }
renderEditor() { renderEditor() {
if ( if (!this.state.form.editorType || this.state.form.editorType === "markdown") {
!this.state.form.editorType ||
this.state.form.editorType === "markdown"
) {
return ( return (
<div <div
style={{ style={{
@ -251,14 +246,10 @@ class EditBox extends React.Component {
return ( return (
<div className="box"> <div className="box">
<div className="header"> <div className="header">
<Link to="/">{Setting.getForumName()}</Link>{" "} <Link to="/">{Setting.getForumName()}</Link> <span className="chevron">&nbsp;&nbsp;</span> {i18next.t("loading:Content loading")}
<span className="chevron">&nbsp;&nbsp;</span>{" "}
{i18next.t("loading:Content loading")}
</div> </div>
<div className="cell"> <div className="cell">
<span className="gray bigger"> <span className="gray bigger">{i18next.t("loading:Please wait patiently...")}</span>
{i18next.t("loading:Please wait patiently...")}
</span>
</div> </div>
</div> </div>
); );
@ -268,13 +259,9 @@ class EditBox extends React.Component {
return ( return (
<div className="box"> <div className="box">
<div className="header"> <div className="header">
<Link to="/">{Setting.getForumName()}</Link>{" "} <Link to="/">{Setting.getForumName()}</Link> <span className="chevron">&nbsp;&nbsp;</span> {i18next.t("edit:Edit content")}
<span className="chevron">&nbsp;&nbsp;</span>{" "}
{i18next.t("edit:Edit content")}
</div>
<div className="inner">
{i18next.t("edit:You cannot edit this content.")}
</div> </div>
<div className="inner">{i18next.t("edit:You cannot edit this content.")}</div>
</div> </div>
); );
} }
@ -283,9 +270,7 @@ class EditBox extends React.Component {
return ( return (
<div className="box"> <div className="box">
<div className="header"> <div className="header">
<Link to="/">{Setting.getForumName()}</Link>{" "} <Link to="/">{Setting.getForumName()}</Link> <span className="chevron">&nbsp;&nbsp;</span> {i18next.t("edit:Edit reply")}
<span className="chevron">&nbsp;&nbsp;</span>{" "}
{i18next.t("edit:Edit reply")}
</div> </div>
<div className="cell"> <div className="cell">
<table cellPadding="5" cellSpacing="0" border="0" width="100%"> <table cellPadding="5" cellSpacing="0" border="0" width="100%">
@ -294,16 +279,9 @@ class EditBox extends React.Component {
<td>{this.renderEditor()}</td> <td>{this.renderEditor()}</td>
</tr> </tr>
<tr> <tr>
<td <td style={{ display: "flex", justifyContent: "space-between" }}>
style={{ display: "flex", justifyContent: "space-between" }}
>
<div> <div>
<input <input type="submit" value={i18next.t("edit:Save")} className="super normal button" onClick={() => this.editContent()} />
type="submit"
value={i18next.t("edit:Save")}
className="super normal button"
onClick={() => this.editContent()}
/>
</div> </div>
{this.renderEditorSelect()} {this.renderEditorSelect()}
</td> </td>
@ -317,19 +295,9 @@ class EditBox extends React.Component {
return ( return (
<div className="box"> <div className="box">
<div className="header"> <div className="header">
<Link to="/">{Setting.getForumName()}</Link>{" "} <Link to="/">{Setting.getForumName()}</Link> <span className="chevron">&nbsp;&nbsp;</span>
<span className="chevron">&nbsp;&nbsp;</span> <Link to={`/go/${encodeURIComponent(this.state.editObject?.nodeId)}`}> {this.state.editObject?.nodeName}</Link> <span className="chevron">&nbsp;&nbsp;</span>
<Link to={`/go/${encodeURIComponent(this.state.editObject?.nodeId)}`}> <Link to={`/t/${this.state.editObject?.id}`}> {pangu.spacing(this.state.editObject?.title)}</Link> <span className="chevron">&nbsp;&nbsp;</span> {i18next.t("edit:Edit topic")}
{" "}
{this.state.editObject?.nodeName}
</Link>{" "}
<span className="chevron">&nbsp;&nbsp;</span>
<Link to={`/t/${this.state.editObject?.id}`}>
{" "}
{pangu.spacing(this.state.editObject?.title)}
</Link>{" "}
<span className="chevron">&nbsp;&nbsp;</span>{" "}
{i18next.t("edit:Edit topic")}
{/* todo */} {/* todo */}
</div> </div>
<div className="cell"> <div className="cell">
@ -356,23 +324,15 @@ class EditBox extends React.Component {
<TagsInput <TagsInput
inputProps={{ inputProps={{
maxLength: "8", maxLength: "8",
placeholder: placeholder: "After adding tags press Enter,only add up to four tags,the length of each tag is up to 8",
"After adding tags press Enter,only add up to four tags,the length of each tag is up to 8",
}} }}
maxTags="4" maxTags="4"
value={this.state.tags} value={this.state.tags}
onChange={this.handleChange.bind(this)} onChange={this.handleChange.bind(this)}
/> />
<td <td style={{ display: "flex", justifyContent: "space-between" }}>
style={{ display: "flex", justifyContent: "space-between" }}
>
<div> <div>
<input <input type="submit" value={i18next.t("edit:Save")} className="super normal button" onClick={() => this.editContent()} />
type="submit"
value={i18next.t("edit:Save")}
className="super normal button"
onClick={() => this.editContent()}
/>
</div> </div>
{this.renderEditorSelect()} {this.renderEditorSelect()}
</td> </td>

View File

@ -48,11 +48,11 @@ class NewBox extends React.Component {
nodeId: this.props.match.params.nodeId, nodeId: this.props.match.params.nodeId,
editor: [ editor: [
{ {
text: i18next.t("new:markdown"), text: i18next.t("new:Markdown"),
id: 0, id: 0,
}, },
{ {
text: i18next.t("new:richtext"), text: i18next.t("new:RichText"),
id: 1, id: 1,
}, },
], ],
@ -190,12 +190,12 @@ class NewBox extends React.Component {
if (index === 0) { if (index === 0) {
this.updateFormField("editorType", "markdown"); this.updateFormField("editorType", "markdown");
this.setState({ this.setState({
placeholder: i18next.t("new:markdown"), placeholder: i18next.t("new:Markdown"),
}); });
} else { } else {
this.updateFormField("editorType", "richtext"); this.updateFormField("editorType", "richtext");
this.setState({ this.setState({
placeholder: i18next.t("new:richtext"), placeholder: i18next.t("new:RichText"),
}); });
} }
}} }}
@ -214,16 +214,12 @@ class NewBox extends React.Component {
return ( return (
<div className="problem" onClick={() => this.clearMessage()}> <div className="problem" onClick={() => this.clearMessage()}>
{i18next.t( {i18next.t("error:Please resolve the following issues before creating a new topic")}
"error:Please resolve the following issues before creating a new topic"
)}
<ul> <ul>
{problems.map((problem, i) => { {problems.map((problem, i) => {
return <li>{problem}</li>; return <li>{problem}</li>;
})} })}
{this.state.message !== "" ? ( {this.state.message !== "" ? <li>{i18next.t(`error:${this.state.message}`)}</li> : null}
<li>{i18next.t(`error:${this.state.message}`)}</li>
) : null}
</ul> </ul>
</div> </div>
); );
@ -231,13 +227,7 @@ class NewBox extends React.Component {
render() { render() {
if (this.state.nodeId !== undefined && this.props.account !== undefined) { if (this.state.nodeId !== undefined && this.props.account !== undefined) {
return ( return <NewNodeTopicBox nodeId={this.state.nodeId} size={"large"} account={this.props.account} />;
<NewNodeTopicBox
nodeId={this.state.nodeId}
size={"large"}
account={this.props.account}
/>
);
} }
if (this.props.account === null) { if (this.props.account === null) {
@ -266,9 +256,7 @@ class NewBox extends React.Component {
id="topic_title" id="topic_title"
name="title" name="title"
autoFocus="autofocus" autoFocus="autofocus"
placeholder={i18next.t( placeholder={i18next.t("new:Please input the topic title. The body can be empty if the title expresses the full idea")}
"new:Please input the topic title. The body can be empty if the title expresses the full idea"
)}
> >
{this.state.form.title} {this.state.form.title}
</textarea> </textarea>
@ -281,8 +269,7 @@ class NewBox extends React.Component {
</div> </div>
<div> <div>
{/* markdown editor */} {/* markdown editor */}
{!this.state.form.editorType || {!this.state.form.editorType || this.state.form.editorType === "markdown" ? (
this.state.form.editorType === "markdown" ? (
<div <div
style={{ style={{
textAlign: "left", textAlign: "left",
@ -291,12 +278,7 @@ class NewBox extends React.Component {
lineHeight: "120%", lineHeight: "120%",
}} }}
> >
<textarea <textarea style={{ visibility: "hidden", display: "none" }} maxLength="20000" id="editor" name="content" />
style={{ visibility: "hidden", display: "none" }}
maxLength="20000"
id="editor"
name="content"
/>
<div className={`cm-long-content`}> <div className={`cm-long-content`}>
<CodeMirror <CodeMirror
editorDidMount={(editor) => Tools.attachEditor(editor)} editorDidMount={(editor) => Tools.attachEditor(editor)}
@ -329,10 +311,7 @@ class NewBox extends React.Component {
)} )}
</div> </div>
{/* select node */} {/* select node */}
<div <div className="cell" style={{ display: "flex", justifyContent: "space-between" }}>
className="cell"
style={{ display: "flex", justifyContent: "space-between" }}
>
<Select2 <Select2
value={this.getIndexFromNodeId(this.state.form.nodeId)} value={this.getIndexFromNodeId(this.state.form.nodeId)}
style={{ style={{
@ -387,8 +366,7 @@ class NewBox extends React.Component {
<TagsInput <TagsInput
inputProps={{ inputProps={{
maxLength: "8", maxLength: "8",
placeholder: placeholder: "After adding tags press Enter,only add up to four tags,the length of each tag is up to 8",
"After adding tags press Enter,only add up to four tags,the length of each tag is up to 8",
}} }}
maxTags="4" maxTags="4"
value={this.state.tags} value={this.state.tags}
@ -398,20 +376,13 @@ class NewBox extends React.Component {
<div className="cell"> <div className="cell">
<div className="fr"> <div className="fr">
<span id="error_message" /> &nbsp; <span id="error_message" /> &nbsp;
<button <button type="button" className="super normal button" onClick={this.publishTopic.bind(this)}>
type="button"
className="super normal button"
onClick={this.publishTopic.bind(this)}
>
<li className="fa fa-paper-plane" /> <li className="fa fa-paper-plane" />
&nbsp;{i18next.t("new:Publish")} &nbsp;{i18next.t("new:Publish")}
</button> </button>
</div> </div>
<div> <div>
<button <button className="super normal button" onClick={this.enablePreview.bind(this)}>
className="super normal button"
onClick={this.enablePreview.bind(this)}
>
<li className="fa fa-eye" /> <li className="fa fa-eye" />
&nbsp;{i18next.t("new:Preview")} &nbsp;{i18next.t("new:Preview")}
</button> </button>
@ -420,14 +391,7 @@ class NewBox extends React.Component {
<div className="inner" id="topic_preview"> <div className="inner" id="topic_preview">
<div className="topic_content"> <div className="topic_content">
{/* preview in markdown */} {/* preview in markdown */}
<div className="markdown_body"> <div className="markdown_body">{!this.state.isPreviewEnabled ? null : <ReactMarkdown source={this.state.form.body} escapeHtml={false} />}</div>
{!this.state.isPreviewEnabled ? null : (
<ReactMarkdown
source={this.state.form.body}
escapeHtml={false}
/>
)}
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -50,11 +50,11 @@ class NewNodeTopicBox extends React.Component {
width: "", width: "",
editor: [ editor: [
{ {
text: i18next.t("new:markdown"), text: i18next.t("new:Markdown"),
id: 0, id: 0,
}, },
{ {
text: i18next.t("new:richtext"), text: i18next.t("new:RichText"),
id: 1, id: 1,
}, },
], ],
@ -157,16 +157,12 @@ class NewNodeTopicBox extends React.Component {
return ( return (
<div className="problem" onClick={() => this.clearMessage()}> <div className="problem" onClick={() => this.clearMessage()}>
{i18next.t( {i18next.t("error:Please resolve the following issues before creating a new topic")}
"error:Please resolve the following issues before creating a new topic"
)}
<ul> <ul>
{problems.map((problem, i) => { {problems.map((problem, i) => {
return <li>{problem}</li>; return <li>{problem}</li>;
})} })}
{this.state.message !== "" ? ( {this.state.message !== "" ? <li>{i18next.t(`error:${this.state.message}`)}</li> : null}
<li>{i18next.t(`error:${this.state.message}`)}</li>
) : null}
</ul> </ul>
</div> </div>
); );
@ -202,14 +198,7 @@ class NewNodeTopicBox extends React.Component {
)} )}
<div className="inner" id="topic_preview"> <div className="inner" id="topic_preview">
<div className="topic_content"> <div className="topic_content">
<div className="markdown_body"> <div className="markdown_body">{!this.state.isPreviewEnabled ? null : <ReactMarkdown source={this.state.form.body} escapeHtml={false} />}</div>
{!this.state.isPreviewEnabled ? null : (
<ReactMarkdown
source={this.state.form.body}
escapeHtml={false}
/>
)}
</div>
</div> </div>
</div> </div>
</div> </div>
@ -221,12 +210,8 @@ class NewNodeTopicBox extends React.Component {
<div className="header"> <div className="header">
<Link to="/">{Setting.getForumName()}</Link> <Link to="/">{Setting.getForumName()}</Link>
<span className="chevron">&nbsp;&nbsp;</span> <span className="chevron">&nbsp;&nbsp;</span>
<Link to={`/go/${encodeURIComponent(this.props.nodeId)}`}> <Link to={`/go/${encodeURIComponent(this.props.nodeId)}`}> {this.state.nodeInfo?.name} </Link>
{" "} <span className="chevron">&nbsp;&nbsp;</span> {i18next.t("new:New Topic")}
{this.state.nodeInfo?.name}{" "}
</Link>
<span className="chevron">&nbsp;&nbsp;</span>{" "}
{i18next.t("new:New Topic")}
</div> </div>
); );
} }
@ -246,15 +231,12 @@ class NewNodeTopicBox extends React.Component {
onChange={(event) => { onChange={(event) => {
this.updateFormField("title", event.target.value); this.updateFormField("title", event.target.value);
}} }}
placeholder={i18next.t( placeholder={i18next.t("new:Please input the topic title. The body can be empty if the title expresses the full idea")}
"new:Please input the topic title. The body can be empty if the title expresses the full idea"
)}
> >
{this.state.form.title} {this.state.form.title}
</textarea> </textarea>
<div className="sep10"></div> <div className="sep10"></div>
{!this.state.form.editorType || {!this.state.form.editorType || this.state.form.editorType === "markdown" ? (
this.state.form.editorType === "markdown" ? (
<div <div
style={{ style={{
overflow: "hidden", overflow: "hidden",
@ -309,29 +291,16 @@ class NewNodeTopicBox extends React.Component {
)} )}
<div className="sep10"></div> <div className="sep10"></div>
<div style={{ display: "flex", justifyContent: "space-between" }}> <div style={{ display: "flex", justifyContent: "space-between" }}>
<input <input type="submit" value={i18next.t("node:Publish")} className="super normal button" onClick={this.publishTopic.bind(this)} />
type="submit"
value={i18next.t("node:Publish")}
className="super normal button"
onClick={this.publishTopic.bind(this)}
/>
{this.renderEditorSelect()} {this.renderEditorSelect()}
</div> </div>
</div> </div>
<div className="inner"> <div className="inner">
<div className="fr"> <div className="fr">
<a <a href="/settings/ignore/node/12" className={`${this.state.nodeInfo.id}`}>
href="/settings/ignore/node/12"
className={`${this.state.nodeInfo.id}`}
>
{i18next.t("node:Ignore this node")} {i18next.t("node:Ignore this node")}
</a> </a>
&nbsp;{" "} &nbsp; <span className="fade">{i18next.t("node:Topics in the ignored nodes will not appear on the homepage.")}</span>
<span className="fade">
{i18next.t(
"node:Topics in the ignored nodes will not appear on the homepage."
)}
</span>
</div> </div>
&nbsp; &nbsp;
</div> </div>
@ -359,12 +328,12 @@ class NewNodeTopicBox extends React.Component {
if (index === 0) { if (index === 0) {
this.updateFormField("editorType", "markdown"); this.updateFormField("editorType", "markdown");
this.setState({ this.setState({
placeholder: i18next.t("new:markdown"), placeholder: i18next.t("new:Markdown"),
}); });
} else { } else {
this.updateFormField("editorType", "richtext"); this.updateFormField("editorType", "richtext");
this.setState({ this.setState({
placeholder: i18next.t("new:richtext"), placeholder: i18next.t("new:RichText"),
}); });
} }
}} }}
@ -412,8 +381,7 @@ class NewNodeTopicBox extends React.Component {
</tr> </tr>
<tr> <tr>
<td> <td>
{!this.state.form.editorType || {!this.state.form.editorType || this.state.form.editorType === "markdown" ? (
this.state.form.editorType === "markdown" ? (
<div <div
style={{ style={{
overflow: "hidden", overflow: "hidden",
@ -426,9 +394,7 @@ class NewNodeTopicBox extends React.Component {
> >
<div className={`cm-long-content`}> <div className={`cm-long-content`}>
<CodeMirror <CodeMirror
editorDidMount={(editor) => editorDidMount={(editor) => Tools.attachEditor(editor)}
Tools.attachEditor(editor)
}
onPaste={() => Tools.uploadMdFile()} onPaste={() => Tools.uploadMdFile()}
value={this.state.form.body} value={this.state.form.body}
onDrop={() => Tools.uploadMdFile()} onDrop={() => Tools.uploadMdFile()}
@ -472,19 +438,14 @@ class NewNodeTopicBox extends React.Component {
{Setting.PcBrowser ? ( {Setting.PcBrowser ? (
<div> <div>
<span> <span>
<input <input ref={this.auto} type="checkbox" onChange={this.autoTag.bind(this)} />
ref={this.auto}
type="checkbox"
onChange={this.autoTag.bind(this)}
/>
&nbsp;Auto Tag &nbsp;Auto Tag
</span> </span>
{!this.state.autoTag ? ( {!this.state.autoTag ? (
<TagsInput <TagsInput
inputProps={{ inputProps={{
maxLength: "8", maxLength: "8",
placeholder: placeholder: "After adding tags press Enter,only add up to four tags,the length of each tag is up to 8",
"After adding tags press Enter,only add up to four tags,the length of each tag is up to 8",
}} }}
maxTags="4" maxTags="4"
value={this.state.tags} value={this.state.tags}
@ -493,25 +454,15 @@ class NewNodeTopicBox extends React.Component {
) : null} ) : null}
</div> </div>
) : null} ) : null}
<td <td style={{ display: "flex", justifyContent: "space-between" }}>
style={{ display: "flex", justifyContent: "space-between" }}
>
<div> <div>
<input type="hidden" name="once" /> <input type="hidden" name="once" />
<button <button type="button" className="super normal button" onClick={this.enablePreview.bind(this)}>
type="button"
className="super normal button"
onClick={this.enablePreview.bind(this)}
>
<li className="fa fa-eye"></li> &nbsp; <li className="fa fa-eye"></li> &nbsp;
{i18next.t("newNodeTopic:Preview")}{" "} {i18next.t("newNodeTopic:Preview")}{" "}
</button>{" "} </button>{" "}
&nbsp; &nbsp;
<button <button type="submit" className="super normal button" onClick={this.publishTopic.bind(this)}>
type="submit"
className="super normal button"
onClick={this.publishTopic.bind(this)}
>
<li className="fa fa-paper-plane"></li> &nbsp; <li className="fa fa-paper-plane"></li> &nbsp;
{i18next.t("newNodeTopic:Publish")}{" "} {i18next.t("newNodeTopic:Publish")}{" "}
</button>{" "} </button>{" "}

View File

@ -44,11 +44,11 @@ class NewReplyBox extends React.Component {
message: null, message: null,
editor: [ editor: [
{ {
text: i18next.t("new:markdown"), text: i18next.t("new:Markdown"),
id: 0, id: 0,
}, },
{ {
text: i18next.t("new:richtext"), text: i18next.t("new:RichText"),
id: 1, id: 1,
}, },
], ],
@ -338,12 +338,12 @@ class NewReplyBox extends React.Component {
if (index === 0) { if (index === 0) {
this.updateFormField("editorType", "markdown"); this.updateFormField("editorType", "markdown");
this.setState({ this.setState({
placeholder: i18next.t("new:markdown"), placeholder: i18next.t("new:Markdown"),
}); });
} else { } else {
this.updateFormField("editorType", "richtext"); this.updateFormField("editorType", "richtext");
this.setState({ this.setState({
placeholder: i18next.t("new:richtext"), placeholder: i18next.t("new:RichText"),
}); });
} }
}} }}

View File

@ -27,39 +27,15 @@ class SelectLanguageBox extends React.Component {
render() { render() {
return ( return (
<div align="center"> <div align="center">
<div <div className="box" style={{ width: Setting.PcBrowser ? "600px" : "auto" }}>
className="box"
style={{ width: Setting.PcBrowser ? "600px" : "auto" }}
>
<div className="header"> <div className="header">
<Link to="/">{Setting.getForumName()}</Link>{" "} <Link to="/">{Setting.getForumName()}</Link> <span className="chevron">&nbsp;&nbsp;</span> Select Default Editor /
<span className="chevron">&nbsp;&nbsp;</span> Select Default Editor
/
</div> </div>
<div className="cell"> <div className="cell">{Setting.PcBrowser ? <span>Please select the Default Editor you would like to use on {Setting.getForumName()}</span> : <span>Please select the Default Editor you would like to use:</span>}</div>
{Setting.PcBrowser ? ( <a href="javascript:void(0);" onClick={() => Setting.changeEditorType("markdown")} className={"lang-selector"}>
<span> {i18next.t("new:Markdown")}
Please select the Default Editor you would like to use on{" "}
{Setting.getForumName()}
</span>
) : (
<span>
Please select the Default Editor you would like to use:
</span>
)}
</div>
<a
href="javascript:void(0);"
onClick={() => Setting.changeEditorType("markdown")}
className={"lang-selector"}
>
{i18next.t("new:MarkDown")}
</a> </a>
<a <a href="javascript:void(0);" onClick={() => Setting.changeEditorType("richtext")} className={"lang-selector"}>
href="javascript:void(0);"
onClick={() => Setting.changeEditorType("richtext")}
className={"lang-selector"}
>
{i18next.t("new:RichText")} {i18next.t("new:RichText")}
</a> </a>
</div> </div>