/* *+------------------------------------------------------------------------+ *| Licensed Materials - Property of IBM *| *| IBM Cognos Products: BUX *| *| (C) Copyright IBM Corp. 2014 *| *| US Government Users Restricted Rights - Use, duplication or *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *| *+------------------------------------------------------------------------+ */ /*global define,require,window,icdConfig,console*/ define("pd/i18n", ["dojo/_base/lang"], function(lang) { var a = icdConfig.productLocale.split("-"), aLocales = [""], sPreviousLocale = "", i=0; // split locale code, following the Dojo way. If we get ab-cd-ef as a locale, we will use: // buxuimsg, buxuimsg_ab, buxuimsg_ab-cd, buxuimsg_ab-cd-ef for (i = 0; i < a.length; i++) { var l = sPreviousLocale + a[i]; aLocales.push("_"+l); sPreviousLocale = l + (l?"-":""); } // Initialize our Global object for i18n strings. window.PDMSG={}; var sWebContent = (icdConfig.WebContentURL||icdConfig.ThemeFolder+"/../../.."); // Use WebContent from icdConfig. It can be empty in DOH tests, so set a backup using the ThemeFolder. // Merge in all locales files into window.PDMSG for (i = 0; i < aLocales.length; i++) { var loc = aLocales[i]; try { var oMsgs = eval( require.getText(sWebContent + "/ps/lobdata/dojo/pd/nls/pduimsg" + loc + ".js") ); // PDMSG is divided in sections, we need to merge each section separately because mixin() isn't doing a deep copy. for (var j in oMsgs) { window.PDMSG[j] = lang.mixin( window.PDMSG[j]||{}, oMsgs[j] ); } } catch(e) { console.debug(e); } } return window.PDMSG; });