ff_MR.go 17 KB

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