From 4747f60ce36a0aa8134ca5dd7e0c12cf32632665 Mon Sep 17 00:00:00 2001 From: Gucheng Wang Date: Tue, 28 Dec 2021 21:43:45 +0800 Subject: [PATCH] Improve translation. --- i18n/generate_test.go | 1 + web/src/locales/de/data.json | 8 +-- web/src/locales/en/data.json | 8 +-- web/src/locales/fr/data.json | 8 +-- web/src/locales/ja/data.json | 8 +-- web/src/locales/kk/data.json | 8 +-- web/src/locales/ko/data.json | 8 +-- web/src/locales/ru/data.json | 8 +-- web/src/locales/zh-TW/data.json | 8 +-- web/src/locales/zh/data.json | 8 +-- web/src/main/EditBox.js | 78 ++++++------------------- web/src/main/NewBox.js | 66 +++++---------------- web/src/main/NewNodeTopicBox.js | 91 +++++++---------------------- web/src/main/NewReplyBox.js | 8 +-- web/src/main/SelectEditorTypeBox.js | 36 ++---------- 15 files changed, 102 insertions(+), 250 deletions(-) diff --git a/i18n/generate_test.go b/i18n/generate_test.go index b234b20a..361e02ac 100644 --- a/i18n/generate_test.go +++ b/i18n/generate_test.go @@ -35,4 +35,5 @@ func TestGenerateI18nStrings(t *testing.T) { applyToOtherLanguage(dataEn, "ru") applyToOtherLanguage(dataEn, "zh") applyToOtherLanguage(dataEn, "zh-TW") + applyToOtherLanguage(dataEn, "kk") } diff --git a/web/src/locales/de/data.json b/web/src/locales/de/data.json index 8a17d78d..12696def 100644 --- a/web/src/locales/de/data.json +++ b/web/src/locales/de/data.json @@ -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.": "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": "Already enabled 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": "RichText" + "Topic Title": "Topic Title" }, "newNodeTopic": { "Preview": "Preview", @@ -384,6 +383,7 @@ "reply": { "Add a New Comment": "Add a New Comment", "Back to Top": "Back to Top", + "Cancel reply to {username}": "Cancel reply to {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", diff --git a/web/src/locales/en/data.json b/web/src/locales/en/data.json index 11af89e3..c46c8491 100644 --- a/web/src/locales/en/data.json +++ b/web/src/locales/en/data.json @@ -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.": "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": "Already enabled 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": "richtext" + "Topic Title": "Topic Title" }, "newNodeTopic": { "Preview": "Preview", @@ -384,6 +383,7 @@ "reply": { "Add a New Comment": "Add a New Comment", "Back to Top": "Back to Top", + "Cancel reply to {username}": "Cancel reply to {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", diff --git a/web/src/locales/fr/data.json b/web/src/locales/fr/data.json index a7b66be8..5c19d5a1 100644 --- a/web/src/locales/fr/data.json +++ b/web/src/locales/fr/data.json @@ -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.": "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": "Already enabled 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": "RichText" + "Topic Title": "Topic Title" }, "newNodeTopic": { "Preview": "Preview", @@ -384,6 +383,7 @@ "reply": { "Add a New Comment": "Add a New Comment", "Back to Top": "Back to Top", + "Cancel reply to {username}": "Cancel reply to {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", diff --git a/web/src/locales/ja/data.json b/web/src/locales/ja/data.json index a7b66be8..5c19d5a1 100644 --- a/web/src/locales/ja/data.json +++ b/web/src/locales/ja/data.json @@ -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.": "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": "Already enabled 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": "RichText" + "Topic Title": "Topic Title" }, "newNodeTopic": { "Preview": "Preview", @@ -384,6 +383,7 @@ "reply": { "Add a New Comment": "Add a New Comment", "Back to Top": "Back to Top", + "Cancel reply to {username}": "Cancel reply to {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", diff --git a/web/src/locales/kk/data.json b/web/src/locales/kk/data.json index 11af89e3..c46c8491 100644 --- a/web/src/locales/kk/data.json +++ b/web/src/locales/kk/data.json @@ -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.": "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": "Already enabled 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": "richtext" + "Topic Title": "Topic Title" }, "newNodeTopic": { "Preview": "Preview", @@ -384,6 +383,7 @@ "reply": { "Add a New Comment": "Add a New Comment", "Back to Top": "Back to Top", + "Cancel reply to {username}": "Cancel reply to {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", diff --git a/web/src/locales/ko/data.json b/web/src/locales/ko/data.json index a7b66be8..5c19d5a1 100644 --- a/web/src/locales/ko/data.json +++ b/web/src/locales/ko/data.json @@ -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.": "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": "Already enabled 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": "RichText" + "Topic Title": "Topic Title" }, "newNodeTopic": { "Preview": "Preview", @@ -384,6 +383,7 @@ "reply": { "Add a New Comment": "Add a New Comment", "Back to Top": "Back to Top", + "Cancel reply to {username}": "Cancel reply to {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", diff --git a/web/src/locales/ru/data.json b/web/src/locales/ru/data.json index 35938e11..e0405d94 100644 --- a/web/src/locales/ru/data.json +++ b/web/src/locales/ru/data.json @@ -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.": "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": "Already enabled 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": "RichText" + "Topic Title": "Topic Title" }, "newNodeTopic": { "Preview": "Preview", @@ -384,6 +383,7 @@ "reply": { "Add a New Comment": "Add a New Comment", "Back to Top": "Back to Top", + "Cancel reply to {username}": "Cancel reply to {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", diff --git a/web/src/locales/zh-TW/data.json b/web/src/locales/zh-TW/data.json index 2e0bd078..8d987d06 100644 --- a/web/src/locales/zh-TW/data.json +++ b/web/src/locales/zh-TW/data.json @@ -224,6 +224,7 @@ "Total Replies": "回復總數", "Total Topics": "主題總數", "Watch": "加入特別關註", + "You have signed out completely, no personal information is left on this computer.": "你已經完全登出,沒有任何個人信息留在這臺電腦上。", "authorized to manage the community": "具有管理社區的權限", "member, joined on": "號會員,加入於", "replied": "回復了" @@ -250,16 +251,14 @@ "Already enabled Markdown": "已啟用Markdown", "Body": "正文", "Hottest Nodes": "最熱節點", - "MarkDown": "MarkDown", + "Markdown": "Markdown", "New Topic": "創作新主題", "Please select a node": "請選擇一個節點", "Preview": "預覽主題", "Publish": "發布主題", "RichText": "富文本", "Switch editor": "切換編輯器", - "Topic Title": "主題標題", - "markdown": "Markdown", - "richtext": "富文本" + "Topic Title": "主題標題" }, "newNodeTopic": { "Preview": "預覽", @@ -384,6 +383,7 @@ "reply": { "Add a New Comment": "添加一條新回復", "Back to Top": "回到頂部", + "Cancel reply to {username}": "取消對 {username} 的回復", "Delete": "刪除", "Edit": "編輯", "Make your comment helpful for others as much as possible": "請盡量讓自己的回復能夠對別人有幫助", diff --git a/web/src/locales/zh/data.json b/web/src/locales/zh/data.json index 0241de40..3676ebe7 100644 --- a/web/src/locales/zh/data.json +++ b/web/src/locales/zh/data.json @@ -224,6 +224,7 @@ "Total Replies": "回复总数", "Total Topics": "主题总数", "Watch": "加入特别关注", + "You have signed out completely, no personal information is left on this computer.": "你已经完全登出,没有任何个人信息留在这台电脑上。", "authorized to manage the community": "具有管理社区的权限", "member, joined on": "号会员,加入于", "replied": "回复了" @@ -250,16 +251,14 @@ "Already enabled Markdown": "已启用Markdown", "Body": "正文", "Hottest Nodes": "最热节点", - "MarkDown": "MarkDown", + "Markdown": "Markdown", "New Topic": "创作新主题", "Please select a node": "请选择一个节点", "Preview": "预览主题", "Publish": "发布主题", "RichText": "富文本", "Switch editor": "切换编辑器", - "Topic Title": "主题标题", - "markdown": "Markdown", - "richtext": "富文本" + "Topic Title": "主题标题" }, "newNodeTopic": { "Preview": "预览", @@ -384,6 +383,7 @@ "reply": { "Add a New Comment": "添加一条新回复", "Back to Top": "回到顶部", + "Cancel reply to {username}": "取消对 {username} 的回复", "Delete": "删除", "Edit": "编辑", "Make your comment helpful for others as much as possible": "请尽量让自己的回复能够对别人有帮助", diff --git a/web/src/main/EditBox.js b/web/src/main/EditBox.js index 8abf31d1..52eb6d76 100644 --- a/web/src/main/EditBox.js +++ b/web/src/main/EditBox.js @@ -41,11 +41,11 @@ class EditBox extends React.Component { form: {}, editor: [ { - text: i18next.t("new:markdown"), + text: i18next.t("new:Markdown"), id: 0, }, { - text: i18next.t("new:richtext"), + text: i18next.t("new:RichText"), id: 1, }, ], @@ -99,9 +99,7 @@ class EditBox extends React.Component { // reply ReplyBackend.editReplyContent(this.state.form).then((res) => { if (res.status === "ok") { - this.props.history.push( - `/t/${this.state.editObject?.topicId}#r_${this.state.editObject?.id}` - ); + this.props.history.push(`/t/${this.state.editObject?.topicId}#r_${this.state.editObject?.id}`); } else { Setting.showMessage("error", res?.msg); } @@ -162,12 +160,12 @@ class EditBox extends React.Component { if (index === 0) { this.updateFormField("editorType", "markdown"); this.setState({ - placeholder: i18next.t("new:markdown"), + placeholder: i18next.t("new:Markdown"), }); } else { this.updateFormField("editorType", "richtext"); this.setState({ - placeholder: i18next.t("new:richtext"), + placeholder: i18next.t("new:RichText"), }); } }} @@ -178,10 +176,7 @@ class EditBox extends React.Component { } renderEditor() { - if ( - !this.state.form.editorType || - this.state.form.editorType === "markdown" - ) { + if (!this.state.form.editorType || this.state.form.editorType === "markdown") { return (
- {Setting.getForumName()}{" "} -  › {" "} - {i18next.t("loading:Content loading")} + {Setting.getForumName()}  ›  {i18next.t("loading:Content loading")}
- - {i18next.t("loading:Please wait patiently...")} - + {i18next.t("loading:Please wait patiently...")}
); @@ -268,13 +259,9 @@ class EditBox extends React.Component { return (
- {Setting.getForumName()}{" "} -  › {" "} - {i18next.t("edit:Edit content")} -
-
- {i18next.t("edit:You cannot edit this content.")} + {Setting.getForumName()}  ›  {i18next.t("edit:Edit content")}
+
{i18next.t("edit:You cannot edit this content.")}
); } @@ -283,9 +270,7 @@ class EditBox extends React.Component { return (
- {Setting.getForumName()}{" "} -  › {" "} - {i18next.t("edit:Edit reply")} + {Setting.getForumName()}  ›  {i18next.t("edit:Edit reply")}
@@ -294,16 +279,9 @@ class EditBox extends React.Component { - @@ -317,19 +295,9 @@ class EditBox extends React.Component { return (
- {Setting.getForumName()}{" "} -  ›  - - {" "} - {this.state.editObject?.nodeName} - {" "} -  ›  - - {" "} - {pangu.spacing(this.state.editObject?.title)} - {" "} -  › {" "} - {i18next.t("edit:Edit topic")} + {Setting.getForumName()}  ›  + {this.state.editObject?.nodeName}  ›  + {pangu.spacing(this.state.editObject?.title)}  ›  {i18next.t("edit:Edit topic")} {/* todo */}
@@ -356,23 +324,15 @@ class EditBox extends React.Component { -
diff --git a/web/src/main/NewBox.js b/web/src/main/NewBox.js index ea8c5294..35e91b0c 100644 --- a/web/src/main/NewBox.js +++ b/web/src/main/NewBox.js @@ -48,11 +48,11 @@ class NewBox extends React.Component { nodeId: this.props.match.params.nodeId, editor: [ { - text: i18next.t("new:markdown"), + text: i18next.t("new:Markdown"), id: 0, }, { - text: i18next.t("new:richtext"), + text: i18next.t("new:RichText"), id: 1, }, ], @@ -190,12 +190,12 @@ class NewBox extends React.Component { if (index === 0) { this.updateFormField("editorType", "markdown"); this.setState({ - placeholder: i18next.t("new:markdown"), + placeholder: i18next.t("new:Markdown"), }); } else { this.updateFormField("editorType", "richtext"); this.setState({ - placeholder: i18next.t("new:richtext"), + placeholder: i18next.t("new:RichText"), }); } }} @@ -214,16 +214,12 @@ class NewBox extends React.Component { return (
this.clearMessage()}> - {i18next.t( - "error:Please resolve the following issues before creating a new topic" - )} + {i18next.t("error:Please resolve the following issues before creating a new topic")}
    {problems.map((problem, i) => { return
  • {problem}
  • ; })} - {this.state.message !== "" ? ( -
  • {i18next.t(`error:${this.state.message}`)}
  • - ) : null} + {this.state.message !== "" ?
  • {i18next.t(`error:${this.state.message}`)}
  • : null}
); @@ -231,13 +227,7 @@ class NewBox extends React.Component { render() { if (this.state.nodeId !== undefined && this.props.account !== undefined) { - return ( - - ); + return ; } if (this.props.account === null) { @@ -266,9 +256,7 @@ class NewBox extends React.Component { id="topic_title" name="title" autoFocus="autofocus" - placeholder={i18next.t( - "new:Please input the topic title. The body can be empty if the title expresses the full idea" - )} + placeholder={i18next.t("new:Please input the topic title. The body can be empty if the title expresses the full idea")} > {this.state.form.title} @@ -281,8 +269,7 @@ class NewBox extends React.Component {
{/* markdown editor */} - {!this.state.form.editorType || - this.state.form.editorType === "markdown" ? ( + {!this.state.form.editorType || this.state.form.editorType === "markdown" ? (
-
- {!this.state.form.editorType || - this.state.form.editorType === "markdown" ? ( + {!this.state.form.editorType || this.state.form.editorType === "markdown" ? (
- + {this.renderEditorSelect()}
- + {i18next.t("node:Ignore this node")} -  {" "} - - {i18next.t( - "node:Topics in the ignored nodes will not appear on the homepage." - )} - +   {i18next.t("node:Topics in the ignored nodes will not appear on the homepage.")}
 
@@ -359,12 +328,12 @@ class NewNodeTopicBox extends React.Component { if (index === 0) { this.updateFormField("editorType", "markdown"); this.setState({ - placeholder: i18next.t("new:markdown"), + placeholder: i18next.t("new:Markdown"), }); } else { this.updateFormField("editorType", "richtext"); this.setState({ - placeholder: i18next.t("new:richtext"), + placeholder: i18next.t("new:RichText"), }); } }} @@ -412,8 +381,7 @@ class NewNodeTopicBox extends React.Component {
{this.renderEditor()}
+
- this.editContent()} - /> + this.editContent()} />
{this.renderEditorSelect()}
+
- this.editContent()} - /> + this.editContent()} />
{this.renderEditorSelect()}
- {!this.state.form.editorType || - this.state.form.editorType === "markdown" ? ( + {!this.state.form.editorType || this.state.form.editorType === "markdown" ? (
- Tools.attachEditor(editor) - } + editorDidMount={(editor) => Tools.attachEditor(editor)} onPaste={() => Tools.uploadMdFile()} value={this.state.form.body} onDrop={() => Tools.uploadMdFile()} @@ -472,19 +438,14 @@ class NewNodeTopicBox extends React.Component { {Setting.PcBrowser ? (
- +  Auto Tag {!this.state.autoTag ? ( ) : null} -
+
- {" "}   - {" "} diff --git a/web/src/main/NewReplyBox.js b/web/src/main/NewReplyBox.js index 93aed28c..2fc80576 100644 --- a/web/src/main/NewReplyBox.js +++ b/web/src/main/NewReplyBox.js @@ -44,11 +44,11 @@ class NewReplyBox extends React.Component { message: null, editor: [ { - text: i18next.t("new:markdown"), + text: i18next.t("new:Markdown"), id: 0, }, { - text: i18next.t("new:richtext"), + text: i18next.t("new:RichText"), id: 1, }, ], @@ -338,12 +338,12 @@ class NewReplyBox extends React.Component { if (index === 0) { this.updateFormField("editorType", "markdown"); this.setState({ - placeholder: i18next.t("new:markdown"), + placeholder: i18next.t("new:Markdown"), }); } else { this.updateFormField("editorType", "richtext"); this.setState({ - placeholder: i18next.t("new:richtext"), + placeholder: i18next.t("new:RichText"), }); } }} diff --git a/web/src/main/SelectEditorTypeBox.js b/web/src/main/SelectEditorTypeBox.js index 875e9e0b..2098d286 100644 --- a/web/src/main/SelectEditorTypeBox.js +++ b/web/src/main/SelectEditorTypeBox.js @@ -27,39 +27,15 @@ class SelectLanguageBox extends React.Component { render() { return (
-
+
- {Setting.getForumName()}{" "} -  ›  Select Default Editor - / 选择默认编辑器 + {Setting.getForumName()}  ›  Select Default Editor / 选择默认编辑器
-
- {Setting.PcBrowser ? ( - - Please select the Default Editor you would like to use on{" "} - {Setting.getForumName()} - - ) : ( - - Please select the Default Editor you would like to use: - - )} -
- Setting.changeEditorType("markdown")} - className={"lang-selector"} - > - {i18next.t("new:MarkDown")} +
{Setting.PcBrowser ? Please select the Default Editor you would like to use on {Setting.getForumName()} : Please select the Default Editor you would like to use:}
+
Setting.changeEditorType("markdown")} className={"lang-selector"}> + {i18next.t("new:Markdown")} - Setting.changeEditorType("richtext")} - className={"lang-selector"} - > + Setting.changeEditorType("richtext")} className={"lang-selector"}> {i18next.t("new:RichText")}