META-INF.resources.bower_components.cldrjs.src.path.normalize.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jwebmp-globalize Show documentation
Show all versions of jwebmp-globalize Show documentation
The JWebSwing implementation for a full Globalization
The newest version!
define([
"../util/array/is_array"
], function (arrayIsArray) {
return function (path, attributes) {
if (arrayIsArray(path)) {
path = path.join("/");
}
if (typeof path !== "string") {
throw new Error("invalid path \"" + path + "\"");
}
// 1: Ignore leading slash `/`
// 2: Ignore leading `cldr/`
path = path
.replace(/^\//, "") /* 1 */
.replace(/^cldr\//, "");
/* 2 */
// Replace {attribute}'s
path = path.replace(/{[a-zA-Z]+}/g, function (name) {
name = name.replace(/^{([^}]*)}$/, "$1");
return attributes[name];
});
return path.split("/");
};
});