Bug 586685: All user-facing strings in JS are now localizable via stringbundle [r=dolske a=dolske]
authorMichael Yoshitaka Erlewine <mitcho@mitcho.com>
Thu, 12 Aug 2010 18:32:18 -0500
changeset 50589 802b081c9658
parent 50588 41d486ae06b2
child 50590 efc6f1cbb38f
push id15078
push useredward.lee@engineering.uiuc.edu
push date2010-08-14 08:05 +0000
treeherdermozilla-central@5a8ef7a3fe86 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske, dolske
bugs586685, 587158, 586814
milestone2.0b4pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 586685: All user-facing strings in JS are now localizable via stringbundle [r=dolske a=dolske] NOT. Everything but user facing strings being localized. Random whitespace fixes. Random styling changes. Also has Bug 587158 - Update intro-video URL to CDN'ed version And string changes. And Bug 586814 - Unable to close Tab groups
browser/base/content/tabview/drag.js
browser/base/content/tabview/groupitems.js
browser/base/content/tabview/items.js
browser/base/content/tabview/tabview.css
browser/base/content/tabview/ui.js
--- a/browser/base/content/tabview/drag.js
+++ b/browser/base/content/tabview/drag.js
@@ -103,18 +103,18 @@ Drag.prototype = {
   //   bounds             - (<Rect>) bounds
   //   stationaryCorner   - which corner is stationary? by default, the top left.
   //                        "topleft", "bottomleft", "topright", "bottomright"
   //   assumeConstantSize - (boolean) whether the bounds' dimensions are sacred or not.
   //   keepProportional   - (boolean) if assumeConstantSize is false, whether we should resize
   //                        proportionally or not
   //   checkItemStatus    - (boolean) make sure this is a valid item which should be snapped
   snapBounds: function Drag_snapBounds(bounds, stationaryCorner, assumeConstantSize, keepProportional, checkItemStatus) {
-		if (!stationaryCorner)
-			stationaryCorner || 'topleft';
+    if (!stationaryCorner)
+      stationaryCorner || 'topleft';
     var update = false; // need to update
     var updateX = false;
     var updateY = false;
     var newRect;
     var snappedTrenches = {};
 
     // OH SNAP!
 
--- a/browser/base/content/tabview/groupitems.js
+++ b/browser/base/content/tabview/groupitems.js
@@ -121,25 +121,23 @@ let GroupItem = function GroupItem(listO
 
   this.isDragging = false;
   $container
     .css({zIndex: -100})
     .appendTo("body");
 
   // ___ New Tab Button
   this.$ntb = iQ("<div>")
-    .appendTo($container);
-
-  this.$ntb
     .addClass('newTabButton')
     .click(function() {
       self.newTab();
-    });
-
-  (this.$ntb)[0].title = 'New tab';
+    })
+    .attr('title',
+          "New tab")
+    .appendTo($container);
 
   // ___ Resizer
   this.$resizer = iQ("<div>")
     .addClass('resizer')
     .appendTo($container)
     .hide();
 
   // ___ Titlebar
@@ -164,17 +162,17 @@ let GroupItem = function GroupItem(listO
       self.closeAll();
     })
     .appendTo($container);
 
   // ___ Title
   this.$titleContainer = iQ('.title-container', this.$titlebar);
   this.$title = iQ('.name', this.$titlebar);
   this.$titleShield = iQ('.title-shield', this.$titlebar);
-  this.setTitle(options.title || "");
+  this.setTitle(options.title || this.defaultName);
 
   var titleUnfocus = function() {
     self.$titleShield.show();
     if (!self.getTitle()) {
       self.$title
         .addClass("defaultName")
         .val(self.defaultName);
     } else {
@@ -293,17 +291,17 @@ let GroupItem = function GroupItem(listO
   }
 };
 
 // ----------
 window.GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
   // ----------
   // Variable: defaultName
   // The prompt text for the title field.
-  defaultName: "name this groupItem...",
+  defaultName: "Name this tab group…",
 
   // -----------
   // Function: setActiveTab
   // Sets the active <TabItem> for this groupItem
   setActiveTab: function(tab) {
     Utils.assert(tab && tab.isATabItem, 'tab must be a TabItem');
     this._activeTab = tab;
   },
@@ -369,17 +367,17 @@ window.GroupItem.prototype = Utils.exten
   },
 
   // ----------
   // Function: adjustTitleSize
   // Used to adjust the width of the title box depending on groupItem width and title size.
   adjustTitleSize: function() {
     Utils.assert(this.bounds, 'bounds needs to have been set');
     let closeButton = iQ('.close', this.container);
-    var w = Math.min(this.bounds.width - closeButton.width() - closeButton.css('right'),
+    var w = Math.min(this.bounds.width - parseInt(closeButton.width()) - parseInt(closeButton.css('right')),
                      Math.max(150, this.getTitle().length * 6));
     // The * 6 multiplier calculation is assuming that characters in the title
     // are approximately 6 pixels wide. Bug 586545
     var css = {width: w};
     this.$title.css(css);
     this.$titleShield.css(css);
   },
 
@@ -1792,16 +1790,17 @@ window.GroupItems = {
       UI.showTabView();
     }
   },
 
   // ----------
   // Function: killNewTabGroup
   // Removes the New Tab Group, which is now defunct. See bug 575851 and comments therein.
   killNewTabGroup: function() {
+    let newTabGroupTitle = "New Tabs";
     this.groupItems.forEach(function(groupItem) {
-      if (groupItem.getTitle() == 'New Tabs' && groupItem.locked.title) {
+      if (groupItem.getTitle() == newTabGroupTitle && groupItem.locked.title) {
         groupItem.removeAll();
         groupItem.close();
       }
     });
   }
 };
--- a/browser/base/content/tabview/items.js
+++ b/browser/base/content/tabview/items.js
@@ -1043,17 +1043,17 @@ window.Items = {
         var blocked = false;
         pairs.forEach(function(pair2) {
           if (pair2 == pair || pair2.item == ignore)
             return;
 
           var bounds2 = pair2.bounds;
           if (bounds2.intersects(newBounds))
             blocked = true;
-					return;
+          return;
         });
 
         if (!blocked) {
           pair.bounds.copy(newBounds);
         }
       }
       return;
     });
--- a/browser/base/content/tabview/tabview.css
+++ b/browser/base/content/tabview/tabview.css
@@ -342,36 +342,36 @@ input.name {
   border: 1px solid transparent;
   color: #999;
   margin: 3px 0px 0px 3px;
   padding: 1px;
   background-image: url(chrome://browser/skin/tabview/edit-light.png);
   padding-left: 20px;
 }
 
-input.name:hover {
+.title-container:hover input.name {
   border: 1px solid #ddd;
 }
 
-input.name-locked:hover {
+.title-container:hover input.name-locked {
   border: 1px solid transparent !important;
   cursor: default;
 }
 
 input.name:focus {
   color: #555;
 }
 
 input.defaultName {
   font-style: italic !important;
   background-image-opacity: .1;
   color: transparent;
 }
 
-input.defaultName:hover {
+.title-container:hover input.defaultName {
   color: #CCC;
 }
 
 .title-container {
   cursor: text;
 }
 
 .title-shield {
--- a/browser/base/content/tabview/ui.js
+++ b/browser/base/content/tabview/ui.js
@@ -175,21 +175,24 @@ var UIManager = {
         items.forEach(function(item) {
           if (item.parent)
             item.parent.remove(item);
 
           groupItem.add(item);
         });
 
         // ___ make info item
+        let welcome = "How to organize your tabs";
+        let more = "";
+        let video = "http://videos-cdn.mozilla.net/firefox4beta/tabcandy_howto.webm";
         var html =
           "<div class='intro'>"
-            + "<h1>Welcome to Firefox Tab Sets</h1>" // TODO: This needs to be localized if it's kept in
-            + "<div>(more goes here)</div><br>"
-            + "<video src='http://people.mozilla.org/~araskin/movies/tabcandy_howto.webm' "
+            + "<h1>" + welcome + "</h1>"
+            + ( more && more.length ? "<div>" + more + "</div><br>" : "")
+            + "<video src='" + video + "' "
             + "width='100%' preload controls>"
           + "</div>";
 
         box.left = box.right + padding;
         box.width = infoWidth;
         box.height = infoHeight;
         var infoItem = new InfoItem(box);
         infoItem.html(html);