vox-core
Version:
Runtime de aplicaciones multiplataforma
82 lines (63 loc) • 2.19 kB
JavaScript
/**
* @author James Suárez
* System.Globalization.RegionInfo
* 25-02-2016
*/
var Util= core.VW.Util;
var cultureData= require("./cultureDataInfo.js");
var CultureInfo= require("./CultureInfo");
var RegionInfo=module.exports=function(/*string or int*/ id){
this.$data=cultureData.getDataFromRegion(id);
this.$m_cultureData= this.$data.m_cultureData;
if(typeof id=="number"){
this.$m_name= this.$m_cultureData.sRegionName;
}
else{
if(id.toUpperCase()==this.$m_cultureData.sRegionName.toUpperCase()){
this.$m_name= this.$m_cultureData.sRegionName;
}
else{
this.$m_name= this.$m_cultureData.sRealName;
}
}
}
/** INSTANCE PROPERTIES*/
RegionInfo.prototype.get_currencyEnglishName=function(){
return this.$m_cultureData.sEnglishCurrency;
}
RegionInfo.prototype.get_currencyNativeName=function(){
//return this.$m_cultureData.sNativeCurrency;
var cul= CultureInfo.getCultureInfo(this.$m_cultureData.sRealName);
return cul.$nativeCurrencyName(this.ISOCurrencySymbol);
}
RegionInfo.prototype.get_currencyDisplayName=function(){
return CultureInfo.currentCulture.$nativeCurrencyName(this.ISOCurrencySymbol);
}
RegionInfo.prototype.get_currencySymbol=function(){
return this.$m_cultureData.sCurrency;
}
RegionInfo.prototype.get_displayName=function(){
return CultureInfo.currentCulture.$nativeRegionName(this.twoLetterISORegionName);
}
RegionInfo.prototype.get_englishName=function(){
return this.$m_cultureData.sEnglishCountry;
}
RegionInfo.prototype.get_isMetric=function(){
return this.$m_cultureData.iMeasure==0;
}
RegionInfo.prototype.get_ISOCurrencySymbol=function(){
return this.$m_cultureData.sIntlMonetarySymbol;
}
RegionInfo.prototype.get_name=function(){
return this.$m_name;
}
RegionInfo.prototype.get_nativeName=function(){
return this.$m_cultureData.sNativeCountry;
}
RegionInfo.prototype.get_threeLetterISORegionName=function(){
return this.$m_cultureData.sISO3166CountryName2;
}
RegionInfo.prototype.get_twoLetterISORegionName=function(){
return this.$m_cultureData.sISO3166CountryName;
}
Util.createProperties(RegionInfo,RegionInfo.prototype);