mn_MN.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. package mn_MN
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type mn_MN 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 'mn_MN' locale
  41. func New() locales.Translator {
  42. return &mn_MN{
  43. locale: "mn_MN",
  44. pluralsCardinal: []locales.PluralRule{2, 6},
  45. pluralsOrdinal: []locales.PluralRule{6},
  46. pluralsRange: []locales.PluralRule{6, 2},
  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 ", "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 "},
  55. currencyPositivePrefix: " ",
  56. currencyNegativePrefix: " ",
  57. monthsAbbreviated: []string{"", "1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар"},
  58. monthsNarrow: []string{"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
  59. monthsWide: []string{"", "Нэгдүгээр сар", "Хоёрдугаар сар", "Гуравдугаар сар", "Дөрөвдүгээр сар", "Тавдугаар сар", "Зургадугаар сар", "Долдугаар сар", "Наймдугаар сар", "Есдүгээр сар", "Аравдугаар сар", "Арван нэгдүгээр сар", "Арван хоёрдугаар сар"},
  60. daysAbbreviated: []string{"Ня", "Да", "Мя", "Лх", "Пү", "Ба", "Бя"},
  61. daysNarrow: []string{"1", "2", "3", "4", "5", "6", "7"},
  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{"GYT": "Гуяанагийн цаг", "CDT": "Төв зуны цаг", "WIT": "Зүүн Индонезийн цаг", "NZDT": "Шинэ Зеландын зуны цаг", "WAT": "Баруун Африкийн стандарт цаг", "WARST": "Баруун Аргентины зуны цаг", "HNT": "Нью-Фаундлендын стандарт цаг", "VET": "Венесуэлийн цаг", "WART": "Баруун Аргентины стандарт цаг", "LHST": "Лорд Хаугийн стандарт цаг", "CST": "Төв стандарт цаг", "COT": "Колумбын стандарт цаг", "ECT": "Эквадорын цаг", "MST": "MST", "MYT": "Малайзийн цаг", "MEZ": "Төв Европын стандарт цаг", "CHAST": "Чэтамын стандарт цаг", "WIB": "Баруун Индонезийн цаг", "OESZ": "Зүүн Европын зуны цаг", "MDT": "MDT", "UYST": "Уругвайн зуны цаг", "AKST": "Аляскийн стандарт цаг", "ACWST": "Австралийн төв баруун эргийн стандарт цаг", "TMT": "Туркменистаны стандарт цаг", "PST": "Номхон далайн стандарт цаг", "AWST": "Австралийн баруун эргийн стандарт цаг", "WESZ": "Баруун Европын зуны цаг", "ChST": "Чаморрогийн цаг", "WAST": "Баруун Африкийн зуны цаг", "HKST": "Хонг Конгын зуны цаг", "ACDT": "Төв Австралийн зуны цаг", "SRT": "Суринамын цаг", "ACWDT": "Австралийн төв баруун эргийн зуны цаг", "BT": "Бутаны цаг", "GMT": "Гринвичийн үндсэн цаг", "ART": "Аргентины стандарт цаг", "TMST": "Туркменистаны зуны цаг", "MESZ": "Төв Европын зуны цаг", "CLT": "Чилийн стандарт цаг", "EST": "Зүүн эргийн стандарт цаг", "WITA": "Төв Индонезийн цаг", "ACST": "Төв Австралийн стандарт цаг", "AKDT": "Аляскийн зуны цаг", "JST": "Японы стандарт цаг", "OEZ": "Зүүн Европын стандарт цаг", "EAT": "Зүүн Африкийн цаг", "AWDT": "Австралийн баруун эргийн зуны цаг", "AEST": "Австралийн зүүн эргийн стандарт цаг", "CLST": "Чилийн зуны цаг", "HKT": "Хонг Конгын стандарт цаг", "HAT": "Нью-Фаундлендын зуны цаг", "ARST": "Аргентины зуны цаг", "UYT": "Уругвайн стандарт цаг", "WEZ": "Баруун Европын стандарт цаг", "AST": "Атлантын стандарт цаг", "IST": "Энэтхэгийн цаг", "PDT": "Номхон далайн зуны цаг", "LHDT": "Лорд Хаугийн зуны цаг", "NZST": "Шинэ Зеландын стандарт цаг", "AEDT": "Австралийн зүүн эргийн зуны цаг", "CHADT": "Чэтамын зуны цаг", "COST": "Колумбын зуны цаг", "SGT": "Сингапурын цаг", "SAST": "Өмнөд Африкийн стандарт цаг", "GFT": "Францын Гияанагийн цаг", "∅∅∅": "Амазоны зуны цаг", "JDT": "Японы зуны цаг", "CAT": "Төв Африкийн цаг", "EDT": "Зүүн эргийн зуны цаг", "ADT": "Атлантын зуны цаг", "BOT": "Боливийн цаг", "HAST": "Хавай-Алеутын стандарт цаг", "HADT": "Хавай-Алеутын зуны цаг"},
  71. }
  72. }
  73. // Locale returns the current translators string locale
  74. func (mn *mn_MN) Locale() string {
  75. return mn.locale
  76. }
  77. // PluralsCardinal returns the list of cardinal plural rules associated with 'mn_MN'
  78. func (mn *mn_MN) PluralsCardinal() []locales.PluralRule {
  79. return mn.pluralsCardinal
  80. }
  81. // PluralsOrdinal returns the list of ordinal plural rules associated with 'mn_MN'
  82. func (mn *mn_MN) PluralsOrdinal() []locales.PluralRule {
  83. return mn.pluralsOrdinal
  84. }
  85. // PluralsRange returns the list of range plural rules associated with 'mn_MN'
  86. func (mn *mn_MN) PluralsRange() []locales.PluralRule {
  87. return mn.pluralsRange
  88. }
  89. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'mn_MN'
  90. func (mn *mn_MN) 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 'mn_MN'
  98. func (mn *mn_MN) 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 'mn_MN'
  102. func (mn *mn_MN) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  103. start := mn.CardinalPluralRule(num1, v1)
  104. end := mn.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 (mn *mn_MN) MonthAbbreviated(month time.Month) string {
  114. return mn.monthsAbbreviated[month]
  115. }
  116. // MonthsAbbreviated returns the locales abbreviated months
  117. func (mn *mn_MN) MonthsAbbreviated() []string {
  118. return mn.monthsAbbreviated[1:]
  119. }
  120. // MonthNarrow returns the locales narrow month given the 'month' provided
  121. func (mn *mn_MN) MonthNarrow(month time.Month) string {
  122. return mn.monthsNarrow[month]
  123. }
  124. // MonthsNarrow returns the locales narrow months
  125. func (mn *mn_MN) MonthsNarrow() []string {
  126. return mn.monthsNarrow[1:]
  127. }
  128. // MonthWide returns the locales wide month given the 'month' provided
  129. func (mn *mn_MN) MonthWide(month time.Month) string {
  130. return mn.monthsWide[month]
  131. }
  132. // MonthsWide returns the locales wide months
  133. func (mn *mn_MN) MonthsWide() []string {
  134. return mn.monthsWide[1:]
  135. }
  136. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  137. func (mn *mn_MN) WeekdayAbbreviated(weekday time.Weekday) string {
  138. return mn.daysAbbreviated[weekday]
  139. }
  140. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  141. func (mn *mn_MN) WeekdaysAbbreviated() []string {
  142. return mn.daysAbbreviated
  143. }
  144. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  145. func (mn *mn_MN) WeekdayNarrow(weekday time.Weekday) string {
  146. return mn.daysNarrow[weekday]
  147. }
  148. // WeekdaysNarrow returns the locales narrow weekdays
  149. func (mn *mn_MN) WeekdaysNarrow() []string {
  150. return mn.daysNarrow
  151. }
  152. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  153. func (mn *mn_MN) WeekdayShort(weekday time.Weekday) string {
  154. return mn.daysShort[weekday]
  155. }
  156. // WeekdaysShort returns the locales short weekdays
  157. func (mn *mn_MN) WeekdaysShort() []string {
  158. return mn.daysShort
  159. }
  160. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  161. func (mn *mn_MN) WeekdayWide(weekday time.Weekday) string {
  162. return mn.daysWide[weekday]
  163. }
  164. // WeekdaysWide returns the locales wide weekdays
  165. func (mn *mn_MN) WeekdaysWide() []string {
  166. return mn.daysWide
  167. }
  168. // FmtNumber returns 'num' with digits/precision of 'v' for 'mn_MN' and handles both Whole and Real numbers based on 'v'
  169. func (mn *mn_MN) FmtNumber(num float64, v uint64) string {
  170. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  171. l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  172. count := 0
  173. inWhole := v == 0
  174. b := make([]byte, 0, l)
  175. for i := len(s) - 1; i >= 0; i-- {
  176. if s[i] == '.' {
  177. b = append(b, mn.decimal[0])
  178. inWhole = true
  179. continue
  180. }
  181. if inWhole {
  182. if count == 3 {
  183. b = append(b, mn.group[0])
  184. count = 1
  185. } else {
  186. count++
  187. }
  188. }
  189. b = append(b, s[i])
  190. }
  191. if num < 0 {
  192. b = append(b, mn.minus[0])
  193. }
  194. // reverse
  195. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  196. b[i], b[j] = b[j], b[i]
  197. }
  198. return string(b)
  199. }
  200. // FmtPercent returns 'num' with digits/precision of 'v' for 'mn_MN' and handles both Whole and Real numbers based on 'v'
  201. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  202. func (mn *mn_MN) FmtPercent(num float64, v uint64) string {
  203. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  204. l := len(s) + 3
  205. b := make([]byte, 0, l)
  206. for i := len(s) - 1; i >= 0; i-- {
  207. if s[i] == '.' {
  208. b = append(b, mn.decimal[0])
  209. continue
  210. }
  211. b = append(b, s[i])
  212. }
  213. if num < 0 {
  214. b = append(b, mn.minus[0])
  215. }
  216. // reverse
  217. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  218. b[i], b[j] = b[j], b[i]
  219. }
  220. b = append(b, mn.percent...)
  221. return string(b)
  222. }
  223. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'mn_MN'
  224. func (mn *mn_MN) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  225. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  226. symbol := mn.currencies[currency]
  227. l := len(s) + len(symbol) + 4 + 1*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, mn.decimal[0])
  234. inWhole = true
  235. continue
  236. }
  237. if inWhole {
  238. if count == 3 {
  239. b = append(b, mn.group[0])
  240. count = 1
  241. } else {
  242. count++
  243. }
  244. }
  245. b = append(b, s[i])
  246. }
  247. for j := len(symbol) - 1; j >= 0; j-- {
  248. b = append(b, symbol[j])
  249. }
  250. for j := len(mn.currencyPositivePrefix) - 1; j >= 0; j-- {
  251. b = append(b, mn.currencyPositivePrefix[j])
  252. }
  253. if num < 0 {
  254. b = append(b, mn.minus[0])
  255. }
  256. // reverse
  257. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  258. b[i], b[j] = b[j], b[i]
  259. }
  260. if int(v) < 2 {
  261. if v == 0 {
  262. b = append(b, mn.decimal...)
  263. }
  264. for i := 0; i < 2-int(v); i++ {
  265. b = append(b, '0')
  266. }
  267. }
  268. return string(b)
  269. }
  270. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mn_MN'
  271. // in accounting notation.
  272. func (mn *mn_MN) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  273. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  274. symbol := mn.currencies[currency]
  275. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  276. count := 0
  277. inWhole := v == 0
  278. b := make([]byte, 0, l)
  279. for i := len(s) - 1; i >= 0; i-- {
  280. if s[i] == '.' {
  281. b = append(b, mn.decimal[0])
  282. inWhole = true
  283. continue
  284. }
  285. if inWhole {
  286. if count == 3 {
  287. b = append(b, mn.group[0])
  288. count = 1
  289. } else {
  290. count++
  291. }
  292. }
  293. b = append(b, s[i])
  294. }
  295. if num < 0 {
  296. for j := len(symbol) - 1; j >= 0; j-- {
  297. b = append(b, symbol[j])
  298. }
  299. for j := len(mn.currencyNegativePrefix) - 1; j >= 0; j-- {
  300. b = append(b, mn.currencyNegativePrefix[j])
  301. }
  302. b = append(b, mn.minus[0])
  303. } else {
  304. for j := len(symbol) - 1; j >= 0; j-- {
  305. b = append(b, symbol[j])
  306. }
  307. for j := len(mn.currencyPositivePrefix) - 1; j >= 0; j-- {
  308. b = append(b, mn.currencyPositivePrefix[j])
  309. }
  310. }
  311. // reverse
  312. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  313. b[i], b[j] = b[j], b[i]
  314. }
  315. if int(v) < 2 {
  316. if v == 0 {
  317. b = append(b, mn.decimal...)
  318. }
  319. for i := 0; i < 2-int(v); i++ {
  320. b = append(b, '0')
  321. }
  322. }
  323. return string(b)
  324. }
  325. // FmtDateShort returns the short date representation of 't' for 'mn_MN'
  326. func (mn *mn_MN) FmtDateShort(t time.Time) string {
  327. b := make([]byte, 0, 32)
  328. b = strconv.AppendInt(b, int64(t.Year()), 10)
  329. b = append(b, []byte{0x2d}...)
  330. if t.Month() < 10 {
  331. b = append(b, '0')
  332. }
  333. b = strconv.AppendInt(b, int64(t.Month()), 10)
  334. b = append(b, []byte{0x2d}...)
  335. if t.Day() < 10 {
  336. b = append(b, '0')
  337. }
  338. b = strconv.AppendInt(b, int64(t.Day()), 10)
  339. return string(b)
  340. }
  341. // FmtDateMedium returns the medium date representation of 't' for 'mn_MN'
  342. func (mn *mn_MN) FmtDateMedium(t time.Time) string {
  343. b := make([]byte, 0, 32)
  344. b = strconv.AppendInt(b, int64(t.Year()), 10)
  345. b = append(b, []byte{0x20}...)
  346. b = append(b, mn.monthsAbbreviated[t.Month()]...)
  347. b = append(b, []byte{0x20}...)
  348. b = strconv.AppendInt(b, int64(t.Day()), 10)
  349. return string(b)
  350. }
  351. // FmtDateLong returns the long date representation of 't' for 'mn_MN'
  352. func (mn *mn_MN) FmtDateLong(t time.Time) string {
  353. b := make([]byte, 0, 32)
  354. b = strconv.AppendInt(b, int64(t.Year()), 10)
  355. b = append(b, []byte{}...)
  356. b = append(b, []byte{0x27, 0xd0, 0xbe, 0xd0, 0xbd, 0xd1, 0x8b, 0x27, 0x20}...)
  357. if t.Month() < 10 {
  358. b = append(b, '0')
  359. }
  360. b = strconv.AppendInt(b, int64(t.Month()), 10)
  361. b = append(b, []byte{}...)
  362. b = append(b, []byte{0x27, 0xd1, 0x81, 0xd0, 0xb0, 0xd1, 0x80, 0xd1, 0x8b, 0xd0, 0xbd, 0x27, 0x20}...)
  363. b = strconv.AppendInt(b, int64(t.Day()), 10)
  364. return string(b)
  365. }
  366. // FmtDateFull returns the full date representation of 't' for 'mn_MN'
  367. func (mn *mn_MN) FmtDateFull(t time.Time) string {
  368. b := make([]byte, 0, 32)
  369. b = append(b, mn.daysWide[t.Weekday()]...)
  370. b = append(b, []byte{0x2c, 0x20}...)
  371. b = strconv.AppendInt(b, int64(t.Year()), 10)
  372. b = append(b, []byte{}...)
  373. b = append(b, []byte{0x27, 0xd0, 0xbe, 0xd0, 0xbd, 0xd1, 0x8b, 0x27, 0x20}...)
  374. if t.Month() < 10 {
  375. b = append(b, '0')
  376. }
  377. b = strconv.AppendInt(b, int64(t.Month()), 10)
  378. b = append(b, []byte{}...)
  379. b = append(b, []byte{0x27, 0xd1, 0x81, 0xd0, 0xb0, 0xd1, 0x80, 0xd1, 0x8b, 0xd0, 0xbd, 0x27, 0x20}...)
  380. b = strconv.AppendInt(b, int64(t.Day()), 10)
  381. return string(b)
  382. }
  383. // FmtTimeShort returns the short time representation of 't' for 'mn_MN'
  384. func (mn *mn_MN) FmtTimeShort(t time.Time) string {
  385. b := make([]byte, 0, 32)
  386. if t.Hour() < 10 {
  387. b = append(b, '0')
  388. }
  389. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  390. b = append(b, mn.timeSeparator...)
  391. if t.Minute() < 10 {
  392. b = append(b, '0')
  393. }
  394. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  395. return string(b)
  396. }
  397. // FmtTimeMedium returns the medium time representation of 't' for 'mn_MN'
  398. func (mn *mn_MN) FmtTimeMedium(t time.Time) string {
  399. b := make([]byte, 0, 32)
  400. if t.Hour() < 10 {
  401. b = append(b, '0')
  402. }
  403. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  404. b = append(b, mn.timeSeparator...)
  405. if t.Minute() < 10 {
  406. b = append(b, '0')
  407. }
  408. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  409. b = append(b, mn.timeSeparator...)
  410. if t.Second() < 10 {
  411. b = append(b, '0')
  412. }
  413. b = strconv.AppendInt(b, int64(t.Second()), 10)
  414. return string(b)
  415. }
  416. // FmtTimeLong returns the long time representation of 't' for 'mn_MN'
  417. func (mn *mn_MN) FmtTimeLong(t time.Time) string {
  418. b := make([]byte, 0, 32)
  419. if t.Hour() < 10 {
  420. b = append(b, '0')
  421. }
  422. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  423. b = append(b, mn.timeSeparator...)
  424. if t.Minute() < 10 {
  425. b = append(b, '0')
  426. }
  427. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  428. b = append(b, mn.timeSeparator...)
  429. if t.Second() < 10 {
  430. b = append(b, '0')
  431. }
  432. b = strconv.AppendInt(b, int64(t.Second()), 10)
  433. b = append(b, []byte{0x20}...)
  434. tz, _ := t.Zone()
  435. b = append(b, tz...)
  436. return string(b)
  437. }
  438. // FmtTimeFull returns the full time representation of 't' for 'mn_MN'
  439. func (mn *mn_MN) FmtTimeFull(t time.Time) string {
  440. b := make([]byte, 0, 32)
  441. if t.Hour() < 10 {
  442. b = append(b, '0')
  443. }
  444. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  445. b = append(b, mn.timeSeparator...)
  446. if t.Minute() < 10 {
  447. b = append(b, '0')
  448. }
  449. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  450. b = append(b, mn.timeSeparator...)
  451. if t.Second() < 10 {
  452. b = append(b, '0')
  453. }
  454. b = strconv.AppendInt(b, int64(t.Second()), 10)
  455. b = append(b, []byte{0x20}...)
  456. tz, _ := t.Zone()
  457. if btz, ok := mn.timezones[tz]; ok {
  458. b = append(b, btz...)
  459. } else {
  460. b = append(b, tz...)
  461. }
  462. return string(b)
  463. }