From e2b631fafa580feb2e5339247f4e145bc115be4b Mon Sep 17 00:00:00 2001 From: idk Date: Fri, 3 Jan 2020 17:19:05 -0500 Subject: [PATCH] localize the menu stuff --- _locales/en/messages.json | 82 ++++++++++++++++++++++++++++++++++++++- content.js | 54 ++++++++++++++++++-------- home.css | 1 + proxy.js | 2 + window.html | 60 ++++++++++++++++------------ 5 files changed, 158 insertions(+), 41 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index b64626d..355c606 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -4,9 +4,89 @@ "description": "Name of the extension." }, "extensionDescription": { - "message": "Set up a browser to use the i2p http proxy automatically", + "message": "Your browser is now set up to use I2P.", "description": "Description of the extension." }, + "extensionStatus": { + "message": "It is a labs project for enhancing your I2P browsing experience.", + "description": "Release status of the extension." + }, + "proxyFailedStatus": { + "message": "Proxy is not ready", + "description": "Proxy failed status." + }, + "controlHeader": { + "message": "Control", + "description": "Headline for control panel." + }, + "controlExplain": { + "message": "These controls are used to tailor your I2P Browsing Experience", + "description": "Introduce the control panel." + }, + "clearData": { + "message": "Clear Browsing Data: ", + "description": "Clear Browsing Data menu item." + }, + "clearDesc": { + "message": "Use this to erase your I2P browsing data.", + "description": "Clear browsing data action description." + }, + "enableWebRTC": { + "message": "Enable WebRTC with proxy?", + "description": "WebRTC checkbox label." + }, + "rtcDesc": { + "message": "WebRTC is disabled by default, but you can turn it back on and force it to honor the proxy.", + "description": "WebRTC action description" + }, + "disableHistory": { + "message": "Disable History in I2P Tabs?", + "description": "History checkbox label." + }, + "histDesc": { + "message": "History is automatically cleared when your I2P tabs are closed. If you want to clear history as you go, check this box.", + "description": "History action description" + }, + "applicationHeader": { + "message": "Applications", + "description": "Header for applications section." + }, + "applicationExplain": { + "message": "These applications work with I2P directly to provide them with security and privacy.", + "description": "Description for application section." + }, + "windowVisitHomepage": { + "message": "Home Page: ", + "description": "Home page for the extension label." + }, + "abouthome": { + "message": "For more information about this extension, visit this page.", + "description": "Description for the extension button page." + }, + "windowVisitI2ptunnel": { + "message": "Hidden Services Manager: ", + "description": "" + }, + "i2ptunnel": { + "message": "I2P has a web-based interface for configuring .i2p services like web sites which you can set up.", + "description": "" + }, + "windowVisitSusimail": { + "message": "E-Mail: ", + "description": "" + }, + "susimail": { + "message": "I2P also bundles a webmail client which can be used to access in-I2P e-mail.", + "description": "" + }, + "windowVisitSnark": { + "message": "Bittorrent: ", + "description": "" + }, + "snark": { + "message": "I2P is capable of anonymous Peer-to-Peer file sharing using the built-in bittorrent application.", + "description": "" + }, "titlePreface": { "message": "I2P Browser", "description": "Preface for the browser titlebar" diff --git a/content.js b/content.js index 92d6ea4..4f0f73f 100644 --- a/content.js +++ b/content.js @@ -1,19 +1,41 @@ -var infoTitle = document.getElementById("text-section-header"); -infoTitle.textContent = chrome.i18n.getMessage("infoTitle"); -/* -var helpMessage = document.getElementById("window-create-forum-panel"); -helpMessage.textContent = chrome.i18n.getMessage("forumMessage"); -*/ -/* -var helpMessage = document.getElementById('window-create-help-panel'); -helpMessage.textContent = chrome.i18n.getMessage("helpMessage") -*/ -/* -var newsMessage = document.getElementById("window-create-news-panel"); -newsMessage.textContent = chrome.i18n.getMessage("newsMessage"); -*/ -var clearData = document.getElementById("clear-browser-data"); -clearData.textContent = chrome.i18n.getMessage("clearData"); +function contentUpdateById(id, message) { + let infoTitle = document.getElementById(id); + let messageContent = chrome.i18n.getMessage(message); + if (infoTitle === null) { + console.log("content error", id, message); + console.log("content error", messageContent); + } + infoTitle.textContent = messageContent; +} + +// Information Section +contentUpdateById("text-section-header", "extensionName"); +contentUpdateById("description", "extensionDescription"); +contentUpdateById("beta", "extensionStatus"); +contentUpdateById("proxy-check", "proxyFailedStatus"); + +// Control Section +contentUpdateById("controlHeader", "controlHeader"); +contentUpdateById("controlExplain", "controlExplain"); +contentUpdateById("clear-browser-data", "clearData"); +contentUpdateById("clear-desc", "clearDesc"); +contentUpdateById("enable-web-rtc", "enableWebRTC"); +contentUpdateById("rtcDesc", "rtcDesc"); +contentUpdateById("disable-history", "disableHistory"); +contentUpdateById("histDesc", "histDesc"); + +// Application Section +contentUpdateById("applicationHeader", "applicationHeader"); +contentUpdateById("applicationExplain", "applicationExplain"); +contentUpdateById("window-visit-homepage", "windowVisitHomepage"); +contentUpdateById("abouthome", "abouthome"); +contentUpdateById("window-visit-i2ptunnel", "windowVisitI2ptunnel"); +contentUpdateById("i2ptunnel", "i2ptunnel"); +contentUpdateById("window-visit-susimail", "windowVisitSusiMail"); +contentUpdateById("susimail", "susimail"); +contentUpdateById("window-visit-snark", "windowVisitSnark"); +contentUpdateById("snark", "snark"); + /* document.addEventListener("click", e => { browser.runtime.sendMessage({ url: "http://proxy.i2p" }); diff --git a/home.css b/home.css index 2b638b8..9fdf1f3 100644 --- a/home.css +++ b/home.css @@ -204,6 +204,7 @@ li { box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc } #applicationExplain, +#controlExplain, #linksExplain { min-height: 5rem; padding: .5rem; diff --git a/proxy.js b/proxy.js index 1b8b3cb..6007ca5 100644 --- a/proxy.js +++ b/proxy.js @@ -127,6 +127,8 @@ var handleContextProxyRequest = async function(requestDetails) { port: getPort() }; return proxy; + } else if (extensionHost(requestDetails.url)) { + return; } else if (i2pHost(requestDetails.url)) { console.log("(Proxy)I2P URL detected, "); var tab = tabGet(requestDetails.tabId); diff --git a/window.html b/window.html index ba3d7ea..c5c614c 100644 --- a/window.html +++ b/window.html @@ -16,7 +16,7 @@

You are now able to use I2P in this browser.

-

It is experimental.

+

It is experimental.

Proxy is not ready. @@ -28,18 +28,18 @@

-

Controls

-

These controls are used to tailor your I2P Browsing Experience

+

Controls

+

These controls are used to tailor your I2P Browsing Experience

    - -
  • - Clear Browsing Data: Use this to erase your browsing data. -
  • -
    +
  • + + Clear Browsing Data: + Use this to erase your browsing data. +
  • - WebRTC is disabled by default, but can be enabled by checking this box. + WebRTC is disabled by default, but can be enabled by checking this box.
  • @@ -48,8 +48,8 @@
  • - - History is automatically cleared when your I2P tabs are closed. If you want to clear history as you go, check this box. + + History is automatically cleared when your I2P tabs are closed. If you want to clear history as you go, check this box.

@@ -58,21 +58,33 @@

-

Applications

+

Applications

These applications use I2P to provide them with security and privacy.

    -
  • -
  • -
  • -
  • +
  • + + For more information about this extension, go here: +
  • +
  • + + I2P has a web-based interface for configuring .i2p services like web sites, to set up your own web sites, go here: +
  • +
  • + + I2P also bundles a webmail client which can be used to access in-I2P e-mail. To use it, go here: +
  • +
  • + + I2P is capable of anonymous Peer-to-Peer file sharing, to use the built-in bittorrent client go here: +