From d16b3180933e0aafa50b0d41cd19fe7113d2f331 Mon Sep 17 00:00:00 2001 From: josc146 Date: Wed, 29 Mar 2023 21:27:46 +0800 Subject: [PATCH] chore: better i18n --- src/_locales/en/main.json | 19 +++++++++---------- src/_locales/zh-hans/main.json | 19 +++++++++---------- src/_locales/zh-hant/main.json | 19 +++++++++---------- src/components/ConversationCard/index.jsx | 4 +++- src/components/ConversationItem/index.jsx | 4 ++-- src/popup/Popup.jsx | 8 ++++---- 6 files changed, 36 insertions(+), 37 deletions(-) diff --git a/src/_locales/en/main.json b/src/_locales/en/main.json index 529241e..496ecbc 100644 --- a/src/_locales/en/main.json +++ b/src/_locales/en/main.json @@ -18,26 +18,25 @@ "Custom ChatGPT Web API Url": "Custom ChatGPT Web API Url", "Custom ChatGPT Web API Path": "Custom ChatGPT Web API Path", "Custom OpenAI API Url": "Custom OpenAI API Url", - "Custom Site Regex:": "Custom Site Regex:", - "Exclusively use Custom Site Regex for website matching,": "Exclusively use Custom Site Regex for website matching,", - "ignoring built-in rules": "ignoring built-in rules", - "Input Query:": "Input Query:", - "Append Query:": "Append Query:", - "Prepend Query:": "Prepend Query:", + "Custom Site Regex": "Custom Site Regex", + "Exclusively use Custom Site Regex for website matching, ignoring built-in rules": "Exclusively use Custom Site Regex for website matching, ignoring built-in rules", + "Input Query": "Input Query", + "Append Query": "Append Query", + "Prepend Query": "Prepend Query", "Wechat Pay": "Wechat Pay", "Type your question here\nEnter to send, shift + enter to break line": "Type your question here\nEnter to send, shift + enter to break line", "Wait for the answer to finish and then continue here": "Wait for the answer to finish and then continue here", "Ask ChatGPT": "Ask ChatGPT", "No Input Found": "No Input Found", - "You:": "You:", + "You": "You", "Collapse": "Collapse", "Expand": "Expand", "Stop": "Stop", "Continue on official website": "Continue on official website", - "Error:": "Error:", + "Error": "Error", "Copy": "Copy", - "Question:": "Question:", - "Answer:": "Answer:", + "Question": "Question", + "Answer": "Answer", "Waiting for response...": "Waiting for response...", "Close the Window": "Close the Window", "Pin the Window": "Pin the Window", diff --git a/src/_locales/zh-hans/main.json b/src/_locales/zh-hans/main.json index d28cc7b..a212879 100644 --- a/src/_locales/zh-hans/main.json +++ b/src/_locales/zh-hans/main.json @@ -18,26 +18,25 @@ "Custom ChatGPT Web API Url": "自定义的ChatGPT网页API地址", "Custom ChatGPT Web API Path": "自定义的ChatGPT网页API路径", "Custom OpenAI API Url": "自定义的OpenAI API地址", - "Custom Site Regex:": "自定义站点正则匹配:", - "Exclusively use Custom Site Regex for website matching,": "只使用自定义站点正则匹配,", - "ignoring built-in rules": "忽略内置站点规则", - "Input Query:": "输入的查询选择器:", - "Append Query:": "挂载到末尾的查询选择器:", - "Prepend Query:": "插入到开头的查询选择器:", + "Custom Site Regex": "自定义站点正则匹配", + "Exclusively use Custom Site Regex for website matching, ignoring built-in rules": "只使用自定义站点正则匹配, 忽略内置站点规则", + "Input Query": "输入的查询选择器", + "Append Query": "挂载到末尾的查询选择器", + "Prepend Query": "插入到开头的查询选择器", "Wechat Pay": "微信打赏", "Type your question here\nEnter to send, shift + enter to break line": "在此输入你的问题\n回车 发送, shift+回车 换行", "Wait for the answer to finish and then continue here": "等待回答完成, 然后在此继续", "Ask ChatGPT": "询问ChatGPT", "No Input Found": "无输入", - "You:": "你:", + "You": "你", "Collapse": "折叠", "Expand": "展开", "Stop": "停止", "Continue on official website": "在官网继续", - "Error:": "错误:", + "Error": "错误", "Copy": "复制", - "Question:": "问题:", - "Answer:": "回答:", + "Question": "问题", + "Answer": "回答", "Waiting for response...": "等待响应...", "Close the Window": "关闭窗口", "Pin the Window": "固定窗口", diff --git a/src/_locales/zh-hant/main.json b/src/_locales/zh-hant/main.json index 658d997..1a111f8 100644 --- a/src/_locales/zh-hant/main.json +++ b/src/_locales/zh-hant/main.json @@ -18,26 +18,25 @@ "Custom ChatGPT Web API Url": "自定義的ChatGPT網頁API地址", "Custom ChatGPT Web API Path": "自定義的ChatGPT網頁API路徑", "Custom OpenAI API Url": "自定義的OpenAI API地址", - "Custom Site Regex:": "自定義站點正則匹配:", - "Exclusively use Custom Site Regex for website matching,": "只使用自定義站點正則匹配,", - "ignoring built-in rules": "忽略內置站點規則", - "Input Query:": "輸入的查詢選擇器:", - "Append Query:": "掛載到末尾的查詢選擇器:", - "Prepend Query:": "插入到開頭的查詢選擇器:", + "Custom Site Regex": "自定義站點正則匹配", + "Exclusively use Custom Site Regex for website matching, ignoring built-in rules": "只使用自定義站點正則匹配, 忽略內置站點規則", + "Input Query": "輸入的查詢選擇器", + "Append Query": "掛載到末尾的查詢選擇器", + "Prepend Query": "插入到開頭的查詢選擇器", "Wechat Pay": "微信打賞", "Type your question here\nEnter to send, shift + enter to break line": "在此輸入你的問題\n回車 發送, shift+回車 換行", "Wait for the answer to finish and then continue here": "等待回答完成, 然後在此繼續", "Ask ChatGPT": "詢問ChatGPT", "No Input Found": "無輸入", - "You:": "你:", + "You": "你", "Collapse": "折疊", "Expand": "展開", "Stop": "停止", "Continue on official website": "在官網繼續", - "Error:": "錯誤:", + "Error": "錯誤", "Copy": "復製", - "Question:": "問題:", - "Answer:": "回答:", + "Question": "問題", + "Answer": "回答", "Waiting for response...": "等待響應...", "Close the Window": "關閉窗口", "Pin the Window": "固定窗口", diff --git a/src/components/ConversationCard/index.jsx b/src/components/ConversationCard/index.jsx index 31ce6a2..9016b23 100644 --- a/src/components/ConversationCard/index.jsx +++ b/src/components/ConversationCard/index.jsx @@ -230,7 +230,9 @@ function ConversationCard(props) { onClick={() => { let output = '' session.conversationRecords.forEach((data) => { - output += `Question:\n\n${data.question}\n\nAnswer:\n\n${data.answer}\n\n
\n\n` + output += `${t('Question')}:\n\n${data.question}\n\n${t('Answer')}:\n\n${ + data.answer + }\n\n
\n\n` }) const blob = new Blob([output], { type: 'text/plain;charset=utf-8' }) FileSaver.saveAs(blob, 'conversation.md') diff --git a/src/components/ConversationItem/index.jsx b/src/components/ConversationItem/index.jsx index 384f237..d5011ee 100644 --- a/src/components/ConversationItem/index.jsx +++ b/src/components/ConversationItem/index.jsx @@ -15,7 +15,7 @@ export function ConversationItem({ type, content, session, done, port }) { return (
-

{t('You:')}

+

{t('You')}:

content} size={14} /> {!collapsed ? ( @@ -104,7 +104,7 @@ export function ConversationItem({ type, content, session, done, port }) { return (
-

{t('Error:')}

+

{t('Error')}:

content} size={14} /> {!collapsed ? ( diff --git a/src/popup/Popup.jsx b/src/popup/Popup.jsx index 3bfcb38..ecfa7e9 100644 --- a/src/popup/Popup.jsx +++ b/src/popup/Popup.jsx @@ -288,7 +288,7 @@ function AdvancedPart({ config, updateConfig }) { />