commit 000d727a34a7256d993662ce848112c419520860 Author: Arthur Edelstein arthuredelstein@gmail.com Date: Fri Dec 5 16:08:21 2014 -0800
Bug #13881. Localize strings for tor circuit display --- src/chrome/content/popup.xul | 2 +- src/chrome/content/tor-circuit-display.js | 20 ++++++++++++++++---- src/chrome/locale/en/torbutton.dtd | 1 + src/chrome/locale/en/torbutton.properties | 5 +++++ 4 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/src/chrome/content/popup.xul b/src/chrome/content/popup.xul index 2965ec5..5f12f2b 100644 --- a/src/chrome/content/popup.xul +++ b/src/chrome/content/popup.xul @@ -51,7 +51,7 @@ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" baseProfile="full" width="290" height="140" id="tor-circuit" style="display:none;"> <rect x="0" y="0" width="100%" height="100%" fill="#e8f4f4" /> - <text id="title" style="font-size:14px;font-weight:bold;" x="10" y="20" fill="#2c26a7">Tor circuit for this site</text> + <text id="title" style="font-size:14px;font-weight:bold;" x="10" y="20" fill="#2c26a7">&torbutton.circuit_display.title;</text> <text id="domain" style="font-size:13px;" x="10" y="38" fill="black">(trac.torproject.org):</text> <rect x="18.5" width="3" y="56" height="64" fill="#4d363a" stroke-width="0"/> <circle class="node-circle" cx="20" cy="56" r="4" /> diff --git a/src/chrome/content/tor-circuit-display.js b/src/chrome/content/tor-circuit-display.js index 4c31bc6..d0977f1 100644 --- a/src/chrome/content/tor-circuit-display.js +++ b/src/chrome/content/tor-circuit-display.js @@ -151,6 +151,17 @@ let collectIsolationData = function (aController) {
// ## User interface
+// __torbuttonBundle__. +// Bundle of localized strings for torbutton UI. +let torbuttonBundle = Services.strings.createBundle( + "chrome://torbutton/locale/torbutton.properties"); + +// __uiString__. +// Read the localized strings for this UI. +let uiString = function (shortName) { + return torbuttonBundle.GetStringFromName("torbutton.circuit_display." + shortName); +}; + // __regionBundle__. // A list of localized region (country) names. let regionBundle = Services.strings.createBundle( @@ -181,14 +192,15 @@ let showCircuitDisplay = function (show) { // and converts each node data to text, as // `"France (12.34.56.78)"`. let nodeLines = function (nodeData) { - let result = ["This browser"]; + let result = [uiString("this_browser")]; for (let {ip, countryCode, type} of nodeData) { let bridge = type === "bridge"; result.push((countryCode ? localizedCountryNameFromCode(countryCode) - : "Unknown country") + - " (" + (bridge ? "Bridge" : (ip || "IP unknown")) + ")"); + : uiString("unknown_country")) + + " (" + (bridge ? uiString("tor_bridge") + : (ip || uiString("ip_unknown"))) + ")"); } - result[4] = "Internet"; + result[4] = uiString("internet"); return result; };
diff --git a/src/chrome/locale/en/torbutton.dtd b/src/chrome/locale/en/torbutton.dtd index 283032b..72c7d41 100644 --- a/src/chrome/locale/en/torbutton.dtd +++ b/src/chrome/locale/en/torbutton.dtd @@ -155,3 +155,4 @@ <!ENTITY torbutton.prefs.sec_med_high "Medium-High"> <!ENTITY torbutton.prefs.sec_high "High"> <!ENTITY torbutton.prefs.sec_custom "Custom Values"> +<!ENTITY torbutton.circuit_display.title "Tor circuit for this site"> diff --git a/src/chrome/locale/en/torbutton.properties b/src/chrome/locale/en/torbutton.properties index c76be32..c3e85a3 100644 --- a/src/chrome/locale/en/torbutton.properties +++ b/src/chrome/locale/en/torbutton.properties @@ -1,5 +1,10 @@ torbutton.button.tooltip.disabled = Enable Tor torbutton.button.tooltip.enabled = Disable Tor +torbutton.circuit_display.internet = Internet +torbutton.circuit_display.ip_unknown = IP unknown +torbutton.circuit_display.this_browser = This browser +torbutton.circuit_display.tor_bridge = Bridge +torbutton.circuit_display.unknown_country = Unknown country torbutton.panel.tooltip.disabled = Click to enable Tor torbutton.panel.tooltip.enabled = Click to disable Tor torbutton.panel.plugins.disabled = Click to enable plugins