diff options
author | joeybloggs <Dean.Karn@gmail.com> | 2016-08-16 04:18:40 +0300 |
---|---|---|
committer | joeybloggs <Dean.Karn@gmail.com> | 2016-08-16 04:18:40 +0300 |
commit | 5e30685010ab9c6da8cc729a3e7eab0b1ae964ae (patch) | |
tree | 11782ebd7840c5c9bd60cdf318cd98898fb11fc7 /rules.go | |
parent | 7a50918c70b219070868048aa533f5b142880103 (diff) |
add regular currency logic
Diffstat (limited to 'rules.go')
-rw-r--r-- | rules.go | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -1,6 +1,10 @@ package locales -import "strconv" +import ( + "strconv" + + "github.com/go-playground/locales/currency" +) // // ErrBadNumberValue is returned when the number passed for // // plural rule determination cannot be parsed @@ -57,16 +61,21 @@ type Translator interface { // returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for locale RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) PluralRule - // returns 'num' with digits/precision of 'v' for 'mr_IN' and handles both Whole and Real numbers based on 'v' + // returns 'num' with digits/precision of 'v' for locale and handles both Whole and Real numbers based on 'v' // returned as a []byte just in case the caller wishes to add more and can help // avoid allocations; otherwise just cast as string. FmtNumber(num float64, v uint64) []byte - // returns 'num' with digits/precision of 'v' for '{{ .Locale }}' and handles both Whole and Real numbers based on 'v' + // returns 'num' with digits/precision of 'v' for locale and handles both Whole and Real numbers based on 'v' // returned as a []byte just in case the caller wishes to add more and can help // avoid allocations; otherwise just cast as string. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already FmtPercent(num float64, v uint64) []byte + + // returns the currency representation of 'num' with digits/precision of 'v' for locale + // returned as a []byte just in case the caller wishes to add more and can help + // avoid allocations; otherwise just cast as string. + FmtCurrency(num float64, v uint64, currency currency.Type) []byte } // String returns the string value of PluralRule |