guides and tutorial links localized

This commit is contained in:
mic 2026-03-06 23:41:49 +01:00
parent 931e95d314
commit 4f738b7ce6
5 changed files with 22 additions and 5 deletions

View file

@ -19,6 +19,7 @@
import { prefs_default, getDynamicSettingValue } from '../options/mzta-options-default.js';
const sparks_min = '1.2.0'; // Minimum version of ThunderAI-Sparks required for the add-on to work
export const ChatGPTWeb_models = ['gpt-5','gpt-5-instant','gpt-5-t-mini','gpt-5-thinking']; // List of models available in ChatGPT Web
const MICZ_IT_LOCALIZED_LANGS = ['es', 'de', 'fr', 'it'];
export const getMenuContextCompose = () => 'compose_action_menu';
export const getMenuContextDisplay = () => 'message_display_action_menu';
@ -38,6 +39,13 @@ export function getLanguageDisplayName(languageCode) {
return lang_string.charAt(0).toUpperCase() + lang_string.slice(1);
}
export function getMiczItUrl(path) {
const lang = browser.i18n.getUILanguage().split('-')[0];
console.log(">>>>>>>>>>>>>>>> lang: " + lang);
const prefix = MICZ_IT_LOCALIZED_LANGS.includes(lang) ? `${lang}/` : '';
return `https://micz.it/${prefix}${path}`;
}
function fixMsgHeader(msgHeader) {
if (!msgHeader.bccList) {
msgHeader.bccList = [];

View file

@ -20,8 +20,8 @@
<div id="mzta_doc_block">
<span class="doc_title">__MSG_prefs_doc_title__</span>
<div class="doc_links">
<a href="https://micz.it/thunderbird-addon-thunderai/guides/">__MSG_prefs_doc_setup_guide__</a>
<a href="https://micz.it/thunderbird-addon-thunderai/tutorial/">__MSG_prefs_doc_custom_prompt_tutorial__</a>
<a id="link_doc_guides" href="#">__MSG_prefs_doc_setup_guide__</a>
<a id="link_doc_tutorial" href="#">__MSG_prefs_doc_custom_prompt_tutorial__</a>
</div>
<div class="doc_welcome">
<a href="#" id="btn_welcome">__MSG_prefs_doc_open_welcome__</a>

View file

@ -25,7 +25,8 @@ import {
getChatGPTWebModelsList_HTML,
isAPIKeyValue,
getConnectionType,
setTomSelectBorder
setTomSelectBorder,
getMiczItUrl
} from '../js/mzta-utils.js';
import {
injectConnectionUI,
@ -240,6 +241,10 @@ document.addEventListener('DOMContentLoaded', async () => {
}
i18n.updateDocument();
document.getElementById('link_doc_guides').href = getMiczItUrl('thunderbird-addon-thunderai/guides/');
document.getElementById('link_doc_tutorial').href = getMiczItUrl('thunderbird-addon-thunderai/tutorial/');
document.querySelectorAll(".option-input").forEach(element => {
element.addEventListener("change", saveOptions);
});

View file

@ -26,8 +26,8 @@
<div class="content">
<div id="onboarding_doc_panel">
<span class="doc_panel_title">__MSG_prefs_doc_title__</span>
<a href="https://micz.it/thunderbird-addon-thunderai/guides/" target="_blank">__MSG_prefs_doc_setup_guide__</a>
<a href="https://micz.it/thunderbird-addon-thunderai/tutorial/" target="_blank">__MSG_prefs_doc_custom_prompt_tutorial__</a>
<a id="link_doc_guides" href="#" target="_blank">__MSG_prefs_doc_setup_guide__</a>
<a id="link_doc_tutorial" href="#" target="_blank">__MSG_prefs_doc_custom_prompt_tutorial__</a>
</div>
<div class="section header">
<h1><img src="../../images/icon.png" class="title-icon"/>ThunderAI</h1>

View file

@ -18,6 +18,7 @@
import { taLogger } from '../../js/mzta-logger.js';
import { prefs_default } from '../../options/mzta-options-default.js';
import { getMiczItUrl } from '../../js/mzta-utils.js';
let taLog = null;
@ -28,6 +29,9 @@ document.addEventListener('DOMContentLoaded', async () => {
});
taLog = new taLogger("mzta-popup",prefs.do_debug);
i18n.updateDocument();
document.getElementById('link_doc_guides').href = getMiczItUrl('thunderbird-addon-thunderai/guides/');
document.getElementById('link_doc_tutorial').href = getMiczItUrl('thunderbird-addon-thunderai/tutorial/');
if(prefs.connection_type === 'chatgpt_web'){
let permission_chatgpt = await messenger.permissions.contains({ origins: ["https://*.chatgpt.com/*"] });
if(permission_chatgpt === false){