All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bower_components.cldrjs.src.unresolved.js Maven / Gradle / Ivy

The newest version!
define([
    "./common/validate/presence",
    "./common/validate/type/path",
    "./core",
    "./core/load",
    "./item/lookup"
], function (validatePresence, validateTypePath, Cldr, coreLoad, itemLookup) {

    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;

});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy