Repository: cloudstack Updated Branches: refs/heads/4.5 f1361796b -> 4e820b37b
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/d82e556d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d82e556d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d82e556d Branch: refs/heads/4.5 Commit: d82e556dcd980bac50f27eaca284983808e04b1c Parents: f136179 Author: Mihaela Stoica <mihaela.sto...@citrix.com> Authored: Tue Nov 11 17:34:50 2014 +0000 Committer: Brian Federle <brian.fede...@citrix.com> Committed: Wed Nov 12 08:21:42 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/d82e556d/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/d82e556d/ui/scripts/sharedFunctions.js ---------------------------------------------------------------------- diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js index cba6fc6..6bcc50e 100644 --- a/ui/scripts/sharedFunctions.js +++ b/ui/scripts/sharedFunctions.js @@ -1454,9 +1454,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]";