ta_MY.go 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. package ta_MY
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type ta_MY 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. currencyPositivePrefix string
  23. currencyNegativePrefix 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 'ta_MY' locale
  41. func New() locales.Translator {
  42. return &ta_MY{
  43. locale: "ta_MY",
  44. pluralsCardinal: []locales.PluralRule{2, 6},
  45. pluralsOrdinal: []locales.PluralRule{6},
  46. pluralsRange: []locales.PluralRule{2, 6},
  47. decimal: ".",
  48. group: ",",
  49. minus: "-",
  50. percent: "%",
  51. perMille: "‰",
  52. timeSeparator: ":",
  53. inifinity: "∞",
  54. 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", "BYN", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNH", "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", "RM", "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", "S$", "SHP", "SIT", "SKK", "SLL", "SOS", "SRD", "SRG", "SSP", "STD", "STN", "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"},
  55. currencyPositivePrefix: " ",
  56. currencyNegativePrefix: " ",
  57. monthsAbbreviated: []string{"", "ஜன.", "பிப்.", "மார்.", "ஏப்.", "மே", "ஜூன்", "ஜூலை", "ஆக.", "செப்.", "அக்.", "நவ.", "டிச."},
  58. monthsNarrow: []string{"", "ஜ", "பி", "மா", "ஏ", "மே", "ஜூ", "ஜூ", "ஆ", "செ", "அ", "ந", "டி"},
  59. monthsWide: []string{"", "ஜனவரி", "பிப்ரவரி", "மார்ச்", "ஏப்ரல்", "மே", "ஜூன்", "ஜூலை", "ஆகஸ்ட்", "செப்டம்பர்", "அக்டோபர்", "நவம்பர்", "டிசம்பர்"},
  60. daysAbbreviated: []string{"ஞாயி.", "திங்.", "செவ்.", "புத.", "வியா.", "வெள்.", "சனி"},
  61. daysNarrow: []string{"ஞா", "தி", "செ", "பு", "வி", "வெ", "ச"},
  62. daysShort: []string{"ஞா", "தி", "செ", "பு", "வி", "வெ", "ச"},
  63. daysWide: []string{"ஞாயிறு", "திங்கள்", "செவ்வாய்", "புதன்", "வியாழன்", "வெள்ளி", "சனி"},
  64. periodsAbbreviated: []string{"முற்பகல்", "பிற்பகல்"},
  65. periodsNarrow: []string{"மு.ப", "பி.ப"},
  66. periodsWide: []string{"முற்பகல்", "பிற்பகல்"},
  67. erasAbbreviated: []string{"கி.மு.", "கி.பி."},
  68. erasNarrow: []string{"", ""},
  69. erasWide: []string{"கிறிஸ்துவுக்கு முன்", "அன்னோ டோமினி"},
  70. timezones: map[string]string{"CDT": "மத்திய பகலொளி நேரம்", "UYT": "உருகுவே நிலையான நேரம்", "HNCU": "கியூபா நிலையான நேரம்", "JST": "ஜப்பான் நிலையான நேரம்", "IST": "இந்திய நிலையான நேரம்", "EAT": "கிழக்கு ஆப்பிரிக்க நேரம்", "HADT": "ஹவாய்-அலேஷியன் பகலொளி நேரம்", "MST": "மவுன்டைன் நிலையான நேரம்", "MYT": "மலேஷிய நேரம்", "JDT": "ஜப்பான் பகலொளி நேரம்", "AKDT": "அலாஸ்கா பகலொளி நேரம்", "EST": "கிழக்கத்திய நிலையான நேரம்", "HNNOMX": "வடமேற்கு மெக்ஸிகோ நிலையான நேரம்", "AWST": "ஆஸ்திரேலியன் மேற்கத்திய நிலையான நேரம்", "WAT": "மேற்கு ஆப்பிரிக்க நிலையான நேரம்", "ACDT": "ஆஸ்திரேலியன் மத்திய பகலொளி நேரம்", "HKST": "ஹாங்காங் கோடை நேரம்", "MEZ": "மத்திய ஐரோப்பிய நிலையான நேரம்", "HENOMX": "வடமேற்கு மெக்ஸிகோ பகலொளி நேரம்", "CLST": "சிலி கோடை நேரம்", "GYT": "கயானா நேரம்", "WIB": "மேற்கத்திய இந்தோனேசிய நேரம்", "ADT": "அட்லாண்டிக் பகலொளி நேரம்", "WAST": "மேற்கு ஆப்பிரிக்க கோடை நேரம்", "BOT": "பொலிவியா நேரம்", "BT": "பூடான் நேரம்", "HNEG": "கிழக்கு கிரீன்லாந்து நிலையான நேரம்", "SRT": "சுரினாம் நேரம்", "CHAST": "சத்தாம் நிலையான நேரம்", "HNPMX": "மெக்ஸிகன் பசிபிக் நிலையான நேரம்", "ECT": "ஈக்வடார் நேரம்", "ACWST": "ஆஸ்திரேலியன் மத்திய மேற்கத்திய நிலையான நேரம்", "VET": "வெனிசுலா நேரம்", "WIT": "கிழக்கத்திய இந்தோனேசிய நேரம்", "TMST": "துர்க்மெனிஸ்தான் கோடை நேரம்", "OESZ": "கிழக்கத்திய ஐரோப்பிய கோடை நேரம்", "PDT": "பசிபிக் பகலொளி நேரம்", "ACWDT": "ஆஸ்திரேலியன் மத்திய மேற்கத்திய பகலொளி நேரம்", "EDT": "கிழக்கத்திய பகலொளி நேரம்", "WESZ": "மேற்கத்திய ஐரோப்பிய கோடை நேரம்", "GFT": "ஃபிரஞ்சு கயானா நேரம்", "HEOG": "மேற்கு கிரீன்லாந்து கோடை நேரம்", "CAT": "மத்திய ஆப்பிரிக்க நேரம்", "CHADT": "சத்தாம் பகலொளி நேரம்", "AST": "அட்லாண்டிக் நிலையான நேரம்", "HEPMX": "மெக்ஸிகன் பசிபிக் பகலொளி நேரம்", "LHDT": "லார்ட் ஹோவ் பகலொளி நேரம்", "WITA": "மத்திய இந்தோனேசிய நேரம்", "HNT": "நியூஃபவுண்ட்லாந்து நிலையான நேரம்", "ARST": "அர்ஜென்டினா கோடை நேரம்", "HECU": "கியூபா பகலொளி நேரம்", "WEZ": "மேற்கத்திய ஐரோப்பிய நிலையான நேரம்", "NZST": "நியூசிலாந்து நிலையான நேரம்", "WARST": "மேற்கத்திய அர்ஜென்டினா கோடை நேரம்", "COT": "கொலம்பியா நிலையான நேரம்", "COST": "கொலம்பியா கோடை நேரம்", "SAST": "தென் ஆப்பிரிக்க நிலையான நேரம்", "MESZ": "மத்திய ஐரோப்பிய கோடை நேரம்", "WART": "மேற்கத்திய அர்ஜென்டினா நிலையான நேரம்", "OEZ": "கிழக்கத்திய ஐரோப்பிய நிலையான நேரம்", "CST": "மத்திய நிலையான நேரம்", "SGT": "சிங்கப்பூர் நிலையான நேரம்", "HNOG": "மேற்கு கிரீன்லாந்து நிலையான நேரம்", "HAT": "நியூஃபவுண்ட்லாந்து பகலொளி நேரம்", "CLT": "சிலி நிலையான நேரம்", "TMT": "துர்க்மெனிஸ்தான் நிலையான நேரம்", "AEST": "ஆஸ்திரேலியன் கிழக்கத்திய நிலையான நேரம்", "AEDT": "ஆஸ்திரேலியன் கிழக்கத்திய பகலொளி நேரம்", "AKST": "அலாஸ்கா நிலையான நேரம்", "ACST": "ஆஸ்திரேலியன் மத்திய நிலையான நேரம்", "HEEG": "கிழக்கு கிரீன்லாந்து கோடை நேரம்", "HKT": "ஹாங்காங் நிலையான நேரம்", "LHST": "லார்ட் ஹோவ் நிலையான நேரம்", "HEPM": "செயின்ட் பியரி & மிக்குயிலான் பகலொளி நேரம்", "UYST": "உருகுவே கோடை நேரம்", "PST": "பசிபிக் நிலையான நேரம்", "∅∅∅": "அமேசான் கோடை நேரம்", "GMT": "கிரீன்விச் சராசரி நேரம்", "ChST": "சாமோரோ நிலையான நேரம்", "AWDT": "ஆஸ்திரேலியன் மேற்கத்திய பகலொளி நேரம்", "MDT": "மவுன்டைன் பகலொளி நேரம்", "NZDT": "நியூசிலாந்து பகலொளி நேரம்", "HAST": "ஹவாய்-அலேஷியன் நிலையான நேரம்", "ART": "அர்ஜென்டினா நிலையான நேரம்", "HNPM": "செயின்ட் பியரி & மிக்குயிலான் நிலையான நேரம்"},
  71. }
  72. }
  73. // Locale returns the current translators string locale
  74. func (ta *ta_MY) Locale() string {
  75. return ta.locale
  76. }
  77. // PluralsCardinal returns the list of cardinal plural rules associated with 'ta_MY'
  78. func (ta *ta_MY) PluralsCardinal() []locales.PluralRule {
  79. return ta.pluralsCardinal
  80. }
  81. // PluralsOrdinal returns the list of ordinal plural rules associated with 'ta_MY'
  82. func (ta *ta_MY) PluralsOrdinal() []locales.PluralRule {
  83. return ta.pluralsOrdinal
  84. }
  85. // PluralsRange returns the list of range plural rules associated with 'ta_MY'
  86. func (ta *ta_MY) PluralsRange() []locales.PluralRule {
  87. return ta.pluralsRange
  88. }
  89. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ta_MY'
  90. func (ta *ta_MY) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  91. n := math.Abs(num)
  92. if n == 1 {
  93. return locales.PluralRuleOne
  94. }
  95. return locales.PluralRuleOther
  96. }
  97. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ta_MY'
  98. func (ta *ta_MY) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  99. return locales.PluralRuleOther
  100. }
  101. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ta_MY'
  102. func (ta *ta_MY) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  103. start := ta.CardinalPluralRule(num1, v1)
  104. end := ta.CardinalPluralRule(num2, v2)
  105. if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  106. return locales.PluralRuleOther
  107. } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
  108. return locales.PluralRuleOne
  109. }
  110. return locales.PluralRuleOther
  111. }
  112. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  113. func (ta *ta_MY) MonthAbbreviated(month time.Month) string {
  114. return ta.monthsAbbreviated[month]
  115. }
  116. // MonthsAbbreviated returns the locales abbreviated months
  117. func (ta *ta_MY) MonthsAbbreviated() []string {
  118. return ta.monthsAbbreviated[1:]
  119. }
  120. // MonthNarrow returns the locales narrow month given the 'month' provided
  121. func (ta *ta_MY) MonthNarrow(month time.Month) string {
  122. return ta.monthsNarrow[month]
  123. }
  124. // MonthsNarrow returns the locales narrow months
  125. func (ta *ta_MY) MonthsNarrow() []string {
  126. return ta.monthsNarrow[1:]
  127. }
  128. // MonthWide returns the locales wide month given the 'month' provided
  129. func (ta *ta_MY) MonthWide(month time.Month) string {
  130. return ta.monthsWide[month]
  131. }
  132. // MonthsWide returns the locales wide months
  133. func (ta *ta_MY) MonthsWide() []string {
  134. return ta.monthsWide[1:]
  135. }
  136. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  137. func (ta *ta_MY) WeekdayAbbreviated(weekday time.Weekday) string {
  138. return ta.daysAbbreviated[weekday]
  139. }
  140. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  141. func (ta *ta_MY) WeekdaysAbbreviated() []string {
  142. return ta.daysAbbreviated
  143. }
  144. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  145. func (ta *ta_MY) WeekdayNarrow(weekday time.Weekday) string {
  146. return ta.daysNarrow[weekday]
  147. }
  148. // WeekdaysNarrow returns the locales narrow weekdays
  149. func (ta *ta_MY) WeekdaysNarrow() []string {
  150. return ta.daysNarrow
  151. }
  152. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  153. func (ta *ta_MY) WeekdayShort(weekday time.Weekday) string {
  154. return ta.daysShort[weekday]
  155. }
  156. // WeekdaysShort returns the locales short weekdays
  157. func (ta *ta_MY) WeekdaysShort() []string {
  158. return ta.daysShort
  159. }
  160. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  161. func (ta *ta_MY) WeekdayWide(weekday time.Weekday) string {
  162. return ta.daysWide[weekday]
  163. }
  164. // WeekdaysWide returns the locales wide weekdays
  165. func (ta *ta_MY) WeekdaysWide() []string {
  166. return ta.daysWide
  167. }
  168. // Decimal returns the decimal point of number
  169. func (ta *ta_MY) Decimal() string {
  170. return ta.decimal
  171. }
  172. // Group returns the group of number
  173. func (ta *ta_MY) Group() string {
  174. return ta.group
  175. }
  176. // Group returns the minus sign of number
  177. func (ta *ta_MY) Minus() string {
  178. return ta.minus
  179. }
  180. // FmtNumber returns 'num' with digits/precision of 'v' for 'ta_MY' and handles both Whole and Real numbers based on 'v'
  181. func (ta *ta_MY) FmtNumber(num float64, v uint64) string {
  182. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  183. l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  184. count := 0
  185. inWhole := v == 0
  186. b := make([]byte, 0, l)
  187. for i := len(s) - 1; i >= 0; i-- {
  188. if s[i] == '.' {
  189. b = append(b, ta.decimal[0])
  190. inWhole = true
  191. continue
  192. }
  193. if inWhole {
  194. if count == 3 {
  195. b = append(b, ta.group[0])
  196. count = 1
  197. } else {
  198. count++
  199. }
  200. }
  201. b = append(b, s[i])
  202. }
  203. if num < 0 {
  204. b = append(b, ta.minus[0])
  205. }
  206. // reverse
  207. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  208. b[i], b[j] = b[j], b[i]
  209. }
  210. return string(b)
  211. }
  212. // FmtPercent returns 'num' with digits/precision of 'v' for 'ta_MY' and handles both Whole and Real numbers based on 'v'
  213. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  214. func (ta *ta_MY) FmtPercent(num float64, v uint64) string {
  215. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  216. l := len(s) + 3
  217. b := make([]byte, 0, l)
  218. for i := len(s) - 1; i >= 0; i-- {
  219. if s[i] == '.' {
  220. b = append(b, ta.decimal[0])
  221. continue
  222. }
  223. b = append(b, s[i])
  224. }
  225. if num < 0 {
  226. b = append(b, ta.minus[0])
  227. }
  228. // reverse
  229. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  230. b[i], b[j] = b[j], b[i]
  231. }
  232. b = append(b, ta.percent...)
  233. return string(b)
  234. }
  235. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ta_MY'
  236. func (ta *ta_MY) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  237. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  238. symbol := ta.currencies[currency]
  239. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  240. count := 0
  241. inWhole := v == 0
  242. b := make([]byte, 0, l)
  243. for i := len(s) - 1; i >= 0; i-- {
  244. if s[i] == '.' {
  245. b = append(b, ta.decimal[0])
  246. inWhole = true
  247. continue
  248. }
  249. if inWhole {
  250. if count == 3 {
  251. b = append(b, ta.group[0])
  252. count = 1
  253. } else {
  254. count++
  255. }
  256. }
  257. b = append(b, s[i])
  258. }
  259. for j := len(symbol) - 1; j >= 0; j-- {
  260. b = append(b, symbol[j])
  261. }
  262. for j := len(ta.currencyPositivePrefix) - 1; j >= 0; j-- {
  263. b = append(b, ta.currencyPositivePrefix[j])
  264. }
  265. if num < 0 {
  266. b = append(b, ta.minus[0])
  267. }
  268. // reverse
  269. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  270. b[i], b[j] = b[j], b[i]
  271. }
  272. if int(v) < 2 {
  273. if v == 0 {
  274. b = append(b, ta.decimal...)
  275. }
  276. for i := 0; i < 2-int(v); i++ {
  277. b = append(b, '0')
  278. }
  279. }
  280. return string(b)
  281. }
  282. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ta_MY'
  283. // in accounting notation.
  284. func (ta *ta_MY) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  285. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  286. symbol := ta.currencies[currency]
  287. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  288. count := 0
  289. inWhole := v == 0
  290. b := make([]byte, 0, l)
  291. for i := len(s) - 1; i >= 0; i-- {
  292. if s[i] == '.' {
  293. b = append(b, ta.decimal[0])
  294. inWhole = true
  295. continue
  296. }
  297. if inWhole {
  298. if count == 3 {
  299. b = append(b, ta.group[0])
  300. count = 1
  301. } else {
  302. count++
  303. }
  304. }
  305. b = append(b, s[i])
  306. }
  307. if num < 0 {
  308. for j := len(symbol) - 1; j >= 0; j-- {
  309. b = append(b, symbol[j])
  310. }
  311. for j := len(ta.currencyNegativePrefix) - 1; j >= 0; j-- {
  312. b = append(b, ta.currencyNegativePrefix[j])
  313. }
  314. b = append(b, ta.minus[0])
  315. } else {
  316. for j := len(symbol) - 1; j >= 0; j-- {
  317. b = append(b, symbol[j])
  318. }
  319. for j := len(ta.currencyPositivePrefix) - 1; j >= 0; j-- {
  320. b = append(b, ta.currencyPositivePrefix[j])
  321. }
  322. }
  323. // reverse
  324. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  325. b[i], b[j] = b[j], b[i]
  326. }
  327. if int(v) < 2 {
  328. if v == 0 {
  329. b = append(b, ta.decimal...)
  330. }
  331. for i := 0; i < 2-int(v); i++ {
  332. b = append(b, '0')
  333. }
  334. }
  335. return string(b)
  336. }
  337. // FmtDateShort returns the short date representation of 't' for 'ta_MY'
  338. func (ta *ta_MY) FmtDateShort(t time.Time) string {
  339. b := make([]byte, 0, 32)
  340. b = strconv.AppendInt(b, int64(t.Day()), 10)
  341. b = append(b, []byte{0x2f}...)
  342. b = strconv.AppendInt(b, int64(t.Month()), 10)
  343. b = append(b, []byte{0x2f}...)
  344. if t.Year() > 9 {
  345. b = append(b, strconv.Itoa(t.Year())[2:]...)
  346. } else {
  347. b = append(b, strconv.Itoa(t.Year())[1:]...)
  348. }
  349. return string(b)
  350. }
  351. // FmtDateMedium returns the medium date representation of 't' for 'ta_MY'
  352. func (ta *ta_MY) FmtDateMedium(t time.Time) string {
  353. b := make([]byte, 0, 32)
  354. b = strconv.AppendInt(b, int64(t.Day()), 10)
  355. b = append(b, []byte{0x20}...)
  356. b = append(b, ta.monthsAbbreviated[t.Month()]...)
  357. b = append(b, []byte{0x2c, 0x20}...)
  358. if t.Year() > 0 {
  359. b = strconv.AppendInt(b, int64(t.Year()), 10)
  360. } else {
  361. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  362. }
  363. return string(b)
  364. }
  365. // FmtDateLong returns the long date representation of 't' for 'ta_MY'
  366. func (ta *ta_MY) FmtDateLong(t time.Time) string {
  367. b := make([]byte, 0, 32)
  368. b = strconv.AppendInt(b, int64(t.Day()), 10)
  369. b = append(b, []byte{0x20}...)
  370. b = append(b, ta.monthsWide[t.Month()]...)
  371. b = append(b, []byte{0x2c, 0x20}...)
  372. if t.Year() > 0 {
  373. b = strconv.AppendInt(b, int64(t.Year()), 10)
  374. } else {
  375. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  376. }
  377. return string(b)
  378. }
  379. // FmtDateFull returns the full date representation of 't' for 'ta_MY'
  380. func (ta *ta_MY) FmtDateFull(t time.Time) string {
  381. b := make([]byte, 0, 32)
  382. b = append(b, ta.daysWide[t.Weekday()]...)
  383. b = append(b, []byte{0x2c, 0x20}...)
  384. b = strconv.AppendInt(b, int64(t.Day()), 10)
  385. b = append(b, []byte{0x20}...)
  386. b = append(b, ta.monthsWide[t.Month()]...)
  387. b = append(b, []byte{0x2c, 0x20}...)
  388. if t.Year() > 0 {
  389. b = strconv.AppendInt(b, int64(t.Year()), 10)
  390. } else {
  391. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  392. }
  393. return string(b)
  394. }
  395. // FmtTimeShort returns the short time representation of 't' for 'ta_MY'
  396. func (ta *ta_MY) FmtTimeShort(t time.Time) string {
  397. b := make([]byte, 0, 32)
  398. if t.Hour() < 12 {
  399. b = append(b, ta.periodsAbbreviated[0]...)
  400. } else {
  401. b = append(b, ta.periodsAbbreviated[1]...)
  402. }
  403. b = append(b, []byte{0x20}...)
  404. h := t.Hour()
  405. if h > 12 {
  406. h -= 12
  407. }
  408. b = strconv.AppendInt(b, int64(h), 10)
  409. b = append(b, ta.timeSeparator...)
  410. if t.Minute() < 10 {
  411. b = append(b, '0')
  412. }
  413. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  414. return string(b)
  415. }
  416. // FmtTimeMedium returns the medium time representation of 't' for 'ta_MY'
  417. func (ta *ta_MY) FmtTimeMedium(t time.Time) string {
  418. b := make([]byte, 0, 32)
  419. if t.Hour() < 12 {
  420. b = append(b, ta.periodsAbbreviated[0]...)
  421. } else {
  422. b = append(b, ta.periodsAbbreviated[1]...)
  423. }
  424. b = append(b, []byte{0x20}...)
  425. h := t.Hour()
  426. if h > 12 {
  427. h -= 12
  428. }
  429. b = strconv.AppendInt(b, int64(h), 10)
  430. b = append(b, ta.timeSeparator...)
  431. if t.Minute() < 10 {
  432. b = append(b, '0')
  433. }
  434. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  435. b = append(b, ta.timeSeparator...)
  436. if t.Second() < 10 {
  437. b = append(b, '0')
  438. }
  439. b = strconv.AppendInt(b, int64(t.Second()), 10)
  440. return string(b)
  441. }
  442. // FmtTimeLong returns the long time representation of 't' for 'ta_MY'
  443. func (ta *ta_MY) FmtTimeLong(t time.Time) string {
  444. b := make([]byte, 0, 32)
  445. if t.Hour() < 12 {
  446. b = append(b, ta.periodsAbbreviated[0]...)
  447. } else {
  448. b = append(b, ta.periodsAbbreviated[1]...)
  449. }
  450. b = append(b, []byte{0x20}...)
  451. h := t.Hour()
  452. if h > 12 {
  453. h -= 12
  454. }
  455. b = strconv.AppendInt(b, int64(h), 10)
  456. b = append(b, ta.timeSeparator...)
  457. if t.Minute() < 10 {
  458. b = append(b, '0')
  459. }
  460. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  461. b = append(b, ta.timeSeparator...)
  462. if t.Second() < 10 {
  463. b = append(b, '0')
  464. }
  465. b = strconv.AppendInt(b, int64(t.Second()), 10)
  466. b = append(b, []byte{0x20}...)
  467. tz, _ := t.Zone()
  468. b = append(b, tz...)
  469. return string(b)
  470. }
  471. // FmtTimeFull returns the full time representation of 't' for 'ta_MY'
  472. func (ta *ta_MY) FmtTimeFull(t time.Time) string {
  473. b := make([]byte, 0, 32)
  474. if t.Hour() < 12 {
  475. b = append(b, ta.periodsAbbreviated[0]...)
  476. } else {
  477. b = append(b, ta.periodsAbbreviated[1]...)
  478. }
  479. b = append(b, []byte{0x20}...)
  480. h := t.Hour()
  481. if h > 12 {
  482. h -= 12
  483. }
  484. b = strconv.AppendInt(b, int64(h), 10)
  485. b = append(b, ta.timeSeparator...)
  486. if t.Minute() < 10 {
  487. b = append(b, '0')
  488. }
  489. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  490. b = append(b, ta.timeSeparator...)
  491. if t.Second() < 10 {
  492. b = append(b, '0')
  493. }
  494. b = strconv.AppendInt(b, int64(t.Second()), 10)
  495. b = append(b, []byte{0x20}...)
  496. tz, _ := t.Zone()
  497. if btz, ok := ta.timezones[tz]; ok {
  498. b = append(b, btz...)
  499. } else {
  500. b = append(b, tz...)
  501. }
  502. return string(b)
  503. }