Skip to content

Commit d82e556

Browse files
Mihaela Stoicabfederle
authored andcommitted
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.
1 parent f136179 commit d82e556

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

ui/scripts/cloudStack.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,14 +407,11 @@
407407
// Localization
408408
if (!$.isFunction(cloudStack.localizationFn)) { // i.e., localize is overridden by a plugin/module
409409
cloudStack.localizationFn = function(str) {
410-
return dictionary[str];
410+
// look in dictionary first; if not found, try dictionary2
411+
var localized = dictionary[str];
412+
return localized ? localized : dictionary2[str];
411413
};
412414
}
413-
414-
//added for dictionary split up
415-
if (dictionary != undefined && dictionary2 != undefined) {
416-
$.extend(dictionary,dictionary2);
417-
}
418415

419416
// Localize validation messages
420417
cloudStack.localizeValidatorMessages();

ui/scripts/sharedFunctions.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,9 +1454,7 @@ var processPropertiesInImagestoreObject = function(jsonObj) {
14541454
}
14551455
return vmName;
14561456
}
1457-
1458-
var dictionary = {}, dictionary2 = {}; //for globalization
1459-
1457+
14601458
var timezoneMap = new Object();
14611459
timezoneMap["Etc/GMT+12"] = "Etc/GMT+12 [GMT-12:00]";
14621460
timezoneMap["Etc/GMT+11"] = "Etc/GMT+11 [GMT-11:00]";

0 commit comments

Comments
 (0)