kab_DZ.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. package kab_DZ
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type kab_DZ 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. monthsAbbreviated []string
  23. monthsNarrow []string
  24. monthsWide []string
  25. daysAbbreviated []string
  26. daysNarrow []string
  27. daysShort []string
  28. daysWide []string
  29. periodsAbbreviated []string
  30. periodsNarrow []string
  31. periodsShort []string
  32. periodsWide []string
  33. erasAbbreviated []string
  34. erasNarrow []string
  35. erasWide []string
  36. timezones map[string]string
  37. }
  38. // New returns a new instance of translator for the 'kab_DZ' locale
  39. func New() locales.Translator {
  40. return &kab_DZ{
  41. locale: "kab_DZ",
  42. pluralsCardinal: []locales.PluralRule{2, 6},
  43. pluralsOrdinal: nil,
  44. pluralsRange: nil,
  45. decimal: ",",
  46. group: " ",
  47. minus: "-",
  48. percent: "%",
  49. perMille: "‰",
  50. timeSeparator: ":",
  51. inifinity: "∞",
  52. 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"},
  53. monthsAbbreviated: []string{"", "Yen", "Fur", "Meɣ", "Yeb", "May", "Yun", "Yul", "Ɣuc", "Cte", "Tub", "Nun", "Duǧ"},
  54. monthsNarrow: []string{"", "Y", "F", "Ɣ", "B", "M", "N", "L", "C", "T", "R", "W", "D"},
  55. monthsWide: []string{"", "Yennayer", "Fuṛar", "Meɣres", "Yebrir", "Mayyu", "Yunyu", "Yulyu", "Ɣuct", "Ctembeṛ", "Tubeṛ", "Nunembeṛ", "Duǧembeṛ"},
  56. daysAbbreviated: []string{"Yan", "San", "Kraḍ", "Kuẓ", "Sam", "Sḍis", "Say"},
  57. daysNarrow: []string{"C", "R", "A", "H", "M", "S", "D"},
  58. daysShort: []string{"Cr", "Ri", "Ra", "Hd", "Mh", "Sm", "Sd"},
  59. daysWide: []string{"Yanass", "Sanass", "Kraḍass", "Kuẓass", "Samass", "Sḍisass", "Sayass"},
  60. periodsAbbreviated: []string{"n tufat", "n tmeddit"},
  61. periodsNarrow: []string{"f", "m"},
  62. periodsWide: []string{"n tufat", "n tmeddit"},
  63. erasAbbreviated: []string{"snd. T.Ɛ", "sld. T.Ɛ"},
  64. erasNarrow: []string{"", ""},
  65. erasWide: []string{"send talalit n Ɛisa", "seld talalit n Ɛisa"},
  66. timezones: map[string]string{"LHST": "Akud Amagnu n Lord Howe", "HNPM": "Akud Amagnu n San Pyir & Miklun", "ARST": "Akud n Unebdu n Arjuntin", "GMT": "Akud alemmas n Greenwich", "CST": "Akud Amagnu n Tlemmast n Marikan", "ACST": "Akud Amagnu n Ustralya Talemmast", "ACDT": "Akud n Unebdu n Ustralya Talemmast", "HNEG": "Akud Amagnu n Grinland n Usammar", "VET": "Akud n Vinizwila", "HADT": "Akud n Unebu n Haway-Aliwsyan", "COST": "Akud n Unebdu n Kulumbya", "UYST": "Akud n Unebdu n Urugway", "BOT": "Akud n Bulivi", "HNOG": "Akud Amagnu n Grinland n Umalu", "WITA": "Akud n Tlemmast n Indunisya", "WESZ": "Akud n unebdu turuft n umalu", "WART": "Akud Amagnu n Arjuntin n Usammar", "WAT": "Akud amagnu n tefriqt n umalu", "MESZ": "Akud n unebdu n Turuft Talemmast", "LHDT": "Akud n Unebdu n Lord Howe", "OEZ": "Akud amagnu n Turuft n Usammar", "HAST": "Akud Amagnu n Haway-Aliwsyan", "PST": "Akud Amelwi Amagnu n Marikan n Ugafa", "HEPMX": "Akud Amelwi n Unebdu n Miksik", "PDT": "Akud Amelwi n Unebdu n Marikan n Ugafa", "HNPMX": "Akud amagnu Amelwi n Miksik", "WAST": "Akud n unebdu n tefriqt n umalu", "JDT": "Akud n Unebdu n Japun", "HEOG": "Akud n Unebdu n Grinland n Umalu", "CHADT": "Akud n Unebdu Catham", "HECU": "Akud n Unebdu n Kuba", "SAST": "Akud amagnu n tefriqt n unẓul", "ACWST": "Akud Amagnu n Tlemmast n Umalu n Ustṛalya", "IST": "Akud Amagnu n Hend", "HNNOMX": "Akud Amagnu n Ugafa Amalu n Miksik", "HENOMX": "Akud n Unebdu n Ugafa Amalu n Miksik", "OESZ": "Akud n unebdu n Turuft n Usammar", "CDT": "Akud n Unebdu n Tlemmast n Marikan", "AST": "Akud Amagnu Aṭlasan", "JST": "Akud Amagnu n Japun", "MEZ": "Akud amagnu n Turuft Talemmast", "HNT": "Akud Amagnu n Wakal Amaynut", "CLST": "Akud n Unebdu n Cili", "ART": "Akud Amagnu n Arjuntin", "∅∅∅": "Akud n Unebdu n Bṛazilya", "AEST": "Akud Amagnu n Ustṛalya n Usammar", "CLT": "Akud Amagnu n Cili", "GYT": "Akud n Gwiyan", "ChST": "Akud Amagnu n Camuṛṛu", "TMT": "Akud Amagnu n Ṭurkmanistan", "HAT": "Akud n Unebdu n Wakal Amaynut", "TMST": "Akud n Unebdu n Ṭurkmanistan", "CAT": "Akud n tefriqt talemmast", "BT": "Akud n Butan", "MYT": "Akud n Malizya", "NZST": "Akud Amagnu n Ziland Tamaynut", "AKST": "Akud Amagnu n Alaska", "SGT": "Akud Amagnu n Sangapur", "EDT": "Akud n Unebdu n Usammar Agafa n Marikan", "ACWDT": "Akud n Unebdu n Tlemmast n Umalu n Ustṛalya", "HKT": "Akud Amagnu n Hung Kung", "HNCU": "Akud Amagnu n Kuba", "WEZ": "Akud amagnu n turuft n umalu", "WIT": "Akud n Usammar n Indunisya", "AKDT": "Akud n Unebdu n Alaska", "HKST": "Akud n Unebdu n Hung Kung", "HEPM": "Akud n Unebdu n San Pyir & Miklun", "COT": "Akud Amagnu n Kulumbya", "AWDT": "Akud n Unebdu Ustṛalya n Umalu", "AEDT": "Akud n Unebdu n Ustṛalya n Usammar", "EST": "Akud Amagnu n Usammar Agafa n Marikan", "HEEG": "Akud n Unebdu n Grinland n Usammar", "ADT": "Akud Aṭlasan n Unebdu", "WIB": "Akud n Umalu n Indunisya", "UYT": "Akud amagnu n Urugway", "MDT": "Akud n Unebdu n Idurar n Marikan", "EAT": "Akud n tefriqt n usammar", "NZDT": "Akud n Unebdu Ziland Tamaynut", "WARST": "Akud n Unebdu n Arjuntin n Usammar", "SRT": "Akud n Surinam", "AWST": "Akud Amagnu n Ustṛalya n Umalu", "GFT": "Akud n Gwiyan Tafṛansist", "ECT": "Akud n Ikwaṭur", "CHAST": "Akud Amagnu n Catham", "MST": "Akud Amagnu n Idurar n Marikan"},
  67. }
  68. }
  69. // Locale returns the current translators string locale
  70. func (kab *kab_DZ) Locale() string {
  71. return kab.locale
  72. }
  73. // PluralsCardinal returns the list of cardinal plural rules associated with 'kab_DZ'
  74. func (kab *kab_DZ) PluralsCardinal() []locales.PluralRule {
  75. return kab.pluralsCardinal
  76. }
  77. // PluralsOrdinal returns the list of ordinal plural rules associated with 'kab_DZ'
  78. func (kab *kab_DZ) PluralsOrdinal() []locales.PluralRule {
  79. return kab.pluralsOrdinal
  80. }
  81. // PluralsRange returns the list of range plural rules associated with 'kab_DZ'
  82. func (kab *kab_DZ) PluralsRange() []locales.PluralRule {
  83. return kab.pluralsRange
  84. }
  85. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'kab_DZ'
  86. func (kab *kab_DZ) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  87. n := math.Abs(num)
  88. i := int64(n)
  89. if i == 0 || i == 1 {
  90. return locales.PluralRuleOne
  91. }
  92. return locales.PluralRuleOther
  93. }
  94. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'kab_DZ'
  95. func (kab *kab_DZ) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  96. return locales.PluralRuleUnknown
  97. }
  98. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'kab_DZ'
  99. func (kab *kab_DZ) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  100. return locales.PluralRuleUnknown
  101. }
  102. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  103. func (kab *kab_DZ) MonthAbbreviated(month time.Month) string {
  104. return kab.monthsAbbreviated[month]
  105. }
  106. // MonthsAbbreviated returns the locales abbreviated months
  107. func (kab *kab_DZ) MonthsAbbreviated() []string {
  108. return kab.monthsAbbreviated[1:]
  109. }
  110. // MonthNarrow returns the locales narrow month given the 'month' provided
  111. func (kab *kab_DZ) MonthNarrow(month time.Month) string {
  112. return kab.monthsNarrow[month]
  113. }
  114. // MonthsNarrow returns the locales narrow months
  115. func (kab *kab_DZ) MonthsNarrow() []string {
  116. return kab.monthsNarrow[1:]
  117. }
  118. // MonthWide returns the locales wide month given the 'month' provided
  119. func (kab *kab_DZ) MonthWide(month time.Month) string {
  120. return kab.monthsWide[month]
  121. }
  122. // MonthsWide returns the locales wide months
  123. func (kab *kab_DZ) MonthsWide() []string {
  124. return kab.monthsWide[1:]
  125. }
  126. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  127. func (kab *kab_DZ) WeekdayAbbreviated(weekday time.Weekday) string {
  128. return kab.daysAbbreviated[weekday]
  129. }
  130. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  131. func (kab *kab_DZ) WeekdaysAbbreviated() []string {
  132. return kab.daysAbbreviated
  133. }
  134. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  135. func (kab *kab_DZ) WeekdayNarrow(weekday time.Weekday) string {
  136. return kab.daysNarrow[weekday]
  137. }
  138. // WeekdaysNarrow returns the locales narrow weekdays
  139. func (kab *kab_DZ) WeekdaysNarrow() []string {
  140. return kab.daysNarrow
  141. }
  142. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  143. func (kab *kab_DZ) WeekdayShort(weekday time.Weekday) string {
  144. return kab.daysShort[weekday]
  145. }
  146. // WeekdaysShort returns the locales short weekdays
  147. func (kab *kab_DZ) WeekdaysShort() []string {
  148. return kab.daysShort
  149. }
  150. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  151. func (kab *kab_DZ) WeekdayWide(weekday time.Weekday) string {
  152. return kab.daysWide[weekday]
  153. }
  154. // WeekdaysWide returns the locales wide weekdays
  155. func (kab *kab_DZ) WeekdaysWide() []string {
  156. return kab.daysWide
  157. }
  158. // Decimal returns the decimal point of number
  159. func (kab *kab_DZ) Decimal() string {
  160. return kab.decimal
  161. }
  162. // Group returns the group of number
  163. func (kab *kab_DZ) Group() string {
  164. return kab.group
  165. }
  166. // Group returns the minus sign of number
  167. func (kab *kab_DZ) Minus() string {
  168. return kab.minus
  169. }
  170. // FmtNumber returns 'num' with digits/precision of 'v' for 'kab_DZ' and handles both Whole and Real numbers based on 'v'
  171. func (kab *kab_DZ) FmtNumber(num float64, v uint64) string {
  172. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  173. l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
  174. count := 0
  175. inWhole := v == 0
  176. b := make([]byte, 0, l)
  177. for i := len(s) - 1; i >= 0; i-- {
  178. if s[i] == '.' {
  179. b = append(b, kab.decimal[0])
  180. inWhole = true
  181. continue
  182. }
  183. if inWhole {
  184. if count == 3 {
  185. for j := len(kab.group) - 1; j >= 0; j-- {
  186. b = append(b, kab.group[j])
  187. }
  188. count = 1
  189. } else {
  190. count++
  191. }
  192. }
  193. b = append(b, s[i])
  194. }
  195. if num < 0 {
  196. b = append(b, kab.minus[0])
  197. }
  198. // reverse
  199. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  200. b[i], b[j] = b[j], b[i]
  201. }
  202. return string(b)
  203. }
  204. // FmtPercent returns 'num' with digits/precision of 'v' for 'kab_DZ' and handles both Whole and Real numbers based on 'v'
  205. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  206. func (kab *kab_DZ) FmtPercent(num float64, v uint64) string {
  207. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  208. l := len(s) + 3
  209. b := make([]byte, 0, l)
  210. for i := len(s) - 1; i >= 0; i-- {
  211. if s[i] == '.' {
  212. b = append(b, kab.decimal[0])
  213. continue
  214. }
  215. b = append(b, s[i])
  216. }
  217. if num < 0 {
  218. b = append(b, kab.minus[0])
  219. }
  220. // reverse
  221. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  222. b[i], b[j] = b[j], b[i]
  223. }
  224. b = append(b, kab.percent...)
  225. return string(b)
  226. }
  227. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'kab_DZ'
  228. func (kab *kab_DZ) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  229. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  230. symbol := kab.currencies[currency]
  231. l := len(s) + len(symbol) + 2 + 2*len(s[:len(s)-int(v)-1])/3
  232. count := 0
  233. inWhole := v == 0
  234. b := make([]byte, 0, l)
  235. for i := len(s) - 1; i >= 0; i-- {
  236. if s[i] == '.' {
  237. b = append(b, kab.decimal[0])
  238. inWhole = true
  239. continue
  240. }
  241. if inWhole {
  242. if count == 3 {
  243. for j := len(kab.group) - 1; j >= 0; j-- {
  244. b = append(b, kab.group[j])
  245. }
  246. count = 1
  247. } else {
  248. count++
  249. }
  250. }
  251. b = append(b, s[i])
  252. }
  253. if num < 0 {
  254. b = append(b, kab.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, kab.decimal...)
  263. }
  264. for i := 0; i < 2-int(v); i++ {
  265. b = append(b, '0')
  266. }
  267. }
  268. b = append(b, symbol...)
  269. return string(b)
  270. }
  271. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kab_DZ'
  272. // in accounting notation.
  273. func (kab *kab_DZ) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  274. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  275. symbol := kab.currencies[currency]
  276. l := len(s) + len(symbol) + 2 + 2*len(s[:len(s)-int(v)-1])/3
  277. count := 0
  278. inWhole := v == 0
  279. b := make([]byte, 0, l)
  280. for i := len(s) - 1; i >= 0; i-- {
  281. if s[i] == '.' {
  282. b = append(b, kab.decimal[0])
  283. inWhole = true
  284. continue
  285. }
  286. if inWhole {
  287. if count == 3 {
  288. for j := len(kab.group) - 1; j >= 0; j-- {
  289. b = append(b, kab.group[j])
  290. }
  291. count = 1
  292. } else {
  293. count++
  294. }
  295. }
  296. b = append(b, s[i])
  297. }
  298. if num < 0 {
  299. b = append(b, kab.minus[0])
  300. }
  301. // reverse
  302. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  303. b[i], b[j] = b[j], b[i]
  304. }
  305. if int(v) < 2 {
  306. if v == 0 {
  307. b = append(b, kab.decimal...)
  308. }
  309. for i := 0; i < 2-int(v); i++ {
  310. b = append(b, '0')
  311. }
  312. }
  313. if num < 0 {
  314. b = append(b, symbol...)
  315. } else {
  316. b = append(b, symbol...)
  317. }
  318. return string(b)
  319. }
  320. // FmtDateShort returns the short date representation of 't' for 'kab_DZ'
  321. func (kab *kab_DZ) FmtDateShort(t time.Time) string {
  322. b := make([]byte, 0, 32)
  323. b = strconv.AppendInt(b, int64(t.Day()), 10)
  324. b = append(b, []byte{0x2f}...)
  325. b = strconv.AppendInt(b, int64(t.Month()), 10)
  326. b = append(b, []byte{0x2f}...)
  327. if t.Year() > 0 {
  328. b = strconv.AppendInt(b, int64(t.Year()), 10)
  329. } else {
  330. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  331. }
  332. return string(b)
  333. }
  334. // FmtDateMedium returns the medium date representation of 't' for 'kab_DZ'
  335. func (kab *kab_DZ) FmtDateMedium(t time.Time) string {
  336. b := make([]byte, 0, 32)
  337. b = strconv.AppendInt(b, int64(t.Day()), 10)
  338. b = append(b, []byte{0x20}...)
  339. b = append(b, kab.monthsAbbreviated[t.Month()]...)
  340. b = append(b, []byte{0x2c, 0x20}...)
  341. if t.Year() > 0 {
  342. b = strconv.AppendInt(b, int64(t.Year()), 10)
  343. } else {
  344. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  345. }
  346. return string(b)
  347. }
  348. // FmtDateLong returns the long date representation of 't' for 'kab_DZ'
  349. func (kab *kab_DZ) FmtDateLong(t time.Time) string {
  350. b := make([]byte, 0, 32)
  351. b = strconv.AppendInt(b, int64(t.Day()), 10)
  352. b = append(b, []byte{0x20}...)
  353. b = append(b, kab.monthsWide[t.Month()]...)
  354. b = append(b, []byte{0x20}...)
  355. if t.Year() > 0 {
  356. b = strconv.AppendInt(b, int64(t.Year()), 10)
  357. } else {
  358. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  359. }
  360. return string(b)
  361. }
  362. // FmtDateFull returns the full date representation of 't' for 'kab_DZ'
  363. func (kab *kab_DZ) FmtDateFull(t time.Time) string {
  364. b := make([]byte, 0, 32)
  365. b = append(b, kab.daysWide[t.Weekday()]...)
  366. b = append(b, []byte{0x20}...)
  367. b = strconv.AppendInt(b, int64(t.Day()), 10)
  368. b = append(b, []byte{0x20}...)
  369. b = append(b, kab.monthsWide[t.Month()]...)
  370. b = append(b, []byte{0x20}...)
  371. if t.Year() > 0 {
  372. b = strconv.AppendInt(b, int64(t.Year()), 10)
  373. } else {
  374. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  375. }
  376. return string(b)
  377. }
  378. // FmtTimeShort returns the short time representation of 't' for 'kab_DZ'
  379. func (kab *kab_DZ) FmtTimeShort(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, kab.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, []byte{0x20}...)
  392. if t.Hour() < 12 {
  393. b = append(b, kab.periodsAbbreviated[0]...)
  394. } else {
  395. b = append(b, kab.periodsAbbreviated[1]...)
  396. }
  397. return string(b)
  398. }
  399. // FmtTimeMedium returns the medium time representation of 't' for 'kab_DZ'
  400. func (kab *kab_DZ) FmtTimeMedium(t time.Time) string {
  401. b := make([]byte, 0, 32)
  402. h := t.Hour()
  403. if h > 12 {
  404. h -= 12
  405. }
  406. b = strconv.AppendInt(b, int64(h), 10)
  407. b = append(b, kab.timeSeparator...)
  408. if t.Minute() < 10 {
  409. b = append(b, '0')
  410. }
  411. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  412. b = append(b, kab.timeSeparator...)
  413. if t.Second() < 10 {
  414. b = append(b, '0')
  415. }
  416. b = strconv.AppendInt(b, int64(t.Second()), 10)
  417. b = append(b, []byte{0x20}...)
  418. if t.Hour() < 12 {
  419. b = append(b, kab.periodsAbbreviated[0]...)
  420. } else {
  421. b = append(b, kab.periodsAbbreviated[1]...)
  422. }
  423. return string(b)
  424. }
  425. // FmtTimeLong returns the long time representation of 't' for 'kab_DZ'
  426. func (kab *kab_DZ) FmtTimeLong(t time.Time) string {
  427. b := make([]byte, 0, 32)
  428. h := t.Hour()
  429. if h > 12 {
  430. h -= 12
  431. }
  432. b = strconv.AppendInt(b, int64(h), 10)
  433. b = append(b, kab.timeSeparator...)
  434. if t.Minute() < 10 {
  435. b = append(b, '0')
  436. }
  437. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  438. b = append(b, kab.timeSeparator...)
  439. if t.Second() < 10 {
  440. b = append(b, '0')
  441. }
  442. b = strconv.AppendInt(b, int64(t.Second()), 10)
  443. b = append(b, []byte{0x20}...)
  444. if t.Hour() < 12 {
  445. b = append(b, kab.periodsAbbreviated[0]...)
  446. } else {
  447. b = append(b, kab.periodsAbbreviated[1]...)
  448. }
  449. b = append(b, []byte{0x20}...)
  450. tz, _ := t.Zone()
  451. b = append(b, tz...)
  452. return string(b)
  453. }
  454. // FmtTimeFull returns the full time representation of 't' for 'kab_DZ'
  455. func (kab *kab_DZ) FmtTimeFull(t time.Time) string {
  456. b := make([]byte, 0, 32)
  457. h := t.Hour()
  458. if h > 12 {
  459. h -= 12
  460. }
  461. b = strconv.AppendInt(b, int64(h), 10)
  462. b = append(b, kab.timeSeparator...)
  463. if t.Minute() < 10 {
  464. b = append(b, '0')
  465. }
  466. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  467. b = append(b, kab.timeSeparator...)
  468. if t.Second() < 10 {
  469. b = append(b, '0')
  470. }
  471. b = strconv.AppendInt(b, int64(t.Second()), 10)
  472. b = append(b, []byte{0x20}...)
  473. if t.Hour() < 12 {
  474. b = append(b, kab.periodsAbbreviated[0]...)
  475. } else {
  476. b = append(b, kab.periodsAbbreviated[1]...)
  477. }
  478. b = append(b, []byte{0x20}...)
  479. tz, _ := t.Zone()
  480. if btz, ok := kab.timezones[tz]; ok {
  481. b = append(b, btz...)
  482. } else {
  483. b = append(b, tz...)
  484. }
  485. return string(b)
  486. }