mn_MN.go 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  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{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", "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"},
  55. currencyPositivePrefix: " ",
  56. currencyNegativePrefix: " ",
  57. monthsAbbreviated: []string{"", "1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар"},
  58. monthsNarrow: []string{"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"},
  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{"CHADT": "Чатемын зуны цаг", "MEZ": "Төв Европын стандарт цаг", "LHDT": "Лорд Хоугийн зуны цаг", "HECU": "Кубын зуны цаг", "HEPM": "Сен-Пьер ба Микелоны зуны цаг", "TMT": "Туркменистаны стандарт цаг", "TMST": "Туркменистаны зуны цаг", "HAST": "Хавай-Алеутын стандарт цаг", "WART": "Баруун Аргентины стандарт цаг", "∅∅∅": "Амазоны зуны цаг", "SAST": "Өмнөд Африкийн стандарт цаг", "WEZ": "Баруун Европын стандарт цаг", "BT": "Бутаны цаг", "COST": "Колумбын зуны цаг", "UYT": "Уругвайн стандарт цаг", "ACWST": "Австралийн төв баруун эргийн стандарт цаг", "AEDT": "Австралийн зүүн эргийн зуны цаг", "WESZ": "Баруун Европын зуны цаг", "BOT": "Боливийн цаг", "HNNOMX": "Баруун хойд Мексикийн стандарт цаг", "CLT": "Чилийн стандарт цаг", "PDT": "Номхон далайн зуны цаг", "ACDT": "Төв Австралийн зуны цаг", "HNPM": "Сен-Пьер ба Микелоны стандарт цаг", "COT": "Колумбын стандарт цаг", "CHAST": "Чатемын стандарт цаг", "AWST": "Австралийн баруун эргийн стандарт цаг", "PST": "Номхон далайн стандарт цаг", "AEST": "Австралийн зүүн эргийн стандарт цаг", "JST": "Японы стандарт цаг", "AKDT": "Аляскийн зуны цаг", "MDT": "MDT", "OEZ": "Зүүн Европын стандарт цаг", "GYT": "Гайанагийн цаг", "ChST": "Чаморрогийн цаг", "ACST": "Төв Австралийн стандарт цаг", "HENOMX": "Баруун хойд Мексикийн зуны цаг", "ARST": "Аргентины зуны цаг", "NZDT": "Шинэ Зеландын зуны цаг", "EDT": "Зүүн эргийн зуны цаг", "WAST": "Баруун Африкийн зуны цаг", "SGT": "Сингапурын цаг", "HNEG": "Зүүн Гринландын стандарт цаг", "HNOG": "Баруун Гринландын стандарт цаг", "MST": "MST", "WIT": "Зүүн Индонезийн цаг", "ART": "Аргентины стандарт цаг", "AST": "Атлантын стандарт цаг", "MESZ": "Төв Европын зуны цаг", "CLST": "Чилийн зуны цаг", "WAT": "Баруун Африкийн стандарт цаг", "GFT": "Францын Гвианагийн цаг", "WARST": "Баруун Аргентины зуны цаг", "HNCU": "Кубын стандарт цаг", "CST": "Төв стандарт цаг", "NZST": "Шинэ Зеландын стандарт цаг", "AKST": "Аляскийн стандарт цаг", "HAT": "Нью-Фаундлендын зуны цаг", "VET": "Венесуэлийн цаг", "SRT": "Суринамын цаг", "EAT": "Зүүн Африкийн цаг", "HEOG": "Баруун Гринландын зуны цаг", "HKT": "Хонг Конгийн стандарт цаг", "IST": "Энэтхэгийн цаг", "CDT": "Төв зуны цаг", "HEPMX": "Мексик-Номхон далайн зуны цаг", "MYT": "Малайзын цаг", "JDT": "Японы зуны цаг", "HNT": "Нью-Фаундлендын стандарт цаг", "WITA": "Төв Индонезийн цаг", "HNPMX": "Мексик-Номхон далайн стандарт цаг", "WIB": "Баруун Индонезийн цаг", "ECT": "Эквадорын цаг", "EST": "Зүүн эргийн стандарт цаг", "HEEG": "Зүүн Гринландын зуны цаг", "HKST": "Хонг Конгийн зуны цаг", "HADT": "Хавай-Алеутын зуны цаг", "UYST": "Уругвайн зуны цаг", "AWDT": "Австралийн баруун эргийн зуны цаг", "ADT": "Атлантын зуны цаг", "LHST": "Лорд Хоугийн стандарт цаг", "CAT": "Төв Африкийн цаг", "OESZ": "Зүүн Европын зуны цаг", "GMT": "Гринвичийн цаг", "ACWDT": "Австралийн төв баруун эргийн зуны цаг"},
  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. // Decimal returns the decimal point of number
  169. func (mn *mn_MN) Decimal() string {
  170. return mn.decimal
  171. }
  172. // Group returns the group of number
  173. func (mn *mn_MN) Group() string {
  174. return mn.group
  175. }
  176. // Group returns the minus sign of number
  177. func (mn *mn_MN) Minus() string {
  178. return mn.minus
  179. }
  180. // FmtNumber returns 'num' with digits/precision of 'v' for 'mn_MN' and handles both Whole and Real numbers based on 'v'
  181. func (mn *mn_MN) 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, mn.decimal[0])
  190. inWhole = true
  191. continue
  192. }
  193. if inWhole {
  194. if count == 3 {
  195. b = append(b, mn.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, mn.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 'mn_MN' 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 (mn *mn_MN) 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, mn.decimal[0])
  221. continue
  222. }
  223. b = append(b, s[i])
  224. }
  225. if num < 0 {
  226. b = append(b, mn.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, mn.percent...)
  233. return string(b)
  234. }
  235. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'mn_MN'
  236. func (mn *mn_MN) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  237. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  238. symbol := mn.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, mn.decimal[0])
  246. inWhole = true
  247. continue
  248. }
  249. if inWhole {
  250. if count == 3 {
  251. b = append(b, mn.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(mn.currencyPositivePrefix) - 1; j >= 0; j-- {
  263. b = append(b, mn.currencyPositivePrefix[j])
  264. }
  265. if num < 0 {
  266. b = append(b, mn.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, mn.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 'mn_MN'
  283. // in accounting notation.
  284. func (mn *mn_MN) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  285. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  286. symbol := mn.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, mn.decimal[0])
  294. inWhole = true
  295. continue
  296. }
  297. if inWhole {
  298. if count == 3 {
  299. b = append(b, mn.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(mn.currencyNegativePrefix) - 1; j >= 0; j-- {
  312. b = append(b, mn.currencyNegativePrefix[j])
  313. }
  314. b = append(b, mn.minus[0])
  315. } else {
  316. for j := len(symbol) - 1; j >= 0; j-- {
  317. b = append(b, symbol[j])
  318. }
  319. for j := len(mn.currencyPositivePrefix) - 1; j >= 0; j-- {
  320. b = append(b, mn.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, mn.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 'mn_MN'
  338. func (mn *mn_MN) FmtDateShort(t time.Time) string {
  339. b := make([]byte, 0, 32)
  340. if t.Year() > 0 {
  341. b = strconv.AppendInt(b, int64(t.Year()), 10)
  342. } else {
  343. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  344. }
  345. b = append(b, []byte{0x2e}...)
  346. if t.Month() < 10 {
  347. b = append(b, '0')
  348. }
  349. b = strconv.AppendInt(b, int64(t.Month()), 10)
  350. b = append(b, []byte{0x2e}...)
  351. if t.Day() < 10 {
  352. b = append(b, '0')
  353. }
  354. b = strconv.AppendInt(b, int64(t.Day()), 10)
  355. return string(b)
  356. }
  357. // FmtDateMedium returns the medium date representation of 't' for 'mn_MN'
  358. func (mn *mn_MN) FmtDateMedium(t time.Time) string {
  359. b := make([]byte, 0, 32)
  360. if t.Year() > 0 {
  361. b = strconv.AppendInt(b, int64(t.Year()), 10)
  362. } else {
  363. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  364. }
  365. b = append(b, []byte{0x2e}...)
  366. if t.Month() < 10 {
  367. b = append(b, '0')
  368. }
  369. b = strconv.AppendInt(b, int64(t.Month()), 10)
  370. b = append(b, []byte{0x2e}...)
  371. if t.Day() < 10 {
  372. b = append(b, '0')
  373. }
  374. b = strconv.AppendInt(b, int64(t.Day()), 10)
  375. return string(b)
  376. }
  377. // FmtDateLong returns the long date representation of 't' for 'mn_MN'
  378. func (mn *mn_MN) FmtDateLong(t time.Time) string {
  379. b := make([]byte, 0, 32)
  380. if t.Year() > 0 {
  381. b = strconv.AppendInt(b, int64(t.Year()), 10)
  382. } else {
  383. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  384. }
  385. b = append(b, []byte{0x20, 0xd0, 0xbe, 0xd0, 0xbd, 0xd1, 0x8b}...)
  386. b = append(b, []byte{0x20}...)
  387. b = append(b, mn.monthsAbbreviated[t.Month()]...)
  388. b = append(b, []byte{0xd1, 0x8b, 0xd0, 0xbd}...)
  389. b = append(b, []byte{0x20}...)
  390. b = strconv.AppendInt(b, int64(t.Day()), 10)
  391. return string(b)
  392. }
  393. // FmtDateFull returns the full date representation of 't' for 'mn_MN'
  394. func (mn *mn_MN) FmtDateFull(t time.Time) string {
  395. b := make([]byte, 0, 32)
  396. if t.Year() > 0 {
  397. b = strconv.AppendInt(b, int64(t.Year()), 10)
  398. } else {
  399. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  400. }
  401. b = append(b, []byte{0x20, 0xd0, 0xbe, 0xd0, 0xbd, 0xd1, 0x8b}...)
  402. b = append(b, []byte{0x20}...)
  403. b = append(b, mn.monthsAbbreviated[t.Month()]...)
  404. b = append(b, []byte{0xd1, 0x8b, 0xd0, 0xbd}...)
  405. b = append(b, []byte{0x20}...)
  406. b = strconv.AppendInt(b, int64(t.Day()), 10)
  407. b = append(b, []byte{0x2e, 0x20}...)
  408. b = append(b, mn.daysWide[t.Weekday()]...)
  409. b = append(b, []byte{0x20, 0xd0, 0xb3, 0xd0, 0xb0, 0xd1, 0x80, 0xd0, 0xb0, 0xd0, 0xb3}...)
  410. b = append(b, []byte{0x2e}...)
  411. return string(b)
  412. }
  413. // FmtTimeShort returns the short time representation of 't' for 'mn_MN'
  414. func (mn *mn_MN) FmtTimeShort(t time.Time) string {
  415. b := make([]byte, 0, 32)
  416. if t.Hour() < 10 {
  417. b = append(b, '0')
  418. }
  419. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  420. b = append(b, mn.timeSeparator...)
  421. if t.Minute() < 10 {
  422. b = append(b, '0')
  423. }
  424. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  425. return string(b)
  426. }
  427. // FmtTimeMedium returns the medium time representation of 't' for 'mn_MN'
  428. func (mn *mn_MN) FmtTimeMedium(t time.Time) string {
  429. b := make([]byte, 0, 32)
  430. if t.Hour() < 10 {
  431. b = append(b, '0')
  432. }
  433. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  434. b = append(b, mn.timeSeparator...)
  435. if t.Minute() < 10 {
  436. b = append(b, '0')
  437. }
  438. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  439. b = append(b, mn.timeSeparator...)
  440. if t.Second() < 10 {
  441. b = append(b, '0')
  442. }
  443. b = strconv.AppendInt(b, int64(t.Second()), 10)
  444. return string(b)
  445. }
  446. // FmtTimeLong returns the long time representation of 't' for 'mn_MN'
  447. func (mn *mn_MN) FmtTimeLong(t time.Time) string {
  448. b := make([]byte, 0, 32)
  449. if t.Hour() < 10 {
  450. b = append(b, '0')
  451. }
  452. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  453. b = append(b, mn.timeSeparator...)
  454. if t.Minute() < 10 {
  455. b = append(b, '0')
  456. }
  457. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  458. b = append(b, mn.timeSeparator...)
  459. if t.Second() < 10 {
  460. b = append(b, '0')
  461. }
  462. b = strconv.AppendInt(b, int64(t.Second()), 10)
  463. b = append(b, []byte{0x20, 0x28}...)
  464. tz, _ := t.Zone()
  465. b = append(b, tz...)
  466. b = append(b, []byte{0x29}...)
  467. return string(b)
  468. }
  469. // FmtTimeFull returns the full time representation of 't' for 'mn_MN'
  470. func (mn *mn_MN) FmtTimeFull(t time.Time) string {
  471. b := make([]byte, 0, 32)
  472. if t.Hour() < 10 {
  473. b = append(b, '0')
  474. }
  475. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  476. b = append(b, mn.timeSeparator...)
  477. if t.Minute() < 10 {
  478. b = append(b, '0')
  479. }
  480. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  481. b = append(b, mn.timeSeparator...)
  482. if t.Second() < 10 {
  483. b = append(b, '0')
  484. }
  485. b = strconv.AppendInt(b, int64(t.Second()), 10)
  486. b = append(b, []byte{0x20, 0x28}...)
  487. tz, _ := t.Zone()
  488. if btz, ok := mn.timezones[tz]; ok {
  489. b = append(b, btz...)
  490. } else {
  491. b = append(b, tz...)
  492. }
  493. b = append(b, []byte{0x29}...)
  494. return string(b)
  495. }