36 lines
1 KiB
JavaScript
36 lines
1 KiB
JavaScript
|
|
||
|
|
||
|
Cldr._raw = {};
|
||
|
|
||
|
/**
|
||
|
* Cldr.load( json [, json, ...] )
|
||
|
*
|
||
|
* @json [JSON] CLDR data or [Array] Array of @json's.
|
||
|
*
|
||
|
* Load resolved or unresolved cldr data.
|
||
|
* Overwrite Cldr.load().
|
||
|
*/
|
||
|
Cldr.load = function() {
|
||
|
Cldr._raw = coreLoad( Cldr, Cldr._raw, arguments );
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Overwrite Cldr.prototype.get().
|
||
|
*/
|
||
|
Cldr.prototype.get = function( path ) {
|
||
|
validatePresence( path, "path" );
|
||
|
validateTypePath( path, "path" );
|
||
|
|
||
|
// 1: use bundle as locale on item lookup for simplification purposes, because no other extended subtag is used anyway on bundle parent lookup.
|
||
|
// 2: during init(), this method is called, but bundle is yet not defined. Use "" as a workaround in this very specific scenario.
|
||
|
return itemLookup( Cldr, this.attributes && this.attributes.bundle /* 1 */ || "" /* 2 */, path, this.attributes );
|
||
|
};
|
||
|
|
||
|
// In case cldr/unresolved is loaded after cldr/event, we trigger its overloads again. Because, .get is overwritten in here.
|
||
|
if ( Cldr._eventInit ) {
|
||
|
Cldr._eventInit();
|
||
|
}
|
||
|
|
||
|
return Cldr;
|
||
|
|