diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index 013d3bdba..fb71ca320 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -38,7 +38,8 @@ "aiContinueWrite": "Continue writing", "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", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index de6f335ec..37eceb224 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -38,7 +38,8 @@ "aiContinueWrite": "Continuar escribiendo", "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", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index 848c23988..4261628ac 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -38,7 +38,8 @@ "aiContinueWrite": "Continuer à écrire", "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", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index 8c59e099f..095a9aff7 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -38,7 +38,8 @@ "aiContinueWrite": "續寫", "aiTranslate": "翻譯", "aiExtractSummary": "提取摘要", - "aiTranslate_zh_CN": "中文", + "aiTranslate_zh_Hans": "簡體中文", + "aiTranslate_zh_Hant": "繁體中文", "aiTranslate_ja_JP": "日文", "aiTranslate_ko_KR": "韓文", "aiTranslate_en_US": "英文", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 6e0bad5db..3bd638850 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -38,7 +38,8 @@ "aiContinueWrite": "续写", "aiTranslate": "翻译", "aiExtractSummary": "提取摘要", - "aiTranslate_zh_CN": "中文", + "aiTranslate_zh_Hans": "简体中文", + "aiTranslate_zh_Hant": "繁体中文", "aiTranslate_ja_JP": "日文", "aiTranslate_ko_KR": "韩文", "aiTranslate_en_US": "英文", diff --git a/app/src/ai/actions.ts b/app/src/ai/actions.ts index 28499ccca..20b5aedf1 100644 --- a/app/src/ai/actions.ts +++ b/app/src/ai/actions.ts @@ -151,11 +151,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); }); @@ -166,10 +177,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); }); } }, { @@ -178,7 +188,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); }); @@ -189,7 +199,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); }); @@ -200,7 +210,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); }); @@ -211,7 +221,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); }); @@ -222,7 +232,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); });