[tbb-commits] [torbutton/maint-1.9.6] Bug 21574.2: Generate manual link dynamically

gk at torproject.org gk at torproject.org
Wed Mar 1 20:48:50 UTC 2017


commit d88941861a506204d5f453114fb4b0e2cf20a9ea
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date:   Mon Feb 27 08:40:15 2017 -0800

    Bug 21574.2: Generate manual link dynamically
---
 src/chrome/content/aboutTor/aboutTor.xhtml | 8 ++++++--
 src/chrome/content/menu-overlay.xul        | 2 +-
 src/chrome/locale/en/aboutTor.dtd          | 1 -
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/chrome/content/aboutTor/aboutTor.xhtml b/src/chrome/content/aboutTor/aboutTor.xhtml
index 6082588..e4050fc 100644
--- a/src/chrome/content/aboutTor/aboutTor.xhtml
+++ b/src/chrome/content/aboutTor/aboutTor.xhtml
@@ -23,10 +23,15 @@
         href="chrome://torbutton/skin/aboutTor.css"/>
 <script type="text/javascript;version=1.7">
  <![CDATA[
+Components.utils.import("resource://gre/modules/Services.jsm");
+
 function onLoad()
 {
   insertPropertyStrings();
 
+  let locale = Services.prefs.getCharPref("general.useragent.locale");
+  document.getElementById("manualLink").href = "https://tb-manual.torproject.org/" + locale;
+
   document.addEventListener("AboutTorAdjustArrow", function() {
     adjustToolbarIconArrow();
   }, false);
@@ -141,7 +146,6 @@ function insertPropertyStrings()
   try {
     let kPropertiesURL = "chrome://torbutton/locale/aboutTor.properties";
 
-    Components.utils.import("resource://gre/modules/Services.jsm");
     let gStringBundle = Services.strings.createBundle(kPropertiesURL);
     let s1 = gStringBundle.GetStringFromName("aboutTor.searchDDG.privacy.link");
     let s2 = gStringBundle.GetStringFromName("aboutTor.searchDDG.search.link");
@@ -222,7 +226,7 @@ window.addEventListener("pageshow", function() {
           </a>
         </li>
         <li class="showForManual">
-          <a href="&aboutTor.torbrowser_user_manual.link;">
+          <a id="manualLink">
             &aboutTor.torbrowser_user_manual.label; »
           </a>
         </li>
diff --git a/src/chrome/content/menu-overlay.xul b/src/chrome/content/menu-overlay.xul
index 4970114..53654c5 100644
--- a/src/chrome/content/menu-overlay.xul
+++ b/src/chrome/content/menu-overlay.xul
@@ -22,6 +22,6 @@
               position="1"
               label="&aboutTor.torbrowser_user_manual.label;"
               accesskey="&aboutTor.torbrowser_user_manual.accesskey;"
-              oncommand="gBrowser.selectedTab = gBrowser.addTab('&aboutTor.torbrowser_user_manual.link;')" />
+              oncommand="gBrowser.selectedTab = gBrowser.addTab('https://tb-manual.torproject.org/' + Services.prefs.getCharPref('general.useragent.locale'))" />
   </menupopup>
 </overlay>
diff --git a/src/chrome/locale/en/aboutTor.dtd b/src/chrome/locale/en/aboutTor.dtd
index 8213ab9..676878e 100644
--- a/src/chrome/locale/en/aboutTor.dtd
+++ b/src/chrome/locale/en/aboutTor.dtd
@@ -31,7 +31,6 @@
 <!ENTITY aboutTor.whatnext.link "https://www.torproject.org/download/download.html.en#warning">
 <!ENTITY aboutTor.torbrowser_user_manual.accesskey "M">
 <!ENTITY aboutTor.torbrowser_user_manual.label "Tor Browser User Manual">
-<!ENTITY aboutTor.torbrowser_user_manual.link "https://tb-manual.torproject.org/en-US">
 <!ENTITY aboutTor.helpInfo1.label "You Can Help!">
 <!ENTITY aboutTor.helpInfo2.label "There are many ways you can help make the Tor Network faster and stronger:">
 <!ENTITY aboutTor.helpInfo3.label "Run a Tor Relay Node ยป">





More information about the tbb-commits mailing list