CoastalCommitsPastes/server/node_modules/cldrjs/dist/.build/bundle/parent_lookup.js
2022-03-06 16:46:59 -08:00

25 lines
576 B
JavaScript

var bundleParentLookup = 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;
};