src/sap.ui.core/src/sap/ui/core/LocaleData.js
function getData(oLocale) {

		var sLanguage = oLocale.getLanguage() || "",
			sScript = oLocale.getScript() || "",
			sRegion = oLocale.getRegion() || "",
			mData;

		/*
		 * Merge a CLDR delta file and a CLDR fallback file.
		 *
		 * Note: the contract of this method reg. null values differs from both,
		 * jQuery.extend as well as jQuery.sap.extend.
		 */
		function merge(obj, fallbackObj) {
			var name, value, fallbackValue;

			if ( !fallbackObj ) {
				return;
			}

			for ( name in fallbackObj ) {

				if ( fallbackObj.hasOwnProperty(name) ) {

					value = obj[ name ];
					fallbackValue = fallbackObj[ name ];

					if ( value === undefined ) {
						// 'undefined': value doesn't exist in delta, so take it from the fallback object
						// Note: undefined is not a valid value in JSON, so we can't misunderstand an existing undefined
						obj[name] = fallbackValue;
					} else if ( value === null ) {
						// 'null' is used by the delta tooling as a marker that a value must not be taken form the fallback
						delete obj[name];
					} else if ( typeof value === 'object' && typeof fallbackValue === 'object' ) {
						// both values are objects, merge them recursively
						merge(value, fallbackValue);
					}

				}

			}

		}

		function getOrLoad(sId) {
			if ( !mLocaleDatas[sId] && (!M_SUPPORTED_LOCALES || M_SUPPORTED_LOCALES[sId] === true) ) {
				var data = mLocaleDatas[sId] = LoaderExtensions.loadResource("sap/ui/core/cldr/" + sId + ".json", {
					dataType: "json",
					failOnError : false
				});

				// check if the data is a minified delta file.
				// If so, load the corresponding fallback data as well, merge it and remove the fallback marker
				if ( data && data.__fallbackLocale ) {
					merge(data, getOrLoad(data.__fallbackLocale));
					delete data.__fallbackLocale;
				}

				// if load fails, null is returned
				// -> caller will process the fallback chain, in the end a result is identified and stored in mDatas under the originally requested ID
			}
			return mLocaleDatas[sId];
		}

		// normalize language and handle special cases
		sLanguage = (sLanguage && M_ISO639_OLD_TO_NEW[sLanguage]) || sLanguage;
		// Special case 1: in an SAP context, the inclusive language code "no" always means Norwegian Bokmal ("nb")
		if ( sLanguage === "no" ) {
			sLanguage = "nb";
		}
		// Special case 2: for Chinese, derive a default region from the script (this behavior is inherited from Java)
		if ( sLanguage === "zh" && !sRegion ) {
			if ( sScript === "Hans" ) {
				sRegion = "CN";
			} else if ( sScript === "Hant" ) {
				sRegion = "TW";
			}
		}

		var sId = sLanguage + "_" + sRegion; // the originally requested locale; this is the key under which the result (even a fallback one) will be stored in the end
		// first try: load CLDR data for specific language / region combination
		if ( sLanguage && sRegion ) {
			mData = getOrLoad(sId);
		}
		// second try: load data for language only
		if ( !mData && sLanguage ) {
			mData = getOrLoad(sLanguage);
		}
		// last try: use fallback data
		mLocaleDatas[sId] = mData || M_DEFAULT_DATA;

		return mLocaleDatas[sId];
	}
function getData(oLocale) {

		var sLanguage = oLocale.getLanguage() || "",
			sScript = oLocale.getScript() || "",
			sRegion = oLocale.getRegion() || "",
			mData;

		/*
		 * Merge a CLDR delta file and a CLDR fallback file.
		 *
		 * Note: the contract of this method reg. null values differs from both,
		 * jQuery.extend as well as jQuery.sap.extend.
		 */
		function merge(obj, fallbackObj) {
			var name, value, fallbackValue;

			if ( !fallbackObj ) {
				return;
			}

			for ( name in fallbackObj ) {

				if ( fallbackObj.hasOwnProperty(name) ) {

					value = obj[ name ];
					fallbackValue = fallbackObj[ name ];

					if ( value === undefined ) {
						// 'undefined': value doesn't exist in delta, so take it from the fallback object
						// Note: undefined is not a valid value in JSON, so we can't misunderstand an existing undefined
						obj[name] = fallbackValue;
					} else if ( value === null ) {
						// 'null' is used by the delta tooling as a marker that a value must not be taken form the fallback
						delete obj[name];
					} else if ( typeof value === 'object' && typeof fallbackValue === 'object' ) {
						// both values are objects, merge them recursively
						merge(value, fallbackValue);
					}

				}

			}

		}

		function getOrLoad(sId) {
			if ( !mLocaleDatas[sId] && (!M_SUPPORTED_LOCALES || M_SUPPORTED_LOCALES[sId] === true) ) {
				var data = mLocaleDatas[sId] = LoaderExtensions.loadResource("sap/ui/core/cldr/" + sId + ".json", {
					dataType: "json",
					failOnError : false
				});

				// check if the data is a minified delta file.
				// If so, load the corresponding fallback data as well, merge it and remove the fallback marker
				if ( data && data.__fallbackLocale ) {
					merge(data, getOrLoad(data.__fallbackLocale));
					delete data.__fallbackLocale;
				}

				// if load fails, null is returned
				// -> caller will process the fallback chain, in the end a result is identified and stored in mDatas under the originally requested ID
			}
			return mLocaleDatas[sId];
		}

		// normalize language and handle special cases
		sLanguage = (sLanguage && M_ISO639_OLD_TO_NEW[sLanguage]) || sLanguage;
		// Special case 1: in an SAP context, the inclusive language code "no" always means Norwegian Bokmal ("nb")
		if ( sLanguage === "no" ) {
			sLanguage = "nb";
		}
		// Special case 2: for Chinese, derive a default region from the script (this behavior is inherited from Java)
		if ( sLanguage === "zh" && !sRegion ) {
			if ( sScript === "Hans" ) {
				sRegion = "CN";
			} else if ( sScript === "Hant" ) {
				sRegion = "TW";
			}
		}

		var sId = sLanguage + "_" + sRegion; // the originally requested locale; this is the key under which the result (even a fallback one) will be stored in the end
		// first try: load CLDR data for specific language / region combination
		if ( sLanguage && sRegion ) {
			mData = getOrLoad(sId);
		}
		// second try: load data for language only
		if ( !mData && sLanguage ) {
			mData = getOrLoad(sLanguage);
		}
		// last try: use fallback data
		mLocaleDatas[sId] = mData || M_DEFAULT_DATA;

		return mLocaleDatas[sId];
	}
function getData ( oLocale ) { var sLanguage = oLocale . getLanguage ( ) || "" , sScript = oLocale . getScript ( ) || "" , sRegion = oLocale . getRegion ( ) || "" , mData ; /*
		 * Merge a CLDR delta file and a CLDR fallback file.
		 *
		 * Note: the contract of this method reg. null values differs from both,
		 * jQuery.extend as well as jQuery.sap.extend.
		 */ function merge ( obj , fallbackObj ) { var name , value , fallbackValue ; if ( ! fallbackObj ) { return ; } for ( name in fallbackObj ) { if ( fallbackObj . hasOwnProperty ( name ) ) { value = obj [ name ] ; fallbackValue = fallbackObj [ name ] ; if ( value === undefined ) { // 'undefined': value doesn't exist in delta, so take it from the fallback object // Note: undefined is not a valid value in JSON, so we can't misunderstand an existing undefined obj [ name ] = fallbackValue ; } else if ( value === null ) { // 'null' is used by the delta tooling as a marker that a value must not be taken form the fallback delete obj [ name ] ; } else if ( typeof value === 'object' && typeof fallbackValue === 'object' ) { // both values are objects, merge them recursively merge ( value , fallbackValue ) ; } } } } function getOrLoad ( sId ) { if ( ! mLocaleDatas [ sId ] && ( ! M_SUPPORTED_LOCALES || M_SUPPORTED_LOCALES [ sId ] === true ) ) { var data = mLocaleDatas [ sId ] = LoaderExtensions . loadResource ( "sap/ui/core/cldr/" + sId + ".json" , { dataType : "json" , failOnError : false } ) ; // check if the data is a minified delta file. // If so, load the corresponding fallback data as well, merge it and remove the fallback marker if ( data && data . __fallbackLocale ) { merge ( data , getOrLoad ( data . __fallbackLocale ) ) ; delete data . __fallbackLocale ; } // if load fails, null is returned // -> caller will process the fallback chain, in the end a result is identified and stored in mDatas under the originally requested ID } return mLocaleDatas [ sId ] ; } // normalize language and handle special cases sLanguage = ( sLanguage && M_ISO639_OLD_TO_NEW [ sLanguage ] ) || sLanguage ; // Special case 1: in an SAP context, the inclusive language code "no" always means Norwegian Bokmal ("nb") if ( sLanguage === "no" ) { sLanguage = "nb" ; } // Special case 2: for Chinese, derive a default region from the script (this behavior is inherited from Java) if ( sLanguage === "zh" && ! sRegion ) { if ( sScript === "Hans" ) { sRegion = "CN" ; } else if ( sScript === "Hant" ) { sRegion = "TW" ; } } var sId = sLanguage + "_" + sRegion ; // the originally requested locale; this is the key under which the result (even a fallback one) will be stored in the end // first try: load CLDR data for specific language / region combination if ( sLanguage && sRegion ) { mData = getOrLoad ( sId ) ; } // second try: load data for language only if ( ! mData && sLanguage ) { mData = getOrLoad ( sLanguage ) ; } // last try: use fallback data mLocaleDatas [ sId ] = mData || M_DEFAULT_DATA ; return mLocaleDatas [ sId ] ; }
Load LocaleData data from the CLDR generated files.
Load LocaleData data from the CLDR generated files .