bn_BD.go 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. package bn_BD
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type bn_BD struct {
  10. locale string
  11. pluralsCardinal []locales.PluralRule
  12. pluralsOrdinal []locales.PluralRule
  13. pluralsRange []locales.PluralRule
  14. decimal string
  15. group string
  16. minus string
  17. percent string
  18. perMille string
  19. timeSeparator string
  20. inifinity string
  21. currencies []string // idx = enum of currency code
  22. currencyNegativePrefix string
  23. currencyNegativeSuffix string
  24. monthsAbbreviated []string
  25. monthsNarrow []string
  26. monthsWide []string
  27. daysAbbreviated []string
  28. daysNarrow []string
  29. daysShort []string
  30. daysWide []string
  31. periodsAbbreviated []string
  32. periodsNarrow []string
  33. periodsShort []string
  34. periodsWide []string
  35. erasAbbreviated []string
  36. erasNarrow []string
  37. erasWide []string
  38. timezones map[string]string
  39. }
  40. // New returns a new instance of translator for the 'bn_BD' locale
  41. func New() locales.Translator {
  42. return &bn_BD{
  43. locale: "bn_BD",
  44. pluralsCardinal: []locales.PluralRule{2, 6},
  45. pluralsOrdinal: []locales.PluralRule{2, 3, 4, 5, 6},
  46. pluralsRange: []locales.PluralRule{2, 6},
  47. timeSeparator: ":",
  48. 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 "},
  49. currencyNegativePrefix: "(",
  50. currencyNegativeSuffix: ")",
  51. monthsAbbreviated: []string{"", "জানুয়ারী", "ফেব্রুয়ারী", "মার্চ", "এপ্রিল", "মে", "জুন", "জুলাই", "আগস্ট", "সেপ্টেম্বর", "অক্টোবর", "নভেম্বর", "ডিসেম্বর"},
  52. monthsNarrow: []string{"", "জা", "ফে", "মা", "এ", "মে", "জুন", "জু", "আ", "সে", "অ", "ন", "ডি"},
  53. monthsWide: []string{"", "জানুয়ারী", "ফেব্রুয়ারী", "মার্চ", "এপ্রিল", "মে", "জুন", "জুলাই", "আগস্ট", "সেপ্টেম্বর", "অক্টোবর", "নভেম্বর", "ডিসেম্বর"},
  54. daysAbbreviated: []string{"রবি", "সোম", "মঙ্গল", "বুধ", "বৃহস্পতি", "শুক্র", "শনি"},
  55. daysNarrow: []string{"র", "সো", "ম", "বু", "বৃ", "শু", "শ"},
  56. daysShort: []string{"রঃ", "সোঃ", "মঃ", "বুঃ", "বৃঃ", "শুঃ", "শোঃ"},
  57. daysWide: []string{"রবিবার", "সোমবার", "মঙ্গলবার", "বুধবার", "বৃহস্পতিবার", "শুক্রবার", "শনিবার"},
  58. periodsAbbreviated: []string{"AM", "PM"},
  59. periodsNarrow: []string{"AM", "PM"},
  60. periodsWide: []string{"পূর্বাহ্ণ", "অপরাহ্ণ"},
  61. erasAbbreviated: []string{"খ্রিস্টপূর্ব", "খৃষ্টাব্দ"},
  62. erasNarrow: []string{"", ""},
  63. erasWide: []string{"খ্রিস্টপূর্ব", "খৃষ্টাব্দ"},
  64. timezones: map[string]string{"ACST": "অস্ট্রেলীয় কেন্দ্রীয় মানক সময়", "ARST": "আর্জেনটিনা গৃষ্মকালীন সময়", "AEDT": "অস্ট্রেলীয় পূর্ব দিবালোক সময়", "ChST": "চামেরো মানক সময়", "HAST": "হাওয়াই-আলেউত মানক সময়", "HKST": "হং কং গ্রীষ্মকালীন সময়", "JDT": "জাপান দিবালোক সময়", "NZDT": "নিউজিল্যান্ড দিবালোক সময়", "VET": "ভেনেজুয়েলা সময়", "CHADT": "চ্যাথাম দিবালোক সময়", "EAT": "পূর্ব আফ্রিকা সময়", "MST": "মাকাও মান সময়", "PDT": "প্রশান্ত মহাসাগরীয় অঞ্চলের দিনের সময়", "AWDT": "অস্ট্রেলীয় পশ্চিমি দিবালোক সময়", "AST": "অতলান্তিক মানক সময়", "GMT": "গ্রীনিচ মিন টাইম", "TMT": "তুর্কমেনিস্তান মানক সময়", "PST": "প্রশান্ত মহাসাগরীয় অঞ্চলের প্রমাণ সময়", "AWST": "অস্ট্রেলিয়ান পশ্চিমি মানক সময়", "JST": "জাপান মানক সময়", "MESZ": "মধ্য ইউরোপের গ্রীষ্মকালীন সময়", "EST": "পূর্বাঞ্চলের প্রমাণ সময়", "SAST": "দক্ষিণ আফ্রিকা মানক সময়", "CLT": "চিলি মানক সময়", "CST": "কেন্দ্রীয় মানক সময়", "WART": "পশ্চিমি আর্জেনটিনার প্রমাণ সময়", "WARST": "পশ্চিমি আর্জেনটিনা গৃষ্মকালীন সময়", "WITA": "কেন্দ্রীয় ইন্দোনেশিয়া সময়", "TMST": "তুর্কমেনিস্তান গ্রীষ্মকালীন সময়", "SRT": "সুরিনাম সময়", "LHST": "লর্ড হাওয়ে মানক মসয়", "MEZ": "মধ্য ইউরোপের প্রমাণ সময়", "HKT": "হং কং মানক সময়", "ADT": "অতলান্তিক দিবালোক সময়", "ACWDT": "অস্ট্রেলীয় কেন্দ্রীয় পশ্চিমি দিবালোক সময়", "BOT": "বোলিভিয়া সময়", "COST": "কোলোম্বিয়া গ্রীষ্মকালীন সময়", "GFT": "ফরাসি গায়ানা সময়", "ACDT": "অস্ট্রেলীয় কেন্দ্রীয় দিবালোক সময়", "WESZ": "পশ্চিম ইউরোপের গ্রীষ্মকালীন সময়", "HADT": "হাওয়াই-আলেউত দিবালোক সময়", "SGT": "সিঙ্গাপুর মানক সময়", "MDT": "মাকাও গ্রীষ্মকাল সময়", "WAST": "পশ্চিম আফ্রিকা গ্রীষ্মকালীন সময়", "AKST": "আলাস্কা মানক সময়", "MYT": "মালয়েশিয়া সময়", "ACWST": "অস্ট্রেলীয় কেন্দ্রীয় পশ্চিমি মানক সময়", "WAT": "পশ্চিম আফ্রিকা মানক সময়", "GYT": "গুয়ানা সময়", "WEZ": "পশ্চিম ইউরোপের প্রমাণ সময়", "CAT": "মধ্য আফ্রিকা সময়", "ECT": "ইকুয়েডর সময়", "ART": "আর্জেনটিনা মানক সময়", "OEZ": "পূর্ব ইউরোপের প্রমাণ সময়", "OESZ": "পূর্ব ইউরোপের গ্রীষ্মকালীন সময়", "NZST": "নিউজিল্যান্ড মানক সময়", "EDT": "পূর্বাঞ্চলের দিবালোক সময়", "IST": "ভারতীয় মানক সময়", "CDT": "কেন্দ্রীয় দিবালোক সময়", "LHDT": "লর্ড হাওয়ে দিবালোক মসয়", "HAT": "নিউফাউন্ডল্যান্ড দিবালোক সময়", "CHAST": "চ্যাথাম মানক সময়", "CLST": "চিলি গ্রীষ্মকাল সময়", "HNT": "নিউফাউন্ডল্যান্ড মানক সময়", "WIB": "পশ্চিমী ইন্দোনেশিয়া সময়", "∅∅∅": "অ্যামাজন গ্রীষ্মকালীন সময়", "AKDT": "আলাস্কা দিবালোক সময়", "BT": "ভুটান সময়", "UYT": "উরুগুয়ে মানক সময়", "UYST": "উরুগুয়ে গ্রীষ্মকালীন সময়", "AEST": "অস্ট্রেলীয় পূর্ব মানক সময়", "COT": "কোলোম্বিয়া মানক সময়", "WIT": "পূর্ব ইন্দোনেশিয়া সময়"},
  65. }
  66. }
  67. // Locale returns the current translators string locale
  68. func (bn *bn_BD) Locale() string {
  69. return bn.locale
  70. }
  71. // PluralsCardinal returns the list of cardinal plural rules associated with 'bn_BD'
  72. func (bn *bn_BD) PluralsCardinal() []locales.PluralRule {
  73. return bn.pluralsCardinal
  74. }
  75. // PluralsOrdinal returns the list of ordinal plural rules associated with 'bn_BD'
  76. func (bn *bn_BD) PluralsOrdinal() []locales.PluralRule {
  77. return bn.pluralsOrdinal
  78. }
  79. // PluralsRange returns the list of range plural rules associated with 'bn_BD'
  80. func (bn *bn_BD) PluralsRange() []locales.PluralRule {
  81. return bn.pluralsRange
  82. }
  83. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'bn_BD'
  84. func (bn *bn_BD) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  85. n := math.Abs(num)
  86. i := int64(n)
  87. if (i == 0) || (n == 1) {
  88. return locales.PluralRuleOne
  89. }
  90. return locales.PluralRuleOther
  91. }
  92. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'bn_BD'
  93. func (bn *bn_BD) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  94. n := math.Abs(num)
  95. if n == 1 || n == 5 || n == 7 || n == 8 || n == 9 || n == 10 {
  96. return locales.PluralRuleOne
  97. } else if n == 2 || n == 3 {
  98. return locales.PluralRuleTwo
  99. } else if n == 4 {
  100. return locales.PluralRuleFew
  101. } else if n == 6 {
  102. return locales.PluralRuleMany
  103. }
  104. return locales.PluralRuleOther
  105. }
  106. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'bn_BD'
  107. func (bn *bn_BD) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  108. start := bn.CardinalPluralRule(num1, v1)
  109. end := bn.CardinalPluralRule(num2, v2)
  110. if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
  111. return locales.PluralRuleOne
  112. } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  113. return locales.PluralRuleOther
  114. }
  115. return locales.PluralRuleOther
  116. }
  117. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  118. func (bn *bn_BD) MonthAbbreviated(month time.Month) string {
  119. return bn.monthsAbbreviated[month]
  120. }
  121. // MonthsAbbreviated returns the locales abbreviated months
  122. func (bn *bn_BD) MonthsAbbreviated() []string {
  123. return bn.monthsAbbreviated[1:]
  124. }
  125. // MonthNarrow returns the locales narrow month given the 'month' provided
  126. func (bn *bn_BD) MonthNarrow(month time.Month) string {
  127. return bn.monthsNarrow[month]
  128. }
  129. // MonthsNarrow returns the locales narrow months
  130. func (bn *bn_BD) MonthsNarrow() []string {
  131. return bn.monthsNarrow[1:]
  132. }
  133. // MonthWide returns the locales wide month given the 'month' provided
  134. func (bn *bn_BD) MonthWide(month time.Month) string {
  135. return bn.monthsWide[month]
  136. }
  137. // MonthsWide returns the locales wide months
  138. func (bn *bn_BD) MonthsWide() []string {
  139. return bn.monthsWide[1:]
  140. }
  141. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  142. func (bn *bn_BD) WeekdayAbbreviated(weekday time.Weekday) string {
  143. return bn.daysAbbreviated[weekday]
  144. }
  145. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  146. func (bn *bn_BD) WeekdaysAbbreviated() []string {
  147. return bn.daysAbbreviated
  148. }
  149. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  150. func (bn *bn_BD) WeekdayNarrow(weekday time.Weekday) string {
  151. return bn.daysNarrow[weekday]
  152. }
  153. // WeekdaysNarrow returns the locales narrow weekdays
  154. func (bn *bn_BD) WeekdaysNarrow() []string {
  155. return bn.daysNarrow
  156. }
  157. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  158. func (bn *bn_BD) WeekdayShort(weekday time.Weekday) string {
  159. return bn.daysShort[weekday]
  160. }
  161. // WeekdaysShort returns the locales short weekdays
  162. func (bn *bn_BD) WeekdaysShort() []string {
  163. return bn.daysShort
  164. }
  165. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  166. func (bn *bn_BD) WeekdayWide(weekday time.Weekday) string {
  167. return bn.daysWide[weekday]
  168. }
  169. // WeekdaysWide returns the locales wide weekdays
  170. func (bn *bn_BD) WeekdaysWide() []string {
  171. return bn.daysWide
  172. }
  173. // FmtNumber returns 'num' with digits/precision of 'v' for 'bn_BD' and handles both Whole and Real numbers based on 'v'
  174. func (bn *bn_BD) FmtNumber(num float64, v uint64) string {
  175. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  176. l := len(s) + 0 + 0*len(s[:len(s)-int(v)-1])/3
  177. count := 0
  178. inWhole := v == 0
  179. inSecondary := false
  180. groupThreshold := 3
  181. b := make([]byte, 0, l)
  182. for i := len(s) - 1; i >= 0; i-- {
  183. if s[i] == '.' {
  184. b = append(b, bn.decimal[0])
  185. inWhole = true
  186. continue
  187. }
  188. if inWhole {
  189. if count == groupThreshold {
  190. b = append(b, bn.group[0])
  191. count = 1
  192. if !inSecondary {
  193. inSecondary = true
  194. groupThreshold = 2
  195. }
  196. } else {
  197. count++
  198. }
  199. }
  200. b = append(b, s[i])
  201. }
  202. if num < 0 {
  203. b = append(b, bn.minus[0])
  204. }
  205. // reverse
  206. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  207. b[i], b[j] = b[j], b[i]
  208. }
  209. return string(b)
  210. }
  211. // FmtPercent returns 'num' with digits/precision of 'v' for 'bn_BD' and handles both Whole and Real numbers based on 'v'
  212. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  213. func (bn *bn_BD) FmtPercent(num float64, v uint64) string {
  214. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  215. l := len(s) + 0
  216. b := make([]byte, 0, l)
  217. for i := len(s) - 1; i >= 0; i-- {
  218. if s[i] == '.' {
  219. b = append(b, bn.decimal[0])
  220. continue
  221. }
  222. b = append(b, s[i])
  223. }
  224. if num < 0 {
  225. b = append(b, bn.minus[0])
  226. }
  227. // reverse
  228. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  229. b[i], b[j] = b[j], b[i]
  230. }
  231. b = append(b, bn.percent...)
  232. return string(b)
  233. }
  234. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'bn_BD'
  235. func (bn *bn_BD) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  236. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  237. symbol := bn.currencies[currency]
  238. l := len(s) + len(symbol) + 0 + 0*len(s[:len(s)-int(v)-1])/3
  239. count := 0
  240. inWhole := v == 0
  241. inSecondary := false
  242. groupThreshold := 3
  243. b := make([]byte, 0, l)
  244. for i := len(s) - 1; i >= 0; i-- {
  245. if s[i] == '.' {
  246. b = append(b, bn.decimal[0])
  247. inWhole = true
  248. continue
  249. }
  250. if inWhole {
  251. if count == groupThreshold {
  252. b = append(b, bn.group[0])
  253. count = 1
  254. if !inSecondary {
  255. inSecondary = true
  256. groupThreshold = 2
  257. }
  258. } else {
  259. count++
  260. }
  261. }
  262. b = append(b, s[i])
  263. }
  264. if num < 0 {
  265. b = append(b, bn.minus[0])
  266. }
  267. // reverse
  268. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  269. b[i], b[j] = b[j], b[i]
  270. }
  271. if int(v) < 2 {
  272. if v == 0 {
  273. b = append(b, bn.decimal...)
  274. }
  275. for i := 0; i < 2-int(v); i++ {
  276. b = append(b, '0')
  277. }
  278. }
  279. b = append(b, symbol...)
  280. return string(b)
  281. }
  282. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bn_BD'
  283. // in accounting notation.
  284. func (bn *bn_BD) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  285. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  286. symbol := bn.currencies[currency]
  287. l := len(s) + len(symbol) + 2 + 0*len(s[:len(s)-int(v)-1])/3
  288. count := 0
  289. inWhole := v == 0
  290. inSecondary := false
  291. groupThreshold := 3
  292. b := make([]byte, 0, l)
  293. for i := len(s) - 1; i >= 0; i-- {
  294. if s[i] == '.' {
  295. b = append(b, bn.decimal[0])
  296. inWhole = true
  297. continue
  298. }
  299. if inWhole {
  300. if count == groupThreshold {
  301. b = append(b, bn.group[0])
  302. count = 1
  303. if !inSecondary {
  304. inSecondary = true
  305. groupThreshold = 2
  306. }
  307. } else {
  308. count++
  309. }
  310. }
  311. b = append(b, s[i])
  312. }
  313. if num < 0 {
  314. b = append(b, bn.currencyNegativePrefix[0])
  315. }
  316. // reverse
  317. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  318. b[i], b[j] = b[j], b[i]
  319. }
  320. if int(v) < 2 {
  321. if v == 0 {
  322. b = append(b, bn.decimal...)
  323. }
  324. for i := 0; i < 2-int(v); i++ {
  325. b = append(b, '0')
  326. }
  327. }
  328. if num < 0 {
  329. b = append(b, bn.currencyNegativeSuffix...)
  330. b = append(b, symbol...)
  331. } else {
  332. b = append(b, symbol...)
  333. }
  334. return string(b)
  335. }
  336. // FmtDateShort returns the short date representation of 't' for 'bn_BD'
  337. func (bn *bn_BD) FmtDateShort(t time.Time) string {
  338. b := make([]byte, 0, 32)
  339. b = strconv.AppendInt(b, int64(t.Day()), 10)
  340. b = append(b, []byte{0x2f}...)
  341. b = strconv.AppendInt(b, int64(t.Month()), 10)
  342. b = append(b, []byte{0x2f}...)
  343. if t.Year() > 9 {
  344. b = append(b, strconv.Itoa(t.Year())[2:]...)
  345. } else {
  346. b = append(b, strconv.Itoa(t.Year())[1:]...)
  347. }
  348. return string(b)
  349. }
  350. // FmtDateMedium returns the medium date representation of 't' for 'bn_BD'
  351. func (bn *bn_BD) FmtDateMedium(t time.Time) string {
  352. b := make([]byte, 0, 32)
  353. b = strconv.AppendInt(b, int64(t.Day()), 10)
  354. b = append(b, []byte{0x20}...)
  355. b = append(b, bn.monthsAbbreviated[t.Month()]...)
  356. b = append(b, []byte{0x2c, 0x20}...)
  357. b = strconv.AppendInt(b, int64(t.Year()), 10)
  358. return string(b)
  359. }
  360. // FmtDateLong returns the long date representation of 't' for 'bn_BD'
  361. func (bn *bn_BD) FmtDateLong(t time.Time) string {
  362. b := make([]byte, 0, 32)
  363. b = strconv.AppendInt(b, int64(t.Day()), 10)
  364. b = append(b, []byte{0x20}...)
  365. b = append(b, bn.monthsWide[t.Month()]...)
  366. b = append(b, []byte{0x2c, 0x20}...)
  367. b = strconv.AppendInt(b, int64(t.Year()), 10)
  368. return string(b)
  369. }
  370. // FmtDateFull returns the full date representation of 't' for 'bn_BD'
  371. func (bn *bn_BD) FmtDateFull(t time.Time) string {
  372. b := make([]byte, 0, 32)
  373. b = append(b, bn.daysWide[t.Weekday()]...)
  374. b = append(b, []byte{0x2c, 0x20}...)
  375. b = strconv.AppendInt(b, int64(t.Day()), 10)
  376. b = append(b, []byte{0x20}...)
  377. b = append(b, bn.monthsWide[t.Month()]...)
  378. b = append(b, []byte{0x2c, 0x20}...)
  379. b = strconv.AppendInt(b, int64(t.Year()), 10)
  380. return string(b)
  381. }
  382. // FmtTimeShort returns the short time representation of 't' for 'bn_BD'
  383. func (bn *bn_BD) FmtTimeShort(t time.Time) string {
  384. b := make([]byte, 0, 32)
  385. h := t.Hour()
  386. if h > 12 {
  387. h -= 12
  388. }
  389. b = strconv.AppendInt(b, int64(h), 10)
  390. b = append(b, bn.timeSeparator...)
  391. if t.Minute() < 10 {
  392. b = append(b, '0')
  393. }
  394. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  395. b = append(b, []byte{0x20}...)
  396. if t.Hour() < 12 {
  397. b = append(b, bn.periodsAbbreviated[0]...)
  398. } else {
  399. b = append(b, bn.periodsAbbreviated[1]...)
  400. }
  401. return string(b)
  402. }
  403. // FmtTimeMedium returns the medium time representation of 't' for 'bn_BD'
  404. func (bn *bn_BD) FmtTimeMedium(t time.Time) string {
  405. b := make([]byte, 0, 32)
  406. h := t.Hour()
  407. if h > 12 {
  408. h -= 12
  409. }
  410. b = strconv.AppendInt(b, int64(h), 10)
  411. b = append(b, bn.timeSeparator...)
  412. if t.Minute() < 10 {
  413. b = append(b, '0')
  414. }
  415. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  416. b = append(b, bn.timeSeparator...)
  417. if t.Second() < 10 {
  418. b = append(b, '0')
  419. }
  420. b = strconv.AppendInt(b, int64(t.Second()), 10)
  421. b = append(b, []byte{0x20}...)
  422. if t.Hour() < 12 {
  423. b = append(b, bn.periodsAbbreviated[0]...)
  424. } else {
  425. b = append(b, bn.periodsAbbreviated[1]...)
  426. }
  427. return string(b)
  428. }
  429. // FmtTimeLong returns the long time representation of 't' for 'bn_BD'
  430. func (bn *bn_BD) FmtTimeLong(t time.Time) string {
  431. b := make([]byte, 0, 32)
  432. h := t.Hour()
  433. if h > 12 {
  434. h -= 12
  435. }
  436. b = strconv.AppendInt(b, int64(h), 10)
  437. b = append(b, bn.timeSeparator...)
  438. if t.Minute() < 10 {
  439. b = append(b, '0')
  440. }
  441. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  442. b = append(b, bn.timeSeparator...)
  443. if t.Second() < 10 {
  444. b = append(b, '0')
  445. }
  446. b = strconv.AppendInt(b, int64(t.Second()), 10)
  447. b = append(b, []byte{0x20}...)
  448. if t.Hour() < 12 {
  449. b = append(b, bn.periodsAbbreviated[0]...)
  450. } else {
  451. b = append(b, bn.periodsAbbreviated[1]...)
  452. }
  453. b = append(b, []byte{0x20}...)
  454. tz, _ := t.Zone()
  455. b = append(b, tz...)
  456. return string(b)
  457. }
  458. // FmtTimeFull returns the full time representation of 't' for 'bn_BD'
  459. func (bn *bn_BD) FmtTimeFull(t time.Time) string {
  460. b := make([]byte, 0, 32)
  461. h := t.Hour()
  462. if h > 12 {
  463. h -= 12
  464. }
  465. b = strconv.AppendInt(b, int64(h), 10)
  466. b = append(b, bn.timeSeparator...)
  467. if t.Minute() < 10 {
  468. b = append(b, '0')
  469. }
  470. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  471. b = append(b, bn.timeSeparator...)
  472. if t.Second() < 10 {
  473. b = append(b, '0')
  474. }
  475. b = strconv.AppendInt(b, int64(t.Second()), 10)
  476. b = append(b, []byte{0x20}...)
  477. if t.Hour() < 12 {
  478. b = append(b, bn.periodsAbbreviated[0]...)
  479. } else {
  480. b = append(b, bn.periodsAbbreviated[1]...)
  481. }
  482. b = append(b, []byte{0x20}...)
  483. tz, _ := t.Zone()
  484. if btz, ok := bn.timezones[tz]; ok {
  485. b = append(b, btz...)
  486. } else {
  487. b = append(b, tz...)
  488. }
  489. return string(b)
  490. }