pt_AO.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. package pt_AO
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type pt_AO struct {
  10. locale string
  11. pluralsCardinal []locales.PluralRule
  12. pluralsOrdinal []locales.PluralRule
  13. pluralsRange []locales.PluralRule
  14. decimal string
  15. group string
  16. minus string
  17. percent string
  18. perMille string
  19. timeSeparator string
  20. inifinity string
  21. currencies []string // idx = enum of currency code
  22. currencyPositiveSuffix string
  23. currencyNegativePrefix string
  24. currencyNegativeSuffix string
  25. monthsAbbreviated []string
  26. monthsNarrow []string
  27. monthsWide []string
  28. daysAbbreviated []string
  29. daysNarrow []string
  30. daysShort []string
  31. daysWide []string
  32. periodsAbbreviated []string
  33. periodsNarrow []string
  34. periodsShort []string
  35. periodsWide []string
  36. erasAbbreviated []string
  37. erasNarrow []string
  38. erasWide []string
  39. timezones map[string]string
  40. }
  41. // New returns a new instance of translator for the 'pt_AO' locale
  42. func New() locales.Translator {
  43. return &pt_AO{
  44. locale: "pt_AO",
  45. pluralsCardinal: []locales.PluralRule{2, 6},
  46. pluralsOrdinal: []locales.PluralRule{6},
  47. pluralsRange: []locales.PluralRule{2, 6},
  48. decimal: ",",
  49. group: " ",
  50. minus: "-",
  51. percent: "%",
  52. perMille: "‰",
  53. timeSeparator: ":",
  54. inifinity: "∞",
  55. currencies: []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "Kz", "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"},
  56. currencyPositiveSuffix: " ",
  57. currencyNegativePrefix: "(",
  58. currencyNegativeSuffix: " )",
  59. monthsAbbreviated: []string{"", "jan", "fev", "mar", "abr", "mai", "jun", "jul", "ago", "set", "out", "nov", "dez"},
  60. monthsNarrow: []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
  61. monthsWide: []string{"", "janeiro", "fevereiro", "março", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro"},
  62. daysAbbreviated: []string{"domingo", "segunda", "terça", "quarta", "quinta", "sexta", "sábado"},
  63. daysNarrow: []string{"D", "S", "T", "Q", "Q", "S", "S"},
  64. daysShort: []string{"dom", "seg", "ter", "qua", "qui", "sex", "sáb"},
  65. daysWide: []string{"domingo", "segunda-feira", "terça-feira", "quarta-feira", "quinta-feira", "sexta-feira", "sábado"},
  66. periodsAbbreviated: []string{"a.m.", "p.m."},
  67. periodsNarrow: []string{"a.m.", "p.m."},
  68. periodsWide: []string{"da manhã", "da tarde"},
  69. erasAbbreviated: []string{"a.E.C.", "E.C."},
  70. erasNarrow: []string{"", ""},
  71. erasWide: []string{"", ""},
  72. timezones: map[string]string{"HADT": "Hora de verão do Havai e Aleutas", "CHAST": "Hora padrão de Chatham", "ADT": "Hora de verão do Atlântico", "BT": "Hora do Butão", "CDT": "Hora de verão Central", "WARST": "Hora de verão da Argentina Ocidental", "HENOMX": "Hora de verão do Noroeste do México", "ART": "Hora padrão da Argentina", "CHADT": "Hora de verão de Chatham", "HECU": "Hora de verão de Cuba", "GFT": "Hora da Guiana Francesa", "HEPM": "Hora de verão de São Pedro e Miquelão", "AWDT": "Hora de verão da Austrália Ocidental", "PST": "Hora padrão do Pacífico", "MESZ": "Hora de verão da Europa Central", "HKST": "Hora de verão de Hong Kong", "WITA": "Hora da Indonésia Central", "ChST": "Hora padrão de Chamorro", "HEPMX": "Hora de verão do Pacífico Mexicano", "CST": "Hora padrão Central", "ACDT": "Hora de verão da Austrália Central", "WART": "Hora padrão da Argentina Ocidental", "TMT": "Hora padrão do Turquemenistão", "CAT": "Hora da África Central", "HAST": "Hora padrão do Havai e Aleutas", "SAST": "Hora da África do Sul", "AKST": "Hora padrão do Alasca", "SGT": "Hora padrão de Singapura", "CLT": "Hora padrão do Chile", "ARST": "Hora de verão da Argentina", "OEZ": "Hora padrão da Europa Oriental", "MST": "Hora padrão da Montanha", "ECT": "Hora do Equador", "LHST": "Hora padrão de Lord Howe", "JDT": "Hora de verão do Japão", "HNOG": "Hora padrão da Gronelândia Ocidental", "ACST": "Hora padrão da Austrália Central", "HNPM": "Hora padrão de São Pedro e Miquelão", "HNT": "Hora padrão da Terra Nova", "HNCU": "Hora padrão de Cuba", "AEST": "Hora padrão da Austrália Oriental", "AEDT": "Hora de verão da Austrália Oriental", "MEZ": "Hora padrão da Europa Central", "SRT": "Hora do Suriname", "OESZ": "Hora de verão da Europa Oriental", "UYST": "Hora de verão do Uruguai", "AWST": "Hora padrão da Austrália Ocidental", "HNPMX": "Hora padrão do Pacífico Mexicano", "BOT": "Hora da Bolívia", "IST": "Hora padrão da Índia", "LHDT": "Hora de verão de Lord Howe", "EAT": "Hora da África Oriental", "WEZ": "Hora padrão da Europa Ocidental", "WESZ": "Hora de verão da Europa Ocidental", "EDT": "Hora de verão Oriental", "NZST": "Hora padrão da Nova Zelândia", "HEOG": "Hora de verão da Gronelândia Ocidental", "EST": "Hora padrão Oriental", "GYT": "Hora da Guiana", "WAT": "Hora padrão da África Ocidental", "WAST": "Hora de verão da África Ocidental", "JST": "Hora padrão do Japão", "COST": "Hora de verão da Colômbia", "MYT": "Hora da Malásia", "ACWDT": "Hora de verão da Austrália Central Ocidental", "WIT": "Hora da Indonésia Oriental", "TMST": "Hora de verão do Turquemenistão", "NZDT": "Hora de verão da Nova Zelândia", "HNEG": "Hora padrão da Gronelândia Oriental", "HNNOMX": "Hora padrão do Noroeste do México", "AKDT": "Hora de verão do Alasca", "ACWST": "Hora padrão da Austrália Central Ocidental", "HAT": "Hora de verão da Terra Nova", "COT": "Hora padrão da Colômbia", "UYT": "Hora padrão do Uruguai", "∅∅∅": "Hora de verão de Brasília", "AST": "Hora padrão do Atlântico", "WIB": "Hora da Indonésia Ocidental", "VET": "Hora da Venezuela", "PDT": "Hora de verão do Pacífico", "MDT": "Hora de verão da Montanha", "HEEG": "Hora de verão da Gronelândia Oriental", "HKT": "Hora padrão de Hong Kong", "CLST": "Hora de verão do Chile", "GMT": "Hora de Greenwich"},
  73. }
  74. }
  75. // Locale returns the current translators string locale
  76. func (pt *pt_AO) Locale() string {
  77. return pt.locale
  78. }
  79. // PluralsCardinal returns the list of cardinal plural rules associated with 'pt_AO'
  80. func (pt *pt_AO) PluralsCardinal() []locales.PluralRule {
  81. return pt.pluralsCardinal
  82. }
  83. // PluralsOrdinal returns the list of ordinal plural rules associated with 'pt_AO'
  84. func (pt *pt_AO) PluralsOrdinal() []locales.PluralRule {
  85. return pt.pluralsOrdinal
  86. }
  87. // PluralsRange returns the list of range plural rules associated with 'pt_AO'
  88. func (pt *pt_AO) PluralsRange() []locales.PluralRule {
  89. return pt.pluralsRange
  90. }
  91. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'pt_AO'
  92. func (pt *pt_AO) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  93. n := math.Abs(num)
  94. i := int64(n)
  95. if i >= 0 && i <= 1 {
  96. return locales.PluralRuleOne
  97. }
  98. return locales.PluralRuleOther
  99. }
  100. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'pt_AO'
  101. func (pt *pt_AO) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  102. return locales.PluralRuleOther
  103. }
  104. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'pt_AO'
  105. func (pt *pt_AO) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  106. start := pt.CardinalPluralRule(num1, v1)
  107. end := pt.CardinalPluralRule(num2, v2)
  108. if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
  109. return locales.PluralRuleOne
  110. } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  111. return locales.PluralRuleOther
  112. }
  113. return locales.PluralRuleOther
  114. }
  115. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  116. func (pt *pt_AO) MonthAbbreviated(month time.Month) string {
  117. return pt.monthsAbbreviated[month]
  118. }
  119. // MonthsAbbreviated returns the locales abbreviated months
  120. func (pt *pt_AO) MonthsAbbreviated() []string {
  121. return pt.monthsAbbreviated[1:]
  122. }
  123. // MonthNarrow returns the locales narrow month given the 'month' provided
  124. func (pt *pt_AO) MonthNarrow(month time.Month) string {
  125. return pt.monthsNarrow[month]
  126. }
  127. // MonthsNarrow returns the locales narrow months
  128. func (pt *pt_AO) MonthsNarrow() []string {
  129. return pt.monthsNarrow[1:]
  130. }
  131. // MonthWide returns the locales wide month given the 'month' provided
  132. func (pt *pt_AO) MonthWide(month time.Month) string {
  133. return pt.monthsWide[month]
  134. }
  135. // MonthsWide returns the locales wide months
  136. func (pt *pt_AO) MonthsWide() []string {
  137. return pt.monthsWide[1:]
  138. }
  139. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  140. func (pt *pt_AO) WeekdayAbbreviated(weekday time.Weekday) string {
  141. return pt.daysAbbreviated[weekday]
  142. }
  143. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  144. func (pt *pt_AO) WeekdaysAbbreviated() []string {
  145. return pt.daysAbbreviated
  146. }
  147. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  148. func (pt *pt_AO) WeekdayNarrow(weekday time.Weekday) string {
  149. return pt.daysNarrow[weekday]
  150. }
  151. // WeekdaysNarrow returns the locales narrow weekdays
  152. func (pt *pt_AO) WeekdaysNarrow() []string {
  153. return pt.daysNarrow
  154. }
  155. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  156. func (pt *pt_AO) WeekdayShort(weekday time.Weekday) string {
  157. return pt.daysShort[weekday]
  158. }
  159. // WeekdaysShort returns the locales short weekdays
  160. func (pt *pt_AO) WeekdaysShort() []string {
  161. return pt.daysShort
  162. }
  163. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  164. func (pt *pt_AO) WeekdayWide(weekday time.Weekday) string {
  165. return pt.daysWide[weekday]
  166. }
  167. // WeekdaysWide returns the locales wide weekdays
  168. func (pt *pt_AO) WeekdaysWide() []string {
  169. return pt.daysWide
  170. }
  171. // Decimal returns the decimal point of number
  172. func (pt *pt_AO) Decimal() string {
  173. return pt.decimal
  174. }
  175. // Group returns the group of number
  176. func (pt *pt_AO) Group() string {
  177. return pt.group
  178. }
  179. // Group returns the minus sign of number
  180. func (pt *pt_AO) Minus() string {
  181. return pt.minus
  182. }
  183. // FmtNumber returns 'num' with digits/precision of 'v' for 'pt_AO' and handles both Whole and Real numbers based on 'v'
  184. func (pt *pt_AO) FmtNumber(num float64, v uint64) string {
  185. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  186. l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
  187. count := 0
  188. inWhole := v == 0
  189. b := make([]byte, 0, l)
  190. for i := len(s) - 1; i >= 0; i-- {
  191. if s[i] == '.' {
  192. b = append(b, pt.decimal[0])
  193. inWhole = true
  194. continue
  195. }
  196. if inWhole {
  197. if count == 3 {
  198. for j := len(pt.group) - 1; j >= 0; j-- {
  199. b = append(b, pt.group[j])
  200. }
  201. count = 1
  202. } else {
  203. count++
  204. }
  205. }
  206. b = append(b, s[i])
  207. }
  208. if num < 0 {
  209. b = append(b, pt.minus[0])
  210. }
  211. // reverse
  212. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  213. b[i], b[j] = b[j], b[i]
  214. }
  215. return string(b)
  216. }
  217. // FmtPercent returns 'num' with digits/precision of 'v' for 'pt_AO' and handles both Whole and Real numbers based on 'v'
  218. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  219. func (pt *pt_AO) FmtPercent(num float64, v uint64) string {
  220. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  221. l := len(s) + 3
  222. b := make([]byte, 0, l)
  223. for i := len(s) - 1; i >= 0; i-- {
  224. if s[i] == '.' {
  225. b = append(b, pt.decimal[0])
  226. continue
  227. }
  228. b = append(b, s[i])
  229. }
  230. if num < 0 {
  231. b = append(b, pt.minus[0])
  232. }
  233. // reverse
  234. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  235. b[i], b[j] = b[j], b[i]
  236. }
  237. b = append(b, pt.percent...)
  238. return string(b)
  239. }
  240. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'pt_AO'
  241. func (pt *pt_AO) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  242. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  243. symbol := pt.currencies[currency]
  244. l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
  245. count := 0
  246. inWhole := v == 0
  247. b := make([]byte, 0, l)
  248. for i := len(s) - 1; i >= 0; i-- {
  249. if s[i] == '.' {
  250. b = append(b, pt.decimal[0])
  251. inWhole = true
  252. continue
  253. }
  254. if inWhole {
  255. if count == 3 {
  256. for j := len(pt.group) - 1; j >= 0; j-- {
  257. b = append(b, pt.group[j])
  258. }
  259. count = 1
  260. } else {
  261. count++
  262. }
  263. }
  264. b = append(b, s[i])
  265. }
  266. if num < 0 {
  267. b = append(b, pt.minus[0])
  268. }
  269. // reverse
  270. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  271. b[i], b[j] = b[j], b[i]
  272. }
  273. if int(v) < 2 {
  274. if v == 0 {
  275. b = append(b, pt.decimal...)
  276. }
  277. for i := 0; i < 2-int(v); i++ {
  278. b = append(b, '0')
  279. }
  280. }
  281. b = append(b, pt.currencyPositiveSuffix...)
  282. b = append(b, symbol...)
  283. return string(b)
  284. }
  285. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_AO'
  286. // in accounting notation.
  287. func (pt *pt_AO) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  288. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  289. symbol := pt.currencies[currency]
  290. l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
  291. count := 0
  292. inWhole := v == 0
  293. b := make([]byte, 0, l)
  294. for i := len(s) - 1; i >= 0; i-- {
  295. if s[i] == '.' {
  296. b = append(b, pt.decimal[0])
  297. inWhole = true
  298. continue
  299. }
  300. if inWhole {
  301. if count == 3 {
  302. for j := len(pt.group) - 1; j >= 0; j-- {
  303. b = append(b, pt.group[j])
  304. }
  305. count = 1
  306. } else {
  307. count++
  308. }
  309. }
  310. b = append(b, s[i])
  311. }
  312. if num < 0 {
  313. b = append(b, pt.currencyNegativePrefix[0])
  314. }
  315. // reverse
  316. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  317. b[i], b[j] = b[j], b[i]
  318. }
  319. if int(v) < 2 {
  320. if v == 0 {
  321. b = append(b, pt.decimal...)
  322. }
  323. for i := 0; i < 2-int(v); i++ {
  324. b = append(b, '0')
  325. }
  326. }
  327. if num < 0 {
  328. b = append(b, pt.currencyNegativeSuffix...)
  329. b = append(b, symbol...)
  330. } else {
  331. b = append(b, pt.currencyPositiveSuffix...)
  332. b = append(b, symbol...)
  333. }
  334. return string(b)
  335. }
  336. // FmtDateShort returns the short date representation of 't' for 'pt_AO'
  337. func (pt *pt_AO) FmtDateShort(t time.Time) string {
  338. b := make([]byte, 0, 32)
  339. if t.Day() < 10 {
  340. b = append(b, '0')
  341. }
  342. b = strconv.AppendInt(b, int64(t.Day()), 10)
  343. b = append(b, []byte{0x2f}...)
  344. if t.Month() < 10 {
  345. b = append(b, '0')
  346. }
  347. b = strconv.AppendInt(b, int64(t.Month()), 10)
  348. b = append(b, []byte{0x2f}...)
  349. if t.Year() > 9 {
  350. b = append(b, strconv.Itoa(t.Year())[2:]...)
  351. } else {
  352. b = append(b, strconv.Itoa(t.Year())[1:]...)
  353. }
  354. return string(b)
  355. }
  356. // FmtDateMedium returns the medium date representation of 't' for 'pt_AO'
  357. func (pt *pt_AO) FmtDateMedium(t time.Time) string {
  358. b := make([]byte, 0, 32)
  359. if t.Day() < 10 {
  360. b = append(b, '0')
  361. }
  362. b = strconv.AppendInt(b, int64(t.Day()), 10)
  363. b = append(b, []byte{0x2f}...)
  364. if t.Month() < 10 {
  365. b = append(b, '0')
  366. }
  367. b = strconv.AppendInt(b, int64(t.Month()), 10)
  368. b = append(b, []byte{0x2f}...)
  369. if t.Year() > 0 {
  370. b = strconv.AppendInt(b, int64(t.Year()), 10)
  371. } else {
  372. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  373. }
  374. return string(b)
  375. }
  376. // FmtDateLong returns the long date representation of 't' for 'pt_AO'
  377. func (pt *pt_AO) FmtDateLong(t time.Time) string {
  378. b := make([]byte, 0, 32)
  379. b = strconv.AppendInt(b, int64(t.Day()), 10)
  380. b = append(b, []byte{0x20, 0x64, 0x65}...)
  381. b = append(b, []byte{0x20}...)
  382. b = append(b, pt.monthsWide[t.Month()]...)
  383. b = append(b, []byte{0x20, 0x64, 0x65}...)
  384. b = append(b, []byte{0x20}...)
  385. if t.Year() > 0 {
  386. b = strconv.AppendInt(b, int64(t.Year()), 10)
  387. } else {
  388. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  389. }
  390. return string(b)
  391. }
  392. // FmtDateFull returns the full date representation of 't' for 'pt_AO'
  393. func (pt *pt_AO) FmtDateFull(t time.Time) string {
  394. b := make([]byte, 0, 32)
  395. b = append(b, pt.daysWide[t.Weekday()]...)
  396. b = append(b, []byte{0x2c, 0x20}...)
  397. b = strconv.AppendInt(b, int64(t.Day()), 10)
  398. b = append(b, []byte{0x20, 0x64, 0x65}...)
  399. b = append(b, []byte{0x20}...)
  400. b = append(b, pt.monthsWide[t.Month()]...)
  401. b = append(b, []byte{0x20, 0x64, 0x65}...)
  402. b = append(b, []byte{0x20}...)
  403. if t.Year() > 0 {
  404. b = strconv.AppendInt(b, int64(t.Year()), 10)
  405. } else {
  406. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  407. }
  408. return string(b)
  409. }
  410. // FmtTimeShort returns the short time representation of 't' for 'pt_AO'
  411. func (pt *pt_AO) FmtTimeShort(t time.Time) string {
  412. b := make([]byte, 0, 32)
  413. if t.Hour() < 10 {
  414. b = append(b, '0')
  415. }
  416. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  417. b = append(b, pt.timeSeparator...)
  418. if t.Minute() < 10 {
  419. b = append(b, '0')
  420. }
  421. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  422. return string(b)
  423. }
  424. // FmtTimeMedium returns the medium time representation of 't' for 'pt_AO'
  425. func (pt *pt_AO) FmtTimeMedium(t time.Time) string {
  426. b := make([]byte, 0, 32)
  427. if t.Hour() < 10 {
  428. b = append(b, '0')
  429. }
  430. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  431. b = append(b, pt.timeSeparator...)
  432. if t.Minute() < 10 {
  433. b = append(b, '0')
  434. }
  435. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  436. b = append(b, pt.timeSeparator...)
  437. if t.Second() < 10 {
  438. b = append(b, '0')
  439. }
  440. b = strconv.AppendInt(b, int64(t.Second()), 10)
  441. return string(b)
  442. }
  443. // FmtTimeLong returns the long time representation of 't' for 'pt_AO'
  444. func (pt *pt_AO) FmtTimeLong(t time.Time) string {
  445. b := make([]byte, 0, 32)
  446. if t.Hour() < 10 {
  447. b = append(b, '0')
  448. }
  449. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  450. b = append(b, pt.timeSeparator...)
  451. if t.Minute() < 10 {
  452. b = append(b, '0')
  453. }
  454. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  455. b = append(b, pt.timeSeparator...)
  456. if t.Second() < 10 {
  457. b = append(b, '0')
  458. }
  459. b = strconv.AppendInt(b, int64(t.Second()), 10)
  460. b = append(b, []byte{0x20}...)
  461. tz, _ := t.Zone()
  462. b = append(b, tz...)
  463. return string(b)
  464. }
  465. // FmtTimeFull returns the full time representation of 't' for 'pt_AO'
  466. func (pt *pt_AO) FmtTimeFull(t time.Time) string {
  467. b := make([]byte, 0, 32)
  468. if t.Hour() < 10 {
  469. b = append(b, '0')
  470. }
  471. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  472. b = append(b, pt.timeSeparator...)
  473. if t.Minute() < 10 {
  474. b = append(b, '0')
  475. }
  476. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  477. b = append(b, pt.timeSeparator...)
  478. if t.Second() < 10 {
  479. b = append(b, '0')
  480. }
  481. b = strconv.AppendInt(b, int64(t.Second()), 10)
  482. b = append(b, []byte{0x20}...)
  483. tz, _ := t.Zone()
  484. if btz, ok := pt.timezones[tz]; ok {
  485. b = append(b, btz...)
  486. } else {
  487. b = append(b, tz...)
  488. }
  489. return string(b)
  490. }