AI translation adds support for Traditional Chinese

* 🎨 AI translation support `Traditional Chinese`

* Update actions.ts
This commit is contained in:
颖逸 2023-04-06 08:34:31 +08:00 committed by GitHub
parent b2599d6750
commit 7b34ca0855
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 10 deletions

View file

@ -39,6 +39,8 @@
"aiTranslate": "Translate",
"aiExtractSummary": "Extract summary",
"aiTranslate_zh_CN": "Chinese",
"aiTranslate_zh_Hans": "Simplified Chinese",
"aiTranslate_zh_Hant": "Traditional Chinese",
"aiTranslate_ja_JP": "Japanese",
"aiTranslate_ko_KR": "Korean",
"aiTranslate_en_US": "English",

View file

@ -39,6 +39,8 @@
"aiTranslate": "Traducir",
"aiExtractSummary": "Extraer resumen",
"aiTranslate_zh_CN": "Chino",
"aiTranslate_zh_Hans": "Chino simplificado",
"aiTranslate_zh_Hant": "Chino tradicional",
"aiTranslate_ja_JP": "Japonés",
"aiTranslate_ko_KR": "Coreano",
"aiTranslate_en_US": "Inglés",

View file

@ -39,6 +39,8 @@
"aiTranslate": "Traduire",
"aiExtractSummary": "Résumé de l'extrait",
"aiTranslate_zh_CN": "Chinois",
"aiTranslate_zh_Hans": "Chinois simplifié",
"aiTranslate_zh_Hant": "chinois traditionnel",
"aiTranslate_ja_JP": "Japonais",
"aiTranslate_ko_KR": "Coréen",
"aiTranslate_en_US": "Anglais",

View file

@ -39,6 +39,8 @@
"aiTranslate": "翻譯",
"aiExtractSummary": "提取摘要",
"aiTranslate_zh_CN": "中文",
"aiTranslate_zh_Hans": "簡體中文",
"aiTranslate_zh_Hant": "繁體中文",
"aiTranslate_ja_JP": "日文",
"aiTranslate_ko_KR": "韓文",
"aiTranslate_en_US": "英文",

View file

@ -39,6 +39,8 @@
"aiTranslate": "翻译",
"aiExtractSummary": "提取摘要",
"aiTranslate_zh_CN": "中文",
"aiTranslate_zh_Hans": "简体中文",
"aiTranslate_zh_Hant": "繁体中文",
"aiTranslate_ja_JP": "日文",
"aiTranslate_ko_KR": "韩文",
"aiTranslate_en_US": "英文",

View file

@ -155,11 +155,22 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
type: "submenu",
submenu: [{
iconHTML: Constants.ZWSP,
label: window.siyuan.languages.aiTranslate_zh_CN,
label: window.siyuan.languages.aiTranslate_zh_Hans,
click() {
fetchPost("/api/ai/chatGPTWithAction", {
ids,
action: "Translate as follows to [zh_CN]"
action: "Translate as follows to [zh-Hans]"
}, (response) => {
fillContent(protyle, response.data, elements);
});
}
}, {
iconHTML: Constants.ZWSP,
label: window.siyuan.languages.aiTranslate_zh_Hant,
click() {
fetchPost("/api/ai/chatGPTWithAction", {
ids,
action: "Translate as follows to [zh-Hant]"
}, (response) => {
fillContent(protyle, response.data, elements);
});
@ -170,10 +181,9 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
click() {
fetchPost("/api/ai/chatGPTWithAction", {
ids,
action: "Translate as follows to [ja_JP]"
action: "Translate as follows to [ja-JP]"
}, (response) => {
focusByRange(protyle.toolbar.range);
insertHTML(response.data, protyle, true);
fillContent(protyle, response.data, elements);
});
}
}, {
@ -182,7 +192,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
click() {
fetchPost("/api/ai/chatGPTWithAction", {
ids,
action: "Translate as follows to [ko_KR]"
action: "Translate as follows to [ko-KR]"
}, (response) => {
fillContent(protyle, response.data, elements);
});
@ -193,7 +203,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
click() {
fetchPost("/api/ai/chatGPTWithAction", {
ids,
action: "Translate as follows to [en_US]"
action: "Translate as follows to [en-US]"
}, (response) => {
fillContent(protyle, response.data, elements);
});
@ -204,7 +214,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
click() {
fetchPost("/api/ai/chatGPTWithAction", {
ids,
action: "Translate as follows to [es_ES]"
action: "Translate as follows to [es-ES]"
}, (response) => {
fillContent(protyle, response.data, elements);
});
@ -215,7 +225,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
click() {
fetchPost("/api/ai/chatGPTWithAction", {
ids,
action: "Translate as follows to [fr_FR]"
action: "Translate as follows to [fr-FR]"
}, (response) => {
fillContent(protyle, response.data, elements);
});
@ -226,7 +236,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
click() {
fetchPost("/api/ai/chatGPTWithAction", {
ids,
action: "Translate as follows to [de_DE]"
action: "Translate as follows to [de-DE]"
}, (response) => {
fillContent(protyle, response.data, elements);
});