Prvi commit

This commit is contained in:
David Štaleker
2023-05-12 09:00:07 +02:00
parent d3ffe93e42
commit 03b92525d7
14757 changed files with 9251133 additions and 53 deletions

View File

@@ -0,0 +1,9 @@
var itemGetResolved = function( Cldr, path, attributes ) {
// Resolve path
var normalizedPath = pathNormalize( path, attributes );
return resourceGet( Cldr._resolved, normalizedPath );
};

View File

@@ -0,0 +1,44 @@
var itemLookup = (function() {
var lookup;
lookup = function( Cldr, locale, path, attributes, childLocale ) {
var normalizedPath, parent, value;
// 1: Finish recursion
// 2: Avoid infinite loop
if ( typeof locale === "undefined" /* 1 */ || locale === childLocale /* 2 */ ) {
return;
}
// Resolve path
normalizedPath = pathNormalize( path, attributes );
// Check resolved (cached) data first
// 1: Due to #16, never use the cached resolved non-leaf nodes. It may not
// represent its leafs in its entirety.
value = resourceGet( Cldr._resolved, normalizedPath );
if ( value !== undefined && typeof value !== "object" /* 1 */ ) {
return value;
}
// Check raw data
value = resourceGet( Cldr._raw, normalizedPath );
if ( value === undefined ) {
// Or, lookup at parent locale
parent = bundleParentLookup( Cldr, locale );
value = lookup( Cldr, parent, path, jsonMerge( attributes, { bundle: parent }), locale );
}
if ( value !== undefined ) {
// Set resolved (cached)
resourceSet( Cldr._resolved, normalizedPath, value );
}
return value;
};
return lookup;
}());