diff options
author | joeybloggs <Dean.Karn@gmail.com> | 2016-08-13 05:06:26 +0300 |
---|---|---|
committer | joeybloggs <Dean.Karn@gmail.com> | 2016-08-13 05:06:26 +0300 |
commit | c934af383da7fcfcc5581f5474c094e703c86ff4 (patch) | |
tree | d1d1ac589ea38524ec37099606b6982072fd2589 /cmd/generate_resources.go | |
parent | 99657750cc781e41c9c1e3be6b6316c18fc430bd (diff) |
add percent + permille length variable for next FmtPercent and FmtDate functions.
Diffstat (limited to 'cmd/generate_resources.go')
-rw-r--r-- | cmd/generate_resources.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/cmd/generate_resources.go b/cmd/generate_resources.go index 52e6a577..3ee9157c 100644 --- a/cmd/generate_resources.go +++ b/cmd/generate_resources.go @@ -63,7 +63,9 @@ type translator struct { Minus string MinusLen int Percent string + PercentLen int PerMille string + PerMilleLen int Currencies string // FmtNumberFunc string FmtNumberExists bool @@ -236,10 +238,12 @@ func postProcess(cldr *cldr.CLDR) { if len(trans.Percent) == 0 { if found { + trans.PercentLen = base.PercentLen trans.Percent = base.Percent } if len(trans.Percent) == 0 { + trans.PercentLen = 0 trans.Percent = "[]byte{}" } } @@ -247,10 +251,12 @@ func postProcess(cldr *cldr.CLDR) { if len(trans.PerMille) == 0 { if found { + trans.PerMilleLen = base.PerMilleLen trans.PerMille = base.PerMille } if len(trans.PerMille) == 0 { + trans.PerMilleLen = 0 trans.PerMille = "[]byte{}" } } @@ -354,10 +360,14 @@ func preProcess(cldr *cldr.CLDR) { trans.Minus = fmt.Sprintf("%#v", b) } if len(symbol.PercentSign) > 0 { - trans.Percent = fmt.Sprintf("%#v", []byte(symbol.PercentSign[0].Data())) + b := []byte(symbol.PercentSign[0].Data()) + trans.PercentLen = len(b) + trans.Percent = fmt.Sprintf("%#v", b) } if len(symbol.PerMille) > 0 { - trans.PerMille = fmt.Sprintf("%#v", []byte(symbol.PerMille[0].Data())) + b := []byte(symbol.PerMille[0].Data()) + trans.PerMilleLen = len(b) + trans.PerMille = fmt.Sprintf("%#v", b) } } |