META-INF.resources.bower_components.globalize.src.currency.symbol-properties.min.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
define(["./supplemental-override","../number/numbering-system","../util/regexp/not-s"],function(currencySupplementalOverride,numberNumberingSystem,regexpNotS){return function(currency,cldr,options){var currencySpacing,pattern,regexp={"[:digit:]":/\d/,"[:^S:]":regexpNotS},symbol=cldr.main(["numbers/currencies",currency,"symbol"]);currencySpacing=["beforeCurrency","afterCurrency"].map(function(position){return cldr.main(["numbers","currencyFormats-numberSystem-"+numberNumberingSystem(cldr),"currencySpacing",position])});pattern=cldr.main(["numbers","currencyFormats-numberSystem-"+numberNumberingSystem(cldr),options.style==="accounting"?"accounting":"standard"]);pattern=currencySupplementalOverride(currency,pattern,cldr).split(";").map(function(pattern){return pattern.split("¤").map(function(part,i){var currencyMatch=regexp[currencySpacing[i].currencyMatch],surroundingMatch=regexp[currencySpacing[i].surroundingMatch],insertBetween="";currencyMatch=currencyMatch.test(symbol.charAt(i?symbol.length-1:0));surroundingMatch=surroundingMatch.test(part.charAt(i?0:part.length-1).replace(/[#@,.]/g,"0"));if(currencyMatch&&part&&surroundingMatch){insertBetween=currencySpacing[i].insertBetween}return(i?insertBetween:"")+part+(i?"":insertBetween)}).join("'"+symbol+"'")}).join(";");return{pattern:pattern}}});