From 817c57889bcaf57655e7c4c1ea2d6a3a20a45b46 Mon Sep 17 00:00:00 2001 From: mic Date: Thu, 28 Nov 2024 22:58:45 +0100 Subject: [PATCH] two prompts adde to i18n english only, see #185 --- _locales/en/messages.json | 12 ++++++++++++ js/mzta-menus.js | 2 +- js/mzta-prompts.js | 6 ++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 86842e97..05df2be5 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -698,5 +698,17 @@ "prefs_OptionText_chatgpt_web_model_tooltip": { "message": "Click on a value to set it.", "description": "" + }, + "prompt_reply_full_text": { + "message": "Reply to the following email. Reply with only the needed text and with no extra comments or other text.", + "description": "" + }, + "prompt_reply_additional_text": { + "message": "Do not add the subject line to the response.", + "description": "" + }, + "prompt_reply_advanced_full_text": { + "message": "Reply to the following email \"{%selected_text%}\", considering this is the full thread of emails \"{%mail_html_body%}\". Reply with only the needed text and with no extra comments or other text.", + "description": "" } } \ No newline at end of file diff --git a/js/mzta-menus.js b/js/mzta-menus.js index 036af6dd..745e3822 100644 --- a/js/mzta-menus.js +++ b/js/mzta-menus.js @@ -170,7 +170,7 @@ export class mzta_Menus { fullPrompt = curr_prompt.text + chatgpt_lang2 + ". \"" + body_text + "\" "; break; case 'prompt_reply': - fullPrompt += "Do not add the subject line to the response." + fullPrompt += browser.i18n.getMessage("prompt_reply_additional_text"); break; default: break; diff --git a/js/mzta-prompts.js b/js/mzta-prompts.js index 4076939b..793ce9b1 100644 --- a/js/mzta-prompts.js +++ b/js/mzta-prompts.js @@ -65,7 +65,7 @@ const defaultPrompts = [ { id: 'prompt_reply', name: "__MSG_prompt_reply__", - text: "Reply to the following email. Reply with only the needed text and with no extra comments or other text.", + text: "prompt_reply_full_text", type: "1", action: "1", need_selected: "0", @@ -77,7 +77,7 @@ const defaultPrompts = [ { id: 'prompt_reply_advanced', name: "__MSG_prompt_reply_advanced__", - text: "Reply to the following email \"{%selected_text%}\", considering this is the full thread of emails \"{%mail_html_body%}\". Reply with only the needed text and with no extra comments or other text.", + text: "prompt_reply_advanced_full_text", type: "1", action: "1", need_selected: "1", @@ -223,6 +223,7 @@ async function getDefaultPrompts_withProps() { if(prefs._default_prompts_properties === null){ // no default prompts properties saved let pos = 1; defaultPrompts_prop.forEach((prompt) => { + prompt.text = browser.i18n.getMessage(prompt.text); prompt.position_display = pos; prompt.position_compose = pos; prompt.enabled = 1; @@ -232,6 +233,7 @@ async function getDefaultPrompts_withProps() { } else { // we have saved default prompts properties let pos = 1000; defaultPrompts_prop.forEach((prompt) => { + prompt.text = browser.i18n.getMessage(prompt.text); if(prefs._default_prompts_properties?.[prompt.id]){ prompt.position_compose = prefs._default_prompts_properties[prompt.id].position_compose; prompt.position_display = prefs._default_prompts_properties[prompt.id].position_display;