zgh_MA.go 18 KB

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