changeset 206:0a300c435fe6

make subscribe page localizable
author Myk Melez <myk@mozilla.org>
date Sun, 27 Jul 2008 18:07:44 -0700
parents ce534ed8a39e
children 63d17a2ecac7
files extension/content/subscribe.js extension/content/subscribe.xul extension/locale/en-US/subscribe.dtd
diffstat 3 files changed, 40 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/extension/content/subscribe.js	Sun Jul 27 15:17:13 2008 -0700
+++ b/extension/content/subscribe.js	Sun Jul 27 18:07:44 2008 -0700
@@ -108,8 +108,8 @@
     }
 
     if (params.feed) {
-      document.getElementById("snowlLocationTextbox").value = params.feed;
-      this.doSubscribe();
+      document.getElementById("locationTextbox").value = params.feed;
+      this.subscribeFeed();
     }
   },
 
@@ -125,13 +125,13 @@
   //**************************************************************************//
   // Event Handlers
 
-  doSubscribe: function() {
-    let uri = URI.get(document.getElementById("snowlLocationTextbox").value);
+  subscribeFeed: function() {
+    let uri = URI.get(document.getElementById("locationTextbox").value);
     let feed = new SnowlFeed(null, null, uri);
     this._subscribe(feed);
   },
 
-  doImportOPML: function() {
+  importOPML: function() {
     let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
     fp.init(window, "Import OPML", Ci.nsIFilePicker.modeOpen);
     fp.appendFilter("OPML Files", "*.opml");
@@ -157,12 +157,8 @@
     this._importOutline(outline);
   },
 
-  doClose: function() {
-    window.close();
-  },
-
   showTwitterPassword: function() {
-    if (document.getElementById("showPassword").checked)
+    if (document.getElementById("showTwitterPassword").checked)
       document.getElementById("twitterPassword").removeAttribute("type");
     else
       document.getElementById("twitterPassword").setAttribute("type", "password");
@@ -172,7 +168,7 @@
     let credentials = {
       username: document.getElementById("twitterUsername").value,
       password: document.getElementById("twitterPassword").value,
-      remember: document.getElementById("twitterRemember").checked
+      remember: document.getElementById("rememberTwitterPassword").checked
     };
 
     let twitter = new SnowlTwitter();
--- a/extension/content/subscribe.xul	Sun Jul 27 15:17:13 2008 -0700
+++ b/extension/content/subscribe.xul	Sun Jul 27 18:07:44 2008 -0700
@@ -1,27 +1,32 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <?xml-stylesheet href="chrome://global/skin/" type"text/css"?>
-<!-- XXX Don't we need a reference to the browser skin here? -->
 <?xml-stylesheet href="chrome://snowl/content/subscribe.css" type"text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://snowl/locale/login.dtd">
+<!DOCTYPE page [
+  <!ENTITY % subscribeDTD SYSTEM "chrome://snowl/locale/subscribe.dtd">
+  %subscribeDTD;
+  <!ENTITY % loginDTD SYSTEM "chrome://snowl/locale/login.dtd">
+  %loginDTD;
+]>
 
-<page id="subscribeToFeedPage" title="Subscribe to Messages"
+<page title="&page.title;"
       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-      pack="center" align="center">
+      pack="center"
+      align="center">
 
   <script type="application/x-javascript" src="chrome://snowl/content/strands.js"/>
   <script type="application/x-javascript" src="chrome://snowl/content/subscribe.js"/>
 
   <vbox id="content">
-    <label flex="1" value="Subscribe to Messages" class="header"/>
+    <label flex="1" value="&page.title;" class="header"/>
     <separator class="groove-thin"/>
     <separator class="thin" orient="horizontal"/>
 
-    <tabbox selectedIndex="1">
+    <tabbox>
       <tabs>
-        <tab label="Feed"/>
-        <tab label="Twitter"/>
+        <tab label="&feeds.label;"/>
+        <tab label="&twitter.label;"/>
       </tabs>
       <tabpanels>
         <tabpanel orient="vertical">
@@ -33,16 +38,18 @@
             <rows>
               <row align="center">
                 <hbox flex="1" pack="end">
-                  <label control="snowlLocationTextbox" value="Location:"/>
+                  <label control="locationTextbox" value="Location:"/>
                 </hbox>
-                <textbox id="snowlLocationTextbox"/>
+                <textbox id="locationTextbox"/>
               </row>
               <row>
                 <box/>
                 <hbox pack="start">
-                  <button label="Subscribe" default="true" oncommand="Subscriber.doSubscribe(event)"/>
+                  <button label="&subscribeButton.label;" default="true"
+                          oncommand="Subscriber.subscribeFeed()"/>
                   <spacer flex="1"/>
-                  <button id="importOPMLButton" label="Import OPML..." oncommand="Subscriber.doImportOPML(event)"/>
+                  <button id="importOPMLButton" label="&importOPMLButton.label;"
+                          oncommand="Subscriber.importOPML()"/>
                 </hbox>
               </row>
             </rows>
@@ -58,30 +65,30 @@
             <rows>
               <row align="center">
                 <hbox flex="1" pack="end">
-                  <label control="twitterUsername" value="Username:"/>
+                  <label control="twitterUsername" value="&username.label;"/>
                 </hbox>
                 <textbox id="twitterUsername"/>
               </row>
               <row align="center">
                 <hbox flex="1" pack="end">
-                  <label value="Password:"/>
+                  <label control="twitterPassword" value="&password.label;"/>
                 </hbox>
-                <textbox type="password" id="twitterPassword"/>
+                <textbox id="twitterPassword" type="password"/>
               </row>
               <row align="center">
                 <box/>
-                <checkbox id="showPassword" label="&showPassword.label;"
+                <checkbox id="showTwitterPassword" label="&showPassword.label;"
                           oncommand="Subscriber.showTwitterPassword()"/>
               </row>
               <row align="center">
                 <box/>
-                <checkbox id="twitterRemember" label="&rememberPassword.label;"/>
+                <checkbox id="rememberTwitterPassword" label="&rememberPassword.label;"/>
               </row>
               <row>
                 <box/>
                 <hbox pack="start">
-                  <button label="Subscribe" default="true"
-                          oncommand="Subscriber.subscribeTwitter(event)"/>
+                  <button label="&subscribeButton.label;" default="true"
+                          oncommand="Subscriber.subscribeTwitter()"/>
                 </hbox>
               </row>
             </rows>
@@ -104,7 +111,7 @@
 
     <hbox>
       <spacer flex="1"/>
-      <button label="Close" oncommand="Subscriber.doClose(event)"/>
+      <button label="&closeButton.label;" oncommand="window.close()"/>
     </hbox>
 
   </vbox>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extension/locale/en-US/subscribe.dtd	Sun Jul 27 18:07:44 2008 -0700
@@ -0,0 +1,6 @@
+<!ENTITY page.title                 "Snowl: Subscribe to Message Sources">
+<!ENTITY feeds.label                "Feeds">
+<!ENTITY twitter.label              "Twitter">
+<!ENTITY subscribeButton.label      "Subscribe">
+<!ENTITY importOPMLButton.label     "Import OPML...">
+<!ENTITY closeButton.label          "Close">