Implement final string correctly with browser.i18n

This commit is contained in:
Lesley Norton 2021-10-28 13:57:27 -05:00
parent b9f69e2b99
commit cb30ac0bbc
No known key found for this signature in database
GPG key ID: E98FBAEE3F13956E
2 changed files with 6 additions and 3 deletions

View file

@ -10,6 +10,7 @@ const MozillaVPN = {
return;
}
const tooltipProxyWarning = browser.i18n.getMessage("tooltipWarning");
for (const el of document.querySelectorAll("[data-cookie-store-id]")) {
const cookieStoreId = el.dataset.cookieStoreId;
@ -28,6 +29,10 @@ const MozillaVPN = {
}
if (!mozillaVpnConnected && proxy.mozProxyEnabled) {
flag.classList.add("proxy-unavailable");
const tooltip = el.querySelector(".tooltip.proxy-unavailable");
if (tooltip) {
tooltip.textContent = tooltipProxyWarning;
}
const menuItemName = el.querySelector(".menu-item-name");
if (menuItemName) {
el.querySelector(".menu-item-name").dataset.mozProxyWarning = "proxy-unavailable";

View file

@ -749,7 +749,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
</div>
</div>
<span class="menu-text">${identity.name}</span>
<span class="tooltip proxy-unavailable">This container has been configured to use a Mozilla VPN proxy, but Mozilla VPN is not on. Turn Mozilla VPN on to use this proxy.</span>
<span class="tooltip proxy-unavailable"></span>
</div>
<span class="menu-right-float">
<img alt="" class="always-open-in-flag flag-img" src="/img/flags/.png"/>
@ -767,8 +767,6 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
tr.appendChild(td);
const openInThisContainer = tr.querySelector(".menu-item-name");
// const mozProxyWarning = await MozillaVPN.getProxyWarnings(proxies[identity.cookieStoreId]);
// openInThisContainer.dataset.mozProxyWarning = mozProxyWarning;
Utils.addEnterHandler(openInThisContainer, (e) => {
e.preventDefault();
if (openInThisContainer.dataset.mozProxyWarning === "proxy-unavailable") {