Repository: cloudstack
Updated Branches:
  refs/heads/master 0d7fa25f1 -> 901c243ed


CLOUDSTACK-7645: [UI] Fixed incorrect label issues caused the dictionary split

In some cases the UI does not display the correct text, displaying 'label.xyz' 
instead of the localized string.
This appears to be due to the dictionary split: entries in dictionary2.jsp are 
not found because the dictionary has not been extended with dictionary2 as 
expected.

In this fix:
- Instead of extending the dictionary, we leave it as it is and change the 
localization function to look in the dictionary first and, if the item is not 
found there, then look in dictionary2.
- This way we are not depending on the extent() function to be called at the 
'right' time; In turn, the localization function will be aware of both 
dictionaries.
- In the future, when we add another dictionary, we will have to modify this 
function only.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/901c243e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/901c243e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/901c243e

Branch: refs/heads/master
Commit: 901c243ed1bdd5c118af65a79f33a2386543e756
Parents: 0d7fa25
Author: Mihaela Stoica <mihaela.sto...@citrix.com>
Authored: Tue Nov 11 17:34:50 2014 +0000
Committer: Brian Federle <brian.fede...@citrix.com>
Committed: Tue Nov 11 11:22:35 2014 -0800

----------------------------------------------------------------------
 ui/scripts/cloudStack.js      | 9 +++------
 ui/scripts/sharedFunctions.js | 4 +---
 2 files changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/901c243e/ui/scripts/cloudStack.js
----------------------------------------------------------------------
diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js
index c5aa89c..a76e101 100644
--- a/ui/scripts/cloudStack.js
+++ b/ui/scripts/cloudStack.js
@@ -407,14 +407,11 @@
         // Localization
         if (!$.isFunction(cloudStack.localizationFn)) { // i.e., localize is 
overridden by a plugin/module
             cloudStack.localizationFn = function(str) {
-                return dictionary[str];
+                // look in dictionary first; if not found, try dictionary2
+                var localized = dictionary[str];
+                return localized ? localized : dictionary2[str]; 
             };
         }
-        
-        //added for dictionary split up
-        if (dictionary != undefined && dictionary2 != undefined) {
-            $.extend(dictionary,dictionary2);
-        }
 
         // Localize validation messages
         cloudStack.localizeValidatorMessages();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/901c243e/ui/scripts/sharedFunctions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index d463381..a7383b7 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -1478,9 +1478,7 @@ var processPropertiesInImagestoreObject = 
function(jsonObj) {
         }
         return vmName;
     }
-
-var dictionary = {}, dictionary2 = {}; //for globalization
-    
+  
 var timezoneMap = new Object();
 timezoneMap["Etc/GMT+12"] = "Etc/GMT+12 [GMT-12:00]";
 timezoneMap["Etc/GMT+11"] = "Etc/GMT+11 [GMT-11:00]";

Reply via email to