az_Latn.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. package az_Latn
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type az_Latn 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 'az_Latn' locale
  41. func New() locales.Translator {
  42. return &az_Latn{
  43. locale: "az_Latn",
  44. pluralsCardinal: []locales.PluralRule{2, 6},
  45. pluralsOrdinal: []locales.PluralRule{2, 4, 5, 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{"", "yan", "fev", "mar", "apr", "may", "iyn", "iyl", "avq", "sen", "okt", "noy", "dek"},
  58. monthsNarrow: []string{"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
  59. monthsWide: []string{"", "yanvar", "fevral", "mart", "aprel", "may", "iyun", "iyul", "avqust", "sentyabr", "oktyabr", "noyabr", "dekabr"},
  60. daysAbbreviated: []string{"B.", "B.E.", "Ç.A.", "Ç.", "C.A.", "C.", "Ş."},
  61. daysNarrow: []string{"7", "1", "2", "3", "4", "5", "6"},
  62. daysShort: []string{"B.", "B.E.", "Ç.A.", "Ç.", "C.A.", "C.", "Ş."},
  63. daysWide: []string{"bazar", "bazar ertəsi", "çərşənbə axşamı", "çərşənbə", "cümə axşamı", "cümə", "şənbə"},
  64. periodsAbbreviated: []string{"AM", "PM"},
  65. periodsNarrow: []string{"a", "p"},
  66. periodsWide: []string{"AM", "PM"},
  67. erasAbbreviated: []string{"e.ə.", "y.e."},
  68. erasNarrow: []string{"", ""},
  69. erasWide: []string{"eramızdan əvvəl", "yeni era"},
  70. timezones: map[string]string{"WITA": "Mərkəzi İndoneziya Vaxtı", "TMST": "Türkmənistan Yay Vaxtı", "GFT": "Fransız Qvianası Vaxtı", "AKDT": "Alyaska Yay Vaxtı", "MDT": "MDT", "CLT": "Çili Standart Vaxtı", "OEZ": "Şərqi Avropa Standart Vaxtı", "BOT": "Boliviya Vaxtı", "ACDT": "Mərkəzi Avstraliya Yay Vaxtı", "AEST": "Şərqi Avstraliya Standart Vaxtı", "WAT": "Qərbi Afrika Standart Vaxtı", "HKT": "Honq Konq Standart Vaxtı", "PST": "Şimali Amerika Sakit Okean Standart Vaxtı", "GYT": "Qayana Vaxtı", "HEOG": "Qərbi Qrenlandiya Yay Vaxtı", "∅∅∅": "Azor Yay Vaxtı", "ChST": "Çamorro Vaxtı", "AWDT": "Qərbi Avstraliya Yay Vaxtı", "NZDT": "Yeni Zelandiya Yay Vaxtı", "ACWDT": "Mərkəzi Qərbi Avstraliya Yay Vaxtı", "CDT": "Şimali Mərkəzi Amerika Yay Vaxtı", "PDT": "Şimali Amerika Sakit Okean Yay Vaxtı", "AWST": "Qərbi Avstraliya Standart Vaxtı", "WIB": "Qərbi İndoneziya Vaxtı", "SRT": "Surinam Vaxtı", "HEEG": "Şərqi Qrenlandiya Yay Vaxtı", "HAT": "Nyufaundlend Yay Vaxtı", "WIT": "Şərqi İndoneziya Vaxtı", "CST": "Şimali Mərkəzi Amerika Standart Vaxtı", "HEPMX": "Meksika Sakit Okean Yay Vaxtı", "BT": "Butan Vaxtı", "JDT": "Yaponiya Yay Vaxtı", "ECT": "Ekvador Vaxtı", "MESZ": "Mərkəzi Avropa Yay Vaxtı", "LHDT": "Lord Hau Yay vaxtı", "HNNOMX": "Şimal-Qərbi Meksika Standart Vaxtı", "OESZ": "Şərqi Avropa Yay Vaxtı", "UYST": "Uruqvay Yay Vaxtı", "HNCU": "Kuba Standart Vaxtı", "HECU": "Kuba Yay Vaxtı", "HNEG": "Şərqi Qrenlandiya Standart Vaxtı", "HNPMX": "Meksika Sakit Okean Standart Vaxtı", "IST": "Hindistan Vaxtı", "HNT": "Nyufaundlend Standart Vaxtı", "HNPM": "Müqəddəs Pyer və Mikelon Standart Vaxtı", "HENOMX": "Şimal-Qərbi Meksika Yay Vaxtı", "COT": "Kolumbiya Standart Vaxtı", "COST": "Kolumbiya Yay Vaxtı", "NZST": "Yeni Zelandiya Standart Vaxtı", "ACWST": "Mərkəzi Qərbi Avstraliya Standart Vaxtı", "MYT": "Malayziya Vaxtı", "MST": "MST", "ART": "Argentina Standart Vaxtı", "ARST": "Argentina Yay Vaxtı", "AKST": "Alyaska Standart Vaxtı", "EAT": "Şərqi Afrika Vaxtı", "CLST": "Çili Yay Vaxtı", "HAST": "Havay-Aleut Standart Vaxtı", "SAST": "Cənubi Afrika Vaxtı", "HEPM": "Müqəddəs Pyer və Mikelon Yay Vaxtı", "WARST": "Qərbi Argentina Yay Vaxtı", "HADT": "Havay-Aleut Yay Vaxtı", "WESZ": "Qərbi Avropa Yay Vaxtı", "HKST": "Honq Konq Yay Vaxtı", "WART": "Qərbi Argentina Standart Vaxtı", "GMT": "Qrinviç Orta Vaxtı", "JST": "Yaponiya Standart Vaxtı", "EDT": "Şimali Şərqi Amerika Yay Vaxtı", "EST": "Şimali Şərqi Amerika Standart Vaxtı", "VET": "Venesuela Vaxtı", "CAT": "Mərkəzi Afrika Vaxtı", "UYT": "Uruqvay Standart Vaxtı", "CHAST": "Çatham Standart Vaxtı", "ADT": "Atlantik Yay Vaxtı", "WAST": "Qərbi Afrika Yay Vaxtı", "SGT": "Sinqapur Vaxtı", "WEZ": "Qərbi Avropa Standart Vaxtı", "LHST": "Lord Hau Standart Vaxtı", "HNOG": "Qərbi Qrenlandiya Standart Vaxtı", "MEZ": "Mərkəzi Avropa Standart Vaxtı", "TMT": "Türkmənistan Standart Vaxtı", "CHADT": "Çatham Yay Vaxtı", "AST": "Atlantik Standart Vaxt", "AEDT": "Şərqi Avstraliya Yay Vaxtı", "ACST": "Mərkəzi Avstraliya Standart Vaxtı"},
  71. }
  72. }
  73. // Locale returns the current translators string locale
  74. func (az *az_Latn) Locale() string {
  75. return az.locale
  76. }
  77. // PluralsCardinal returns the list of cardinal plural rules associated with 'az_Latn'
  78. func (az *az_Latn) PluralsCardinal() []locales.PluralRule {
  79. return az.pluralsCardinal
  80. }
  81. // PluralsOrdinal returns the list of ordinal plural rules associated with 'az_Latn'
  82. func (az *az_Latn) PluralsOrdinal() []locales.PluralRule {
  83. return az.pluralsOrdinal
  84. }
  85. // PluralsRange returns the list of range plural rules associated with 'az_Latn'
  86. func (az *az_Latn) PluralsRange() []locales.PluralRule {
  87. return az.pluralsRange
  88. }
  89. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'az_Latn'
  90. func (az *az_Latn) 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 'az_Latn'
  98. func (az *az_Latn) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  99. n := math.Abs(num)
  100. i := int64(n)
  101. iMod100 := i % 100
  102. iMod1000 := i % 1000
  103. iMod10 := i % 10
  104. if (iMod10 == 1 || iMod10 == 2 || iMod10 == 5 || iMod10 == 7 || iMod10 == 8) || (iMod100 == 20 || iMod100 == 50 || iMod100 == 70 || iMod100 == 80) {
  105. return locales.PluralRuleOne
  106. } else if (iMod10 == 3 || iMod10 == 4) || (iMod1000 == 100 || iMod1000 == 200 || iMod1000 == 300 || iMod1000 == 400 || iMod1000 == 500 || iMod1000 == 600 || iMod1000 == 700 || iMod1000 == 800 || iMod1000 == 900) {
  107. return locales.PluralRuleFew
  108. } else if (i == 0) || (iMod10 == 6) || (iMod100 == 40 || iMod100 == 60 || iMod100 == 90) {
  109. return locales.PluralRuleMany
  110. }
  111. return locales.PluralRuleOther
  112. }
  113. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'az_Latn'
  114. func (az *az_Latn) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  115. start := az.CardinalPluralRule(num1, v1)
  116. end := az.CardinalPluralRule(num2, v2)
  117. if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  118. return locales.PluralRuleOther
  119. } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
  120. return locales.PluralRuleOne
  121. }
  122. return locales.PluralRuleOther
  123. }
  124. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  125. func (az *az_Latn) MonthAbbreviated(month time.Month) string {
  126. return az.monthsAbbreviated[month]
  127. }
  128. // MonthsAbbreviated returns the locales abbreviated months
  129. func (az *az_Latn) MonthsAbbreviated() []string {
  130. return az.monthsAbbreviated[1:]
  131. }
  132. // MonthNarrow returns the locales narrow month given the 'month' provided
  133. func (az *az_Latn) MonthNarrow(month time.Month) string {
  134. return az.monthsNarrow[month]
  135. }
  136. // MonthsNarrow returns the locales narrow months
  137. func (az *az_Latn) MonthsNarrow() []string {
  138. return az.monthsNarrow[1:]
  139. }
  140. // MonthWide returns the locales wide month given the 'month' provided
  141. func (az *az_Latn) MonthWide(month time.Month) string {
  142. return az.monthsWide[month]
  143. }
  144. // MonthsWide returns the locales wide months
  145. func (az *az_Latn) MonthsWide() []string {
  146. return az.monthsWide[1:]
  147. }
  148. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  149. func (az *az_Latn) WeekdayAbbreviated(weekday time.Weekday) string {
  150. return az.daysAbbreviated[weekday]
  151. }
  152. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  153. func (az *az_Latn) WeekdaysAbbreviated() []string {
  154. return az.daysAbbreviated
  155. }
  156. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  157. func (az *az_Latn) WeekdayNarrow(weekday time.Weekday) string {
  158. return az.daysNarrow[weekday]
  159. }
  160. // WeekdaysNarrow returns the locales narrow weekdays
  161. func (az *az_Latn) WeekdaysNarrow() []string {
  162. return az.daysNarrow
  163. }
  164. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  165. func (az *az_Latn) WeekdayShort(weekday time.Weekday) string {
  166. return az.daysShort[weekday]
  167. }
  168. // WeekdaysShort returns the locales short weekdays
  169. func (az *az_Latn) WeekdaysShort() []string {
  170. return az.daysShort
  171. }
  172. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  173. func (az *az_Latn) WeekdayWide(weekday time.Weekday) string {
  174. return az.daysWide[weekday]
  175. }
  176. // WeekdaysWide returns the locales wide weekdays
  177. func (az *az_Latn) WeekdaysWide() []string {
  178. return az.daysWide
  179. }
  180. // Decimal returns the decimal point of number
  181. func (az *az_Latn) Decimal() string {
  182. return az.decimal
  183. }
  184. // Group returns the group of number
  185. func (az *az_Latn) Group() string {
  186. return az.group
  187. }
  188. // Group returns the minus sign of number
  189. func (az *az_Latn) Minus() string {
  190. return az.minus
  191. }
  192. // FmtNumber returns 'num' with digits/precision of 'v' for 'az_Latn' and handles both Whole and Real numbers based on 'v'
  193. func (az *az_Latn) FmtNumber(num float64, v uint64) string {
  194. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  195. l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  196. count := 0
  197. inWhole := v == 0
  198. b := make([]byte, 0, l)
  199. for i := len(s) - 1; i >= 0; i-- {
  200. if s[i] == '.' {
  201. b = append(b, az.decimal[0])
  202. inWhole = true
  203. continue
  204. }
  205. if inWhole {
  206. if count == 3 {
  207. b = append(b, az.group[0])
  208. count = 1
  209. } else {
  210. count++
  211. }
  212. }
  213. b = append(b, s[i])
  214. }
  215. if num < 0 {
  216. b = append(b, az.minus[0])
  217. }
  218. // reverse
  219. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  220. b[i], b[j] = b[j], b[i]
  221. }
  222. return string(b)
  223. }
  224. // FmtPercent returns 'num' with digits/precision of 'v' for 'az_Latn' and handles both Whole and Real numbers based on 'v'
  225. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  226. func (az *az_Latn) FmtPercent(num float64, v uint64) string {
  227. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  228. l := len(s) + 3
  229. b := make([]byte, 0, l)
  230. for i := len(s) - 1; i >= 0; i-- {
  231. if s[i] == '.' {
  232. b = append(b, az.decimal[0])
  233. continue
  234. }
  235. b = append(b, s[i])
  236. }
  237. if num < 0 {
  238. b = append(b, az.minus[0])
  239. }
  240. // reverse
  241. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  242. b[i], b[j] = b[j], b[i]
  243. }
  244. b = append(b, az.percent...)
  245. return string(b)
  246. }
  247. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'az_Latn'
  248. func (az *az_Latn) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  249. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  250. symbol := az.currencies[currency]
  251. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  252. count := 0
  253. inWhole := v == 0
  254. b := make([]byte, 0, l)
  255. for i := len(s) - 1; i >= 0; i-- {
  256. if s[i] == '.' {
  257. b = append(b, az.decimal[0])
  258. inWhole = true
  259. continue
  260. }
  261. if inWhole {
  262. if count == 3 {
  263. b = append(b, az.group[0])
  264. count = 1
  265. } else {
  266. count++
  267. }
  268. }
  269. b = append(b, s[i])
  270. }
  271. for j := len(symbol) - 1; j >= 0; j-- {
  272. b = append(b, symbol[j])
  273. }
  274. for j := len(az.currencyPositivePrefix) - 1; j >= 0; j-- {
  275. b = append(b, az.currencyPositivePrefix[j])
  276. }
  277. if num < 0 {
  278. b = append(b, az.minus[0])
  279. }
  280. // reverse
  281. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  282. b[i], b[j] = b[j], b[i]
  283. }
  284. if int(v) < 2 {
  285. if v == 0 {
  286. b = append(b, az.decimal...)
  287. }
  288. for i := 0; i < 2-int(v); i++ {
  289. b = append(b, '0')
  290. }
  291. }
  292. return string(b)
  293. }
  294. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'az_Latn'
  295. // in accounting notation.
  296. func (az *az_Latn) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  297. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  298. symbol := az.currencies[currency]
  299. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  300. count := 0
  301. inWhole := v == 0
  302. b := make([]byte, 0, l)
  303. for i := len(s) - 1; i >= 0; i-- {
  304. if s[i] == '.' {
  305. b = append(b, az.decimal[0])
  306. inWhole = true
  307. continue
  308. }
  309. if inWhole {
  310. if count == 3 {
  311. b = append(b, az.group[0])
  312. count = 1
  313. } else {
  314. count++
  315. }
  316. }
  317. b = append(b, s[i])
  318. }
  319. if num < 0 {
  320. for j := len(symbol) - 1; j >= 0; j-- {
  321. b = append(b, symbol[j])
  322. }
  323. for j := len(az.currencyNegativePrefix) - 1; j >= 0; j-- {
  324. b = append(b, az.currencyNegativePrefix[j])
  325. }
  326. b = append(b, az.minus[0])
  327. } else {
  328. for j := len(symbol) - 1; j >= 0; j-- {
  329. b = append(b, symbol[j])
  330. }
  331. for j := len(az.currencyPositivePrefix) - 1; j >= 0; j-- {
  332. b = append(b, az.currencyPositivePrefix[j])
  333. }
  334. }
  335. // reverse
  336. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  337. b[i], b[j] = b[j], b[i]
  338. }
  339. if int(v) < 2 {
  340. if v == 0 {
  341. b = append(b, az.decimal...)
  342. }
  343. for i := 0; i < 2-int(v); i++ {
  344. b = append(b, '0')
  345. }
  346. }
  347. return string(b)
  348. }
  349. // FmtDateShort returns the short date representation of 't' for 'az_Latn'
  350. func (az *az_Latn) FmtDateShort(t time.Time) string {
  351. b := make([]byte, 0, 32)
  352. if t.Day() < 10 {
  353. b = append(b, '0')
  354. }
  355. b = strconv.AppendInt(b, int64(t.Day()), 10)
  356. b = append(b, []byte{0x2e}...)
  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{0x2e}...)
  362. if t.Year() > 9 {
  363. b = append(b, strconv.Itoa(t.Year())[2:]...)
  364. } else {
  365. b = append(b, strconv.Itoa(t.Year())[1:]...)
  366. }
  367. return string(b)
  368. }
  369. // FmtDateMedium returns the medium date representation of 't' for 'az_Latn'
  370. func (az *az_Latn) FmtDateMedium(t time.Time) string {
  371. b := make([]byte, 0, 32)
  372. b = strconv.AppendInt(b, int64(t.Day()), 10)
  373. b = append(b, []byte{0x20}...)
  374. b = append(b, az.monthsAbbreviated[t.Month()]...)
  375. b = append(b, []byte{0x20}...)
  376. if t.Year() > 0 {
  377. b = strconv.AppendInt(b, int64(t.Year()), 10)
  378. } else {
  379. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  380. }
  381. return string(b)
  382. }
  383. // FmtDateLong returns the long date representation of 't' for 'az_Latn'
  384. func (az *az_Latn) FmtDateLong(t time.Time) string {
  385. b := make([]byte, 0, 32)
  386. b = strconv.AppendInt(b, int64(t.Day()), 10)
  387. b = append(b, []byte{0x20}...)
  388. b = append(b, az.monthsWide[t.Month()]...)
  389. b = append(b, []byte{0x20}...)
  390. if t.Year() > 0 {
  391. b = strconv.AppendInt(b, int64(t.Year()), 10)
  392. } else {
  393. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  394. }
  395. return string(b)
  396. }
  397. // FmtDateFull returns the full date representation of 't' for 'az_Latn'
  398. func (az *az_Latn) FmtDateFull(t time.Time) string {
  399. b := make([]byte, 0, 32)
  400. b = strconv.AppendInt(b, int64(t.Day()), 10)
  401. b = append(b, []byte{0x20}...)
  402. b = append(b, az.monthsWide[t.Month()]...)
  403. b = append(b, []byte{0x20}...)
  404. if t.Year() > 0 {
  405. b = strconv.AppendInt(b, int64(t.Year()), 10)
  406. } else {
  407. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  408. }
  409. b = append(b, []byte{0x2c, 0x20}...)
  410. b = append(b, az.daysWide[t.Weekday()]...)
  411. return string(b)
  412. }
  413. // FmtTimeShort returns the short time representation of 't' for 'az_Latn'
  414. func (az *az_Latn) 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, az.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 'az_Latn'
  428. func (az *az_Latn) 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, az.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, az.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 'az_Latn'
  447. func (az *az_Latn) 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, az.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, az.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}...)
  464. tz, _ := t.Zone()
  465. b = append(b, tz...)
  466. return string(b)
  467. }
  468. // FmtTimeFull returns the full time representation of 't' for 'az_Latn'
  469. func (az *az_Latn) FmtTimeFull(t time.Time) string {
  470. b := make([]byte, 0, 32)
  471. if t.Hour() < 10 {
  472. b = append(b, '0')
  473. }
  474. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  475. b = append(b, az.timeSeparator...)
  476. if t.Minute() < 10 {
  477. b = append(b, '0')
  478. }
  479. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  480. b = append(b, az.timeSeparator...)
  481. if t.Second() < 10 {
  482. b = append(b, '0')
  483. }
  484. b = strconv.AppendInt(b, int64(t.Second()), 10)
  485. b = append(b, []byte{0x20}...)
  486. tz, _ := t.Zone()
  487. if btz, ok := az.timezones[tz]; ok {
  488. b = append(b, btz...)
  489. } else {
  490. b = append(b, tz...)
  491. }
  492. return string(b)
  493. }