From 817c57889bcaf57655e7c4c1ea2d6a3a20a45b46 Mon Sep 17 00:00:00 2001 From: mic Date: Thu, 28 Nov 2024 22:58:45 +0100 Subject: [PATCH 1/5] 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; From 01eacb64711db4cdc33ddfb69f3cbcfd93372412 Mon Sep 17 00:00:00 2001 From: mic Date: Fri, 29 Nov 2024 23:09:19 +0100 Subject: [PATCH 2/5] translared more strings. added some it strings. see #185 --- _locales/en/messages.json | 8 ++++++++ _locales/it/messages.json | 16 ++++++++++++++++ js/mzta-menus.js | 4 ++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 05df2be5..e77a3da6 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -707,6 +707,14 @@ "message": "Do not add the subject line to the response.", "description": "" }, + "reply_same_lang": { + "message": "Reply in the same language.", + "description": "" + }, + "sign_msg_as": { + "message": "Sign the message as", + "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": "" diff --git a/_locales/it/messages.json b/_locales/it/messages.json index aae9c0e6..21cfab83 100644 --- a/_locales/it/messages.json +++ b/_locales/it/messages.json @@ -694,5 +694,21 @@ "prefs_OptionText_owl_warning": { "message": "Sembra che almeno uno dei tuoi account stia utilizzando il componente aggiuntivo Gufo per Exchange. Esiste un problema noto tra Thunderbird e Gufo, che è attualmente in fase di risoluzione. Al momento, puoi utilizzare ThunderAI durante la composizione delle email, ma non durante la loro lettura.", "description": "" + }, + "prompt_reply_full_text": { + "message": "Rispondi alla seguente email. Rispondi solo con il testo necessario e senza commenti o altro testo aggiuntivo.", + "description": "" + }, + "reply_same_lang": { + "message": "Rispondi nella stessa lingua.", + "description": "" + }, + "sign_msg_as": { + "message": "Firma il messaggio come", + "description": "" + }, + "prompt_reply_additional_text": { + "message": "Non aggiungere la linea dell'oggetto alla risposta.", + "description": "" } } \ No newline at end of file diff --git a/js/mzta-menus.js b/js/mzta-menus.js index 745e3822..b0795795 100644 --- a/js/mzta-menus.js +++ b/js/mzta-menus.js @@ -107,7 +107,7 @@ export class mzta_Menus { chatgpt_lang = prefs.default_chatgpt_lang; //console.log(" >>>>>>>>>>>> chatgpt_lang: " + chatgpt_lang); if(chatgpt_lang === ''){ - chatgpt_lang = 'Reply in the same language.'; + chatgpt_lang = browser.i18n.getMessage("reply_same_lang"); }else{ chatgpt_lang = browser.i18n.getMessage("prompt_lang") + " " + chatgpt_lang + "."; } @@ -189,7 +189,7 @@ export class mzta_Menus { if(prefs.default_sign_name===''){ return ''; }else{ - return "Sign the message as " + prefs.default_sign_name + "."; + return browser.i18n.getMessage("sign_msg_as") + " " + prefs.default_sign_name + "."; } } From ee19d7d06bb16f466dcf6514cf84d48c47245556 Mon Sep 17 00:00:00 2001 From: mic Date: Sun, 8 Dec 2024 22:49:24 +0100 Subject: [PATCH 3/5] all default prompts adde to i18n translation. fixes #185 --- _locales/en/messages.json | 24 ++++++++++++++++++++++++ js/mzta-menus.js | 2 +- js/mzta-prompts.js | 12 ++++++------ 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index e77a3da6..dfd37c48 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -718,5 +718,29 @@ "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": "" + }, + "prompt_rewrite_full_text": { + "message": "Rewrite the following text to be more polite. Reply with only the re-written text and with no extra comments or other text.", + "description": "" + }, + "prompt_rewrite_formal_full_text": { + "message": "Rewrite the following text to be more formal. Reply with only the re-written text and with no extra comments or other text.", + "description": "" + }, + "prompt_classify_full_text": { + "message": "Classify the following text in terms of Politeness, Warmth, Formality, Assertiveness, Offensiveness giving a percentage for each category. Reply with only the category and score with no extra comments or other text.", + "description": "" + }, + "prompt_summarize_this_full_text": { + "message": "Summarize the following email into a bullet point list.", + "description": "" + }, + "prompt_translate_this_full_text": { + "message": "Translate the following email in", + "description": "" + }, + "prompt_this_full_text": { + "message": "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 b0795795..aaf099cc 100644 --- a/js/mzta-menus.js +++ b/js/mzta-menus.js @@ -167,7 +167,7 @@ export class mzta_Menus { if(chatgpt_lang2 === ''){ chatgpt_lang2 = getLanguageDisplayName(browser.i18n.getUILanguage()); } - fullPrompt = curr_prompt.text + chatgpt_lang2 + ". \"" + body_text + "\" "; + fullPrompt = curr_prompt.text + " " + chatgpt_lang2 + ". \"" + body_text + "\" "; break; case 'prompt_reply': fullPrompt += browser.i18n.getMessage("prompt_reply_additional_text"); diff --git a/js/mzta-prompts.js b/js/mzta-prompts.js index 793ce9b1..a01b0e76 100644 --- a/js/mzta-prompts.js +++ b/js/mzta-prompts.js @@ -89,7 +89,7 @@ const defaultPrompts = [ { id: 'prompt_rewrite_polite', name: "__MSG_prompt_rewrite_polite__", - text: "Rewrite the following text to be more polite. Reply with only the re-written text and with no extra comments or other text.", + text: "prompt_rewrite_full_text", type: "2", action: "2", need_selected: "1", @@ -101,7 +101,7 @@ const defaultPrompts = [ { id: 'prompt_rewrite_formal', name: "__MSG_prompt_rewrite_formal__", - text: "Rewrite the following text to be more formal. Reply with only the re-written text and with no extra comments or other text.", + text: "prompt_rewrite_formal_full_text", type: "2", action: "2", need_selected: "1", @@ -113,7 +113,7 @@ const defaultPrompts = [ { id: 'prompt_classify', name: "__MSG_prompt_classify__", - text: "Classify the following text in terms of Politeness, Warmth, Formality, Assertiveness, Offensiveness giving a percentage for each category. Reply with only the category and score with no extra comments or other text.", + text: "prompt_classify_full_text", type: "0", action: "0", need_selected: "0", @@ -125,7 +125,7 @@ const defaultPrompts = [ { id: 'prompt_summarize_this', name: "__MSG_prompt_summarize_this__", - text: "Summarize the following email into a bullet point list.", + text: "prompt_summarize_this_full_text", type: "0", action: "0", need_selected: "0", @@ -137,7 +137,7 @@ const defaultPrompts = [ { id: 'prompt_translate_this', name: "__MSG_prompt_translate_this__", - text: "Translate the following email in ", + text: "prompt_translate_this_full_text", type: "0", action: "0", need_selected: "0", @@ -149,7 +149,7 @@ const defaultPrompts = [ { id: 'prompt_this', name: "__MSG_prompt_this__", - text: "Reply with only the needed text and with no extra comments or other text.", + text: "prompt_this_full_text", type: "2", action: "2", need_selected: "1", From a2e8e51088cf40aea6ab2c1d4416624be33ab181 Mon Sep 17 00:00:00 2001 From: mic Date: Sun, 8 Dec 2024 22:49:44 +0100 Subject: [PATCH 4/5] defaults prompts added to it. see #185 --- _locales/it/messages.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/_locales/it/messages.json b/_locales/it/messages.json index 21cfab83..37853b8d 100644 --- a/_locales/it/messages.json +++ b/_locales/it/messages.json @@ -710,5 +710,33 @@ "prompt_reply_additional_text": { "message": "Non aggiungere la linea dell'oggetto alla risposta.", "description": "" + }, + "prompt_reply_advanced_full_text": { + "message": "Rispondi alla seguente email \"{%selected_text%}\", considerando che si tratta dell'intero thread di email \"{%mail_html_body%}\". Rispondi con solo il testo necessario e senza commenti extra o altro testo.", + "description": "" + }, + "prompt_rewrite_full_text": { + "message": "Riscrivi il seguente testo in modo più cortese. Rispondi con solo il testo riscritto e senza commenti extra o altro testo.", + "description": "" + }, + "prompt_rewrite_formal_full_text": { + "message": "Riscrivi il seguente testo in modo più formale. Rispondi con solo il testo riscritto e senza commenti extra o altro testo.", + "description": "" + }, + "prompt_classify_full_text": { + "message": "Classifica il seguente testo in termini di Cortesia, Calore, Formalità, Assertività, Offensività, assegnando una percentuale a ciascuna categoria. Rispondi con solo le categorie e i punteggi, senza commenti extra o altro testo.", + "description": "" + }, + "prompt_summarize_this_full_text": { + "message": "Riassumi la seguente email in un elenco puntato.", + "description": "" + }, + "prompt_translate_this_full_text": { + "message": "Traduci la seguente email in", + "description": "" + }, + "prompt_this_full_text": { + "message": "Rispondi con solo il testo necessario e senza commenti extra o altro testo.", + "description": "" } } \ No newline at end of file From 03d1e07b0645ea25cefbea5c453c288c81823174 Mon Sep 17 00:00:00 2001 From: mic Date: Sun, 8 Dec 2024 22:56:02 +0100 Subject: [PATCH 5/5] default prompts added to all i18n translations. see #185 --- _locales/de/messages.json | 44 ++++++++++++++++++++++++++++++++++++ _locales/fr/messages.json | 44 ++++++++++++++++++++++++++++++++++++ _locales/pt-br/messages.json | 44 ++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+) diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 73fd7e26..99968a32 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -694,5 +694,49 @@ "prefs_OptionText_owl_warning": { "message": "Es scheint, dass mindestens eines Ihrer Konten das Add-on Eule für Exchange verwendet. Es gibt ein bekanntes Problem zwischen Thunderbird und Eule, das derzeit behoben wird. Derzeit können Sie ThunderAI beim Verfassen von E-Mails verwenden, jedoch nicht beim Lesen.", "description": "" + }, + "prompt_reply_full_text": { + "message": "Antworten Sie auf die folgende E-Mail. Antworten Sie nur mit dem erforderlichen Text und ohne zusätzliche Kommentare oder anderen Text.", + "description": "" + }, + "prompt_reply_additional_text": { + "message": "Fügen Sie die Betreffzeile nicht in die Antwort ein.", + "description": "" + }, + "reply_same_lang": { + "message": "Antworten Sie in derselben Sprache.", + "description": "" + }, + "sign_msg_as": { + "message": "Unterschreiben Sie die Nachricht als", + "description": "" + }, + "prompt_reply_advanced_full_text": { + "message": "Antworten Sie auf die folgende E-Mail \"{%selected_text%}\", wobei dies der vollständige E-Mail-Thread ist \"{%mail_html_body%}\". Antworten Sie nur mit dem erforderlichen Text und ohne zusätzliche Kommentare oder anderen Text.", + "description": "" + }, + "prompt_rewrite_full_text": { + "message": "Schreiben Sie den folgenden Text höflicher um. Antworten Sie nur mit dem umgeschriebenen Text und ohne zusätzliche Kommentare oder anderen Text.", + "description": "" + }, + "prompt_rewrite_formal_full_text": { + "message": "Schreiben Sie den folgenden Text formeller um. Antworten Sie nur mit dem umgeschriebenen Text und ohne zusätzliche Kommentare oder anderen Text.", + "description": "" + }, + "prompt_classify_full_text": { + "message": "Klassifizieren Sie den folgenden Text in Bezug auf Höflichkeit, Wärme, Formalität, Bestimmtheit und Anstößigkeit und geben Sie einen Prozentsatz für jede Kategorie an. Antworten Sie nur mit den Kategorien und den Werten, ohne zusätzliche Kommentare oder anderen Text.", + "description": "" + }, + "prompt_summarize_this_full_text": { + "message": "Fassen Sie die folgende E-Mail in einer Liste mit Stichpunkten zusammen.", + "description": "" + }, + "prompt_translate_this_full_text": { + "message": "Übersetzen Sie die folgende E-Mail ins", + "description": "" + }, + "prompt_this_full_text": { + "message": "Antworten Sie nur mit dem erforderlichen Text und ohne zusätzliche Kommentare oder anderen Text.", + "description": "" } } \ No newline at end of file diff --git a/_locales/fr/messages.json b/_locales/fr/messages.json index a9c12168..1f218da7 100644 --- a/_locales/fr/messages.json +++ b/_locales/fr/messages.json @@ -694,5 +694,49 @@ "prefs_OptionText_owl_warning": { "message": "Il semble qu'au moins un de vos comptes utilise le module complémentaire Chouette pour Exchange. Il existe un problème connu entre Thunderbird et Chouette, qui est en cours de résolution. Pour le moment, vous pouvez utiliser ThunderAI lors de la rédaction d'e-mails, mais pas lors de leur lecture.", "description": "" + }, + "prompt_reply_full_text": { + "message": "Répondez à l'email suivant. Répondez uniquement avec le texte nécessaire et sans commentaires ou autres textes supplémentaires.", + "description": "" + }, + "prompt_reply_additional_text": { + "message": "Ne pas ajouter la ligne d'objet à la réponse.", + "description": "" + }, + "reply_same_lang": { + "message": "Répondez dans la même langue.", + "description": "" + }, + "sign_msg_as": { + "message": "Signez le message en tant que", + "description": "" + }, + "prompt_reply_advanced_full_text": { + "message": "Répondez à l'email suivant \"{%selected_text%}\", en tenant compte du fait qu'il s'agit de l'intégralité du fil de discussion \"{%mail_html_body%}\". Répondez uniquement avec le texte nécessaire et sans commentaires ou autres textes supplémentaires.", + "description": "" + }, + "prompt_rewrite_full_text": { + "message": "Réécrivez le texte suivant pour qu'il soit plus poli. Répondez uniquement avec le texte réécrit et sans commentaires ou autres textes supplémentaires.", + "description": "" + }, + "prompt_rewrite_formal_full_text": { + "message": "Réécrivez le texte suivant pour qu'il soit plus formel. Répondez uniquement avec le texte réécrit et sans commentaires ou autres textes supplémentaires.", + "description": "" + }, + "prompt_classify_full_text": { + "message": "Classifiez le texte suivant en termes de Politesse, Chaleur, Formalité, Assertivité, Offensivité en donnant un pourcentage pour chaque catégorie. Répondez uniquement avec les catégories et les scores, sans commentaires ou autres textes supplémentaires.", + "description": "" + }, + "prompt_summarize_this_full_text": { + "message": "Résumé l'email suivant sous forme de liste à puces.", + "description": "" + }, + "prompt_translate_this_full_text": { + "message": "Traduisez l'email suivant en", + "description": "" + }, + "prompt_this_full_text": { + "message": "Répondez uniquement avec le texte nécessaire et sans commentaires ou autres textes supplémentaires.", + "description": "" } } \ No newline at end of file diff --git a/_locales/pt-br/messages.json b/_locales/pt-br/messages.json index fc0613d1..de11ee1c 100644 --- a/_locales/pt-br/messages.json +++ b/_locales/pt-br/messages.json @@ -694,5 +694,49 @@ "prefs_OptionText_owl_warning": { "message": "Parece que pelo menos uma das suas contas está usando o complemento Coruja para Exchange. Existe um problema conhecido entre Thunderbird e Coruja, que está sendo resolvido no momento. Por enquanto, você pode usar o ThunderAI ao redigir e-mails, mas não ao lê-los.", "description": "" + }, + "prompt_reply_full_text": { + "message": "Responda ao e-mail a seguir. Responda apenas com o texto necessário e sem comentários adicionais ou outros textos.", + "description": "" + }, + "prompt_reply_additional_text": { + "message": "Não adicione a linha de assunto à resposta.", + "description": "" + }, + "reply_same_lang": { + "message": "Responda no mesmo idioma.", + "description": "" + }, + "sign_msg_as": { + "message": "Assine a mensagem como", + "description": "" + }, + "prompt_reply_advanced_full_text": { + "message": "Responda ao seguinte e-mail \"{%selected_text%}\", considerando que este é o thread completo de e-mails \"{%mail_html_body%}\". Responda apenas com o texto necessário e sem comentários adicionais ou outros textos.", + "description": "" + }, + "prompt_rewrite_full_text": { + "message": "Reescreva o texto a seguir de forma mais educada. Responda apenas com o texto reescrito e sem comentários adicionais ou outros textos.", + "description": "" + }, + "prompt_rewrite_formal_full_text": { + "message": "Reescreva o texto a seguir de forma mais formal. Responda apenas com o texto reescrito e sem comentários adicionais ou outros textos.", + "description": "" + }, + "prompt_classify_full_text": { + "message": "Classifique o texto a seguir em termos de Educação, Calor, Formalidade, Assertividade e Ofensividade, atribuindo uma porcentagem para cada categoria. Responda apenas com as categorias e as pontuações, sem comentários adicionais ou outros textos.", + "description": "" + }, + "prompt_summarize_this_full_text": { + "message": "Resuma o e-mail a seguir em uma lista de tópicos.", + "description": "" + }, + "prompt_translate_this_full_text": { + "message": "Traduza o e-mail a seguir para", + "description": "" + }, + "prompt_this_full_text": { + "message": "Responda apenas com o texto necessário e sem comentários adicionais ou outros textos.", + "description": "" } } \ No newline at end of file