diff options
author | Dean Karn <Dean.Karn@metricaid.com> | 2016-09-11 16:37:03 +0300 |
---|---|---|
committer | Dean Karn <Dean.Karn@metricaid.com> | 2016-09-11 16:37:03 +0300 |
commit | 5b6f32dd67efd00b8d58b98ea7d6c8b7fdff6e9b (patch) | |
tree | 19a0522646eafcdc8bc4a83b67fdaa68da814cc4 /en_AT | |
parent | aaae900248cc5de78e3c73c1ec3b3cc6dac92f9b (diff) |
add check for multibyte chars after switching from []byte to string
Diffstat (limited to 'en_AT')
-rw-r--r-- | en_AT/en_AT.go | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/en_AT/en_AT.go b/en_AT/en_AT.go index 6e199d46..0169ca88 100644 --- a/en_AT/en_AT.go +++ b/en_AT/en_AT.go @@ -18,7 +18,7 @@ type en_AT struct { group string minus string percent string - percentSuffix []byte + percentSuffix string perMille string timeSeparator string inifinity string @@ -57,7 +57,7 @@ func New() locales.Translator { timeSeparator: ":", inifinity: "∞", currencies: []string{"ADP ", "AED ", "AFA ", "AFN ", "ALK ", "ALL ", "AMD ", "ANG ", "AOA ", "AOK ", "AON ", "AOR ", "ARA ", "ARL ", "ARM ", "ARP ", "ARS ", "ATS ", "AUD ", "AWG ", "AZM ", "AZN ", "BAD ", "BAM ", "BAN ", "BBD ", "BDT ", "BEC ", "BEF ", "BEL ", "BGL ", "BGM ", "BGN ", "BGO ", "BHD ", "BIF ", "BMD ", "BND ", "BOB ", "BOL ", "BOP ", "BOV ", "BRB ", "BRC ", "BRE ", "BRL ", "BRN ", "BRR ", "BRZ ", "BSD ", "BTN ", "BUK ", "BWP ", "BYB ", "BYR ", "BZD ", "CAD ", "CDF ", "CHE ", "CHF ", "CHW ", "CLE ", "CLF ", "CLP ", "CNX ", "CNY ", "COP ", "COU ", "CRC ", "CSD ", "CSK ", "CUC ", "CUP ", "CVE ", "CYP ", "CZK ", "DDM ", "DEM ", "DJF ", "DKK ", "DOP ", "DZD ", "ECS ", "ECV ", "EEK ", "EGP ", "ERN ", "ESA ", "ESB ", "ESP ", "ETB ", "EUR ", "FIM ", "FJD ", "FKP ", "FRF ", "GBP ", "GEK ", "GEL ", "GHC ", "GHS ", "GIP ", "GMD ", "GNF ", "GNS ", "GQE ", "GRD ", "GTQ ", "GWE ", "GWP ", "GYD ", "HKD ", "HNL ", "HRD ", "HRK ", "HTG ", "HUF ", "IDR ", "IEP ", "ILP ", "ILR ", "ILS ", "INR ", "IQD ", "IRR ", "ISJ ", "ISK ", "ITL ", "JMD ", "JOD ", "JPY ", "KES ", "KGS ", "KHR ", "KMF ", "KPW ", "KRH ", "KRO ", "KRW ", "KWD ", "KYD ", "KZT ", "LAK ", "LBP ", "LKR ", "LRD ", "LSL ", "LTL ", "LTT ", "LUC ", "LUF ", "LUL ", "LVL ", "LVR ", "LYD ", "MAD ", "MAF ", "MCF ", "MDC ", "MDL ", "MGA ", "MGF ", "MKD ", "MKN ", "MLF ", "MMK ", "MNT ", "MOP ", "MRO ", "MTL ", "MTP ", "MUR ", "MVP ", "MVR ", "MWK ", "MXN ", "MXP ", "MXV ", "MYR ", "MZE ", "MZM ", "MZN ", "NAD ", "NGN ", "NIC ", "NIO ", "NLG ", "NOK ", "NPR ", "NZD ", "OMR ", "PAB ", "PEI ", "PEN ", "PES ", "PGK ", "PHP ", "PKR ", "PLN ", "PLZ ", "PTE ", "PYG ", "QAR ", "RHD ", "ROL ", "RON ", "RSD ", "RUB ", "RUR ", "RWF ", "SAR ", "SBD ", "SCR ", "SDD ", "SDG ", "SDP ", "SEK ", "SGD ", "SHP ", "SIT ", "SKK ", "SLL ", "SOS ", "SRD ", "SRG ", "SSP ", "STD ", "SUR ", "SVC ", "SYP ", "SZL ", "THB ", "TJR ", "TJS ", "TMM ", "TMT ", "TND ", "TOP ", "TPE ", "TRL ", "TRY ", "TTD ", "TWD ", "TZS ", "UAH ", "UAK ", "UGS ", "UGX ", "USD ", "USN ", "USS ", "UYI ", "UYP ", "UYU ", "UZS ", "VEB ", "VEF ", "VND ", "VNN ", "VUV ", "WST ", "XAF ", "XAG ", "XAU ", "XBA ", "XBB ", "XBC ", "XBD ", "XCD ", "XDR ", "XEU ", "XFO ", "XFU ", "XOF ", "XPD ", "XPF ", "XPT ", "XRE ", "XSU ", "XTS ", "XUA ", "XXX ", "YDD ", "YER ", "YUD ", "YUM ", "YUN ", "YUR ", "ZAL ", "ZAR ", "ZMK ", "ZMW ", "ZRN ", "ZRZ ", "ZWD ", "ZWL ", "ZWR "}, - percentSuffix: []byte{0xc2, 0xa0}, + percentSuffix: " ", currencyPositivePrefix: " ", currencyNegativePrefix: " ", monthsAbbreviated: []string{"", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}, @@ -73,7 +73,7 @@ func New() locales.Translator { erasAbbreviated: []string{"BC", "AD"}, erasNarrow: []string{"B", "A"}, erasWide: []string{"Before Christ", "Anno Domini"}, - timezones: map[string]string{"GFT": "French Guiana Time", "CHAST": "Chatham Standard Time", "SAST": "South Africa Standard Time", "ACWST": "Australian Central Western Standard Time", "PDT": "Pacific Daylight Time", "ARST": "Argentina Summer Time", "ChST": "Chamorro Standard Time", "∅∅∅": "Acre Summer Time", "AWST": "Australian Western Standard Time", "UYST": "Uruguay Summer Time", "SRT": "Suriname Time", "MYT": "Malaysia Time", "WIT": "Eastern Indonesia Time", "CAT": "Central Africa Time", "GMT": "Greenwich Mean Time", "WART": "Western Argentina Standard Time", "HNT": "Newfoundland Standard Time", "LHST": "Lord Howe Standard Time", "HAT": "Newfoundland Daylight Time", "WESZ": "Western European Summer Time", "MEZ": "Central European Standard Time", "JST": "Japan Standard Time", "MST": "Macau Standard Time", "OEZ": "Eastern European Standard Time", "OESZ": "Eastern European Summer Time", "AWDT": "Australian Western Daylight Time", "EDT": "Eastern Daylight Time", "TMST": "Turkmenistan Summer Time", "WITA": "Central Indonesia Time", "HADT": "Hawaii-Aleutian Daylight Time", "PST": "Pacific Standard Time", "CHADT": "Chatham Daylight Time", "BOT": "Bolivia Time", "COST": "Colombia Summer Time", "LHDT": "Lord Howe Daylight Time", "MDT": "Macau Summer Time", "CLST": "Chile Summer Time", "AEDT": "Australian Eastern Daylight Time", "MESZ": "Central European Summer Time", "TMT": "Turkmenistan Standard Time", "EST": "Eastern Standard Time", "GYT": "Guyana Time", "WAST": "West Africa Summer Time", "ACWDT": "Australian Central Western Daylight Time", "VET": "Venezuela Time", "AKST": "Alaska Standard Time", "WIB": "Western Indonesia Time", "COT": "Colombia Standard Time", "ART": "Argentina Standard Time", "AEST": "Australian Eastern Standard Time", "WAT": "West Africa Standard Time", "HAST": "Hawaii-Aleutian Standard Time", "CST": "Central Standard Time", "WEZ": "Western European Standard Time", "CLT": "Chile Standard Time", "ACDT": "Australian Central Daylight Time", "SGT": "Singapore Standard Time", "NZST": "New Zealand Standard Time", "NZDT": "New Zealand Daylight Time", "WARST": "Western Argentina Summer Time", "HKST": "Hong Kong Summer Time", "UYT": "Uruguay Standard Time", "ADT": "Atlantic Daylight Time", "AKDT": "Alaska Daylight Time", "HKT": "Hong Kong Standard Time", "EAT": "East Africa Time", "CDT": "Central Daylight Time", "JDT": "Japan Daylight Time", "ECT": "Ecuador Time", "IST": "India Standard Time", "AST": "Atlantic Standard Time", "BT": "Bhutan Time", "ACST": "Australian Central Standard Time"}, + timezones: map[string]string{"VET": "Venezuela Time", "GYT": "Guyana Time", "AWST": "Australian Western Standard Time", "CAT": "Central Africa Time", "HKT": "Hong Kong Standard Time", "ACWDT": "Australian Central Western Daylight Time", "CLT": "Chile Standard Time", "GMT": "Greenwich Mean Time", "WAST": "West Africa Summer Time", "CLST": "Chile Summer Time", "OEZ": "Eastern European Standard Time", "JST": "Japan Standard Time", "AST": "Atlantic Standard Time", "HADT": "Hawaii-Aleutian Daylight Time", "COT": "Colombia Standard Time", "COST": "Colombia Summer Time", "CHADT": "Chatham Daylight Time", "WIB": "Western Indonesia Time", "WARST": "Western Argentina Summer Time", "EDT": "Eastern Daylight Time", "LHDT": "Lord Howe Daylight Time", "MDT": "Macau Summer Time", "BOT": "Bolivia Time", "WIT": "Eastern Indonesia Time", "ART": "Argentina Standard Time", "NZST": "New Zealand Standard Time", "MST": "Macau Standard Time", "ACST": "Australian Central Standard Time", "ACDT": "Australian Central Daylight Time", "ARST": "Argentina Summer Time", "WEZ": "Western European Standard Time", "OESZ": "Eastern European Summer Time", "BT": "Bhutan Time", "AKST": "Alaska Standard Time", "HNT": "Newfoundland Standard Time", "SGT": "Singapore Standard Time", "TMT": "Turkmenistan Standard Time", "ChST": "Chamorro Standard Time", "WESZ": "Western European Summer Time", "NZDT": "New Zealand Daylight Time", "CDT": "Central Daylight Time", "ACWST": "Australian Central Western Standard Time", "MYT": "Malaysia Time", "HKST": "Hong Kong Summer Time", "EST": "Eastern Standard Time", "SAST": "South Africa Standard Time", "MEZ": "Central European Standard Time", "PDT": "Pacific Daylight Time", "AKDT": "Alaska Daylight Time", "∅∅∅": "Peru Summer Time", "WART": "Western Argentina Standard Time", "AWDT": "Australian Western Daylight Time", "UYT": "Uruguay Standard Time", "ADT": "Atlantic Daylight Time", "AEST": "Australian Eastern Standard Time", "UYST": "Uruguay Summer Time", "LHST": "Lord Howe Standard Time", "JDT": "Japan Daylight Time", "IST": "India Standard Time", "TMST": "Turkmenistan Summer Time", "CST": "Central Standard Time", "ECT": "Ecuador Time", "MESZ": "Central European Summer Time", "CHAST": "Chatham Standard Time", "AEDT": "Australian Eastern Daylight Time", "PST": "Pacific Standard Time", "GFT": "French Guiana Time", "WITA": "Central Indonesia Time", "HAST": "Hawaii-Aleutian Standard Time", "EAT": "East Africa Time", "WAT": "West Africa Standard Time", "HAT": "Newfoundland Daylight Time", "SRT": "Suriname Time"}, } } @@ -204,7 +204,8 @@ func (en *en_AT) WeekdaysWide() []string { } // FmtNumber returns 'num' with digits/precision of 'v' for 'en_AT' and handles both Whole and Real numbers based on 'v' -func (en *en_AT) FmtNumber(num float64, v uint64) (results string) { +func (en *en_AT) FmtNumber(num float64, v uint64) string { + s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3 count := 0 @@ -240,13 +241,12 @@ func (en *en_AT) FmtNumber(num float64, v uint64) (results string) { b[i], b[j] = b[j], b[i] } - results = string(b) - return + return string(b) } // FmtPercent returns 'num' with digits/precision of 'v' for 'en_AT' and handles both Whole and Real numbers based on 'v' // NOTE: 'num' passed into FmtPercent is assumed to be in percent already -func (en *en_AT) FmtPercent(num float64, v uint64) (results string) { +func (en *en_AT) FmtPercent(num float64, v uint64) string { s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) l := len(s) + len(en.decimal) b := make([]byte, 0, l) @@ -274,12 +274,11 @@ func (en *en_AT) FmtPercent(num float64, v uint64) (results string) { b = append(b, en.percent...) - results = string(b) - return + return string(b) } // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'en_AT' -func (en *en_AT) FmtCurrency(num float64, v uint64, currency currency.Type) (results string) { +func (en *en_AT) FmtCurrency(num float64, v uint64, currency currency.Type) string { s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) symbol := en.currencies[currency] @@ -336,13 +335,12 @@ func (en *en_AT) FmtCurrency(num float64, v uint64, currency currency.Type) (res } } - results = string(b) - return + return string(b) } // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_AT' // in accounting notation. -func (en *en_AT) FmtAccounting(num float64, v uint64, currency currency.Type) (results string) { +func (en *en_AT) FmtAccounting(num float64, v uint64, currency currency.Type) string { s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) symbol := en.currencies[currency] @@ -411,8 +409,7 @@ func (en *en_AT) FmtAccounting(num float64, v uint64, currency currency.Type) (r } } - results = string(b) - return + return string(b) } // FmtDateShort returns the short date representation of 't' for 'en_AT' |