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

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

There is a newer version: 1.2.2.1-jre17
Show newest version
define([
    "../resource/get",
    "../path/normalize"
], function (resourceGet, pathNormalize) {

    return function (Cldr, locale) {
        var normalizedPath, parent;

        if (locale === "root") {
            return;
        }

        // First, try to find parent on supplemental data.
        normalizedPath = pathNormalize(["supplemental/parentLocales/parentLocale", locale]);
        parent = resourceGet(Cldr._resolved, normalizedPath) || resourceGet(Cldr._raw, normalizedPath);
        if (parent) {
            return parent;
        }

        // Or truncate locale.
        parent = locale.substr(0, locale.lastIndexOf(Cldr.localeSep));
        if (!parent) {
            return "root";
        }

        return parent;
    };

});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy