Browse Source

AMBARI-7924 Background operation notification plurality should match number of operations (apenniston via jaoki)

Jun Aoki 10 năm trước cách đây
mục cha
commit
a77f8bd1dc

+ 1 - 0
ambari-web/app/messages.js

@@ -60,6 +60,7 @@ Em.I18n.translations = {
   'yes':'Yes',
   'no':'No',
   'add': 'Add',
+  'op': 'op',
   'ops': 'ops',
 
 

+ 4 - 2
ambari-web/app/templates/application.hbs

@@ -28,9 +28,11 @@
               <span {{action "showPopup" target="App.router.backgroundOperationsController"}} >{{clusterDisplayName}} </span>
               {{#with App.router.backgroundOperationsController}}
                 {{#if allOperationsCount}}
-                  <i class="icon-caret-left ops-count"></i><span class="label operations-count" {{action "showPopup" target="App.router.backgroundOperationsController"}}> {{allOperationsCount}} {{t ops}}</span>
+                  <i class="icon-caret-left ops-count"></i><span class="label operations-count" {{action "showPopup" target="App.router.backgroundOperationsController"}}>
+                    {{allOperationsCount}} {{pluralize allOperationsCount singular="t:op" plural="t:ops"}}</span>
                 {{else}}
-                  <i class="icon-caret-left"></i><span class="label" {{action "showPopup" target="App.router.backgroundOperationsController"}}>{{allOperationsCount}} {{t ops}}</span>
+                  <i class="icon-caret-left"></i><span class="label" {{action "showPopup" target="App.router.backgroundOperationsController"}}>
+                    {{allOperationsCount}} {{pluralize allOperationsCount singular="t:op" plural="t:ops"}}</span>
                 {{/if}}
               {{/with}}
             </a>

+ 3 - 3
ambari-web/app/utils/helper.js

@@ -596,10 +596,10 @@ App.registerBoundHelper('pluralize', Em.View.extend({
     if (!plural) plural = singular + 's';
     else plural = this.parseValue(plural);
     if (singular && plural) {
-      if (count > 1) {
-        return plural;
-      } else {
+      if (count == 1) {
         return singular;
+      } else {
+        return plural;
       }
     }
     return '';