diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 4f1f9ddc..c12729ca 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -819,7 +819,7 @@ "message": "Save", "description": "" }, - "addtags_info_limit_num": { + "addtags_info_additional_statements": { "message": "This statement will be added at the end of the prompt:", "description": "" }, @@ -882,5 +882,17 @@ "OpenAIComp_force_model_ask": { "message": "Insert here the model name you want to use.", "description": "" + }, + "prefs_OptionText_add_tags_force_lang": { + "message": "Force language", + "description": "" + }, + "prefs_OptionText_add_tags_force_lang_Info": { + "message": "If checked, the tags language will be forced to match the language defined on the add-on options page, if specified.", + "description": "" + }, + "prompt_add_tags_force_lang": { + "message": "The tags must be written in ", + "description": "" } } \ No newline at end of file diff --git a/js/mzta-menus.js b/js/mzta-menus.js index 7131e740..ee388fa1 100644 --- a/js/mzta-menus.js +++ b/js/mzta-menus.js @@ -182,7 +182,7 @@ export class mzta_Menus { } // console.log(">>>>>>>>>> finalSubs: " + JSON.stringify(finalSubs)); let prefs_ph = await browser.storage.sync.get({placeholders_use_default_value: false}); - fullPrompt = placeholdersUtils.replacePlaceholders(curr_prompt.text, finalSubs, prefs_ph.placeholders_use_default_value, true) + (String(curr_prompt.need_signature) == "1" ? " " + await this.getDefaultSignature():"") + " " + chatgpt_lang; + fullPrompt = (placeholdersUtils.replacePlaceholders(curr_prompt.text, finalSubs, prefs_ph.placeholders_use_default_value, true) + (String(curr_prompt.need_signature) == "1" ? " " + await this.getDefaultSignature():"") + " " + chatgpt_lang).trim(); } switch(curr_prompt.id){ @@ -208,7 +208,7 @@ export class mzta_Menus { switch(curr_prompt.id){ case 'prompt_add_tags': // Add tags to the email let mail_tags = ''; - let prefs_at = await browser.storage.sync.get({add_tags_maxnum: 3, connection_type: ''}); + let prefs_at = await browser.storage.sync.get({add_tags_maxnum: 3, connection_type: '', add_tags_force_lang: true, default_chatgpt_lang: ''}); if((prefs_at.connection_type === '')||(prefs_at.connection_type === null)||(prefs_at.connection_type === undefined)||(prefs_at.connection_type === 'chatgpt_web')){ console.error("[ThunderAI | AddTags] Invalid connection type: " + prefs_at.connection_type); return {ok:'0'}; @@ -217,6 +217,9 @@ export class mzta_Menus { if(add_tags_maxnum > 0){ fullPrompt += " " + browser.i18n.getMessage("prompt_add_tags_maxnum") + " " + add_tags_maxnum +"."; } + if(prefs_at.add_tags_force_lang && prefs_at.default_chatgpt_lang !== ''){ + fullPrompt += " " + browser.i18n.getMessage("prompt_add_tags_force_lang") + " " + prefs_at.default_chatgpt_lang + "."; + } this.logger.log("fullPrompt: " + fullPrompt); // TODO: use the current API, abort if using chatgpt web // COMMENTED TO DO TESTS diff --git a/options/mzta-options-default.js b/options/mzta-options-default.js index d4a1b671..da3703e7 100644 --- a/options/mzta-options-default.js +++ b/options/mzta-options-default.js @@ -41,4 +41,5 @@ export const prefs_default = { add_tags_maxnum: 3, add_tags_hide_exclusions: false, add_tags_first_uppercase: true, + add_tags_force_lang: true, } \ No newline at end of file diff --git a/pages/addtags/mzta-add-tags.css b/pages/addtags/mzta-add-tags.css index bb2204d8..c012a1a7 100644 --- a/pages/addtags/mzta-add-tags.css +++ b/pages/addtags/mzta-add-tags.css @@ -27,7 +27,7 @@ justify-content: space-between; } -#addtags_info_limit_num{ +#addtags_info_additional_statements{ display: none; } diff --git a/pages/addtags/mzta-add-tags.html b/pages/addtags/mzta-add-tags.html index 85a20ce0..c85d8b06 100644 --- a/pages/addtags/mzta-add-tags.html +++ b/pages/addtags/mzta-add-tags.html @@ -40,6 +40,15 @@ +