so_SO.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. package so_SO
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type so_SO 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 'so_SO' locale
  39. func New() locales.Translator {
  40. return &so_SO{
  41. locale: "so_SO",
  42. pluralsCardinal: []locales.PluralRule{2, 6},
  43. pluralsOrdinal: nil,
  44. pluralsRange: nil,
  45. decimal: ".",
  46. group: ",",
  47. timeSeparator: ":",
  48. 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"},
  49. monthsAbbreviated: []string{"", "Kob", "Lab", "Sad", "Afr", "Sha", "Lix", "Tod", "Sid", "Sag", "Tob", "KIT", "LIT"},
  50. monthsNarrow: []string{"", "K", "L", "S", "A", "S", "L", "T", "S", "S", "T", "K", "L"},
  51. monthsWide: []string{"", "Bisha Koobaad", "Bisha Labaad", "Bisha Saddexaad", "Bisha Afraad", "Bisha Shanaad", "Bisha Lixaad", "Bisha Todobaad", "Bisha Sideedaad", "Bisha Sagaalaad", "Bisha Tobnaad", "Bisha Kow iyo Tobnaad", "Bisha Laba iyo Tobnaad"},
  52. daysAbbreviated: []string{"Axd", "Isn", "Tal", "Arb", "Kha", "Jim", "Sab"},
  53. daysNarrow: []string{"A", "I", "T", "A", "Kh", "J", "S"},
  54. daysShort: []string{"Axd", "Isn", "Tal", "Arb", "Kha", "Jim", "Sab"},
  55. daysWide: []string{"Axad", "Isniin", "Talaado", "Arbaco", "Khamiis", "Jimco", "Sabti"},
  56. periodsAbbreviated: []string{"sn.", "gn."},
  57. periodsNarrow: []string{"sn.", "gn."},
  58. periodsWide: []string{"sn.", "gn."},
  59. erasAbbreviated: []string{"CK", "CD"},
  60. erasNarrow: []string{"", ""},
  61. erasWide: []string{"CK", "CD"},
  62. timezones: map[string]string{"HENOMX": "HENOMX", "GYT": "GYT", "AST": "AST", "LHDT": "LHDT", "CLST": "CLST", "OESZ": "OESZ", "AKDT": "AKDT", "MEZ": "MEZ", "MESZ": "MESZ", "CAT": "CAT", "ARST": "ARST", "ChST": "ChST", "MST": "MST", "HKST": "HKST", "TMST": "TMST", "ECT": "ECT", "WITA": "WITA", "VET": "VET", "OEZ": "OEZ", "ART": "ART", "HEPMX": "HEPMX", "AWST": "AWST", "AEDT": "AEDT", "EST": "EST", "ACWDT": "ACWDT", "TMT": "TMT", "HNCU": "HNCU", "SGT": "SGT", "JDT": "JDT", "HEOG": "HEOG", "ACWST": "ACWST", "HEPM": "HEPM", "COST": "Waqtiyada Xagaaga Kolambiya", "WIB": "WIB", "∅∅∅": "∅∅∅", "HNNOMX": "HNNOMX", "CLT": "CLT", "HAST": "HAST", "PDT": "PDT", "MDT": "MDT", "WART": "WART", "UYST": "UYST", "HECU": "HECU", "HNPMX": "HNPMX", "JST": "JST", "NZST": "NZST", "NZDT": "NZDT", "ACDT": "ACDT", "WIT": "WIT", "CST": "CST", "WAST": "WAST", "MYT": "MYT", "HNOG": "HNOG", "EDT": "EDT", "ACST": "ACST", "LHST": "LHST", "WARST": "WARST", "HAT": "HAT", "BT": "BT", "CHAST": "CHAST", "AEST": "AEST", "SAST": "SAST", "WESZ": "WESZ", "BOT": "BOT", "AKST": "AKST", "HNEG": "HNEG", "ADT": "ADT", "PST": "PST", "HKT": "HKT", "IST": "IST", "SRT": "SRT", "COT": "Waqtiyada Caadiga ah ee kolambiya", "CHADT": "CHADT", "AWDT": "AWDT", "HEEG": "HEEG", "GFT": "GFT", "HNT": "HNT", "HADT": "HADT", "GMT": "GMT", "UYT": "UYT", "CDT": "CDT", "WAT": "WAT", "HNPM": "HNPM", "EAT": "EAT", "WEZ": "WEZ"},
  63. }
  64. }
  65. // Locale returns the current translators string locale
  66. func (so *so_SO) Locale() string {
  67. return so.locale
  68. }
  69. // PluralsCardinal returns the list of cardinal plural rules associated with 'so_SO'
  70. func (so *so_SO) PluralsCardinal() []locales.PluralRule {
  71. return so.pluralsCardinal
  72. }
  73. // PluralsOrdinal returns the list of ordinal plural rules associated with 'so_SO'
  74. func (so *so_SO) PluralsOrdinal() []locales.PluralRule {
  75. return so.pluralsOrdinal
  76. }
  77. // PluralsRange returns the list of range plural rules associated with 'so_SO'
  78. func (so *so_SO) PluralsRange() []locales.PluralRule {
  79. return so.pluralsRange
  80. }
  81. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'so_SO'
  82. func (so *so_SO) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  83. n := math.Abs(num)
  84. if n == 1 {
  85. return locales.PluralRuleOne
  86. }
  87. return locales.PluralRuleOther
  88. }
  89. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'so_SO'
  90. func (so *so_SO) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  91. return locales.PluralRuleUnknown
  92. }
  93. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'so_SO'
  94. func (so *so_SO) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  95. return locales.PluralRuleUnknown
  96. }
  97. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  98. func (so *so_SO) MonthAbbreviated(month time.Month) string {
  99. return so.monthsAbbreviated[month]
  100. }
  101. // MonthsAbbreviated returns the locales abbreviated months
  102. func (so *so_SO) MonthsAbbreviated() []string {
  103. return so.monthsAbbreviated[1:]
  104. }
  105. // MonthNarrow returns the locales narrow month given the 'month' provided
  106. func (so *so_SO) MonthNarrow(month time.Month) string {
  107. return so.monthsNarrow[month]
  108. }
  109. // MonthsNarrow returns the locales narrow months
  110. func (so *so_SO) MonthsNarrow() []string {
  111. return so.monthsNarrow[1:]
  112. }
  113. // MonthWide returns the locales wide month given the 'month' provided
  114. func (so *so_SO) MonthWide(month time.Month) string {
  115. return so.monthsWide[month]
  116. }
  117. // MonthsWide returns the locales wide months
  118. func (so *so_SO) MonthsWide() []string {
  119. return so.monthsWide[1:]
  120. }
  121. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  122. func (so *so_SO) WeekdayAbbreviated(weekday time.Weekday) string {
  123. return so.daysAbbreviated[weekday]
  124. }
  125. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  126. func (so *so_SO) WeekdaysAbbreviated() []string {
  127. return so.daysAbbreviated
  128. }
  129. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  130. func (so *so_SO) WeekdayNarrow(weekday time.Weekday) string {
  131. return so.daysNarrow[weekday]
  132. }
  133. // WeekdaysNarrow returns the locales narrow weekdays
  134. func (so *so_SO) WeekdaysNarrow() []string {
  135. return so.daysNarrow
  136. }
  137. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  138. func (so *so_SO) WeekdayShort(weekday time.Weekday) string {
  139. return so.daysShort[weekday]
  140. }
  141. // WeekdaysShort returns the locales short weekdays
  142. func (so *so_SO) WeekdaysShort() []string {
  143. return so.daysShort
  144. }
  145. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  146. func (so *so_SO) WeekdayWide(weekday time.Weekday) string {
  147. return so.daysWide[weekday]
  148. }
  149. // WeekdaysWide returns the locales wide weekdays
  150. func (so *so_SO) WeekdaysWide() []string {
  151. return so.daysWide
  152. }
  153. // Decimal returns the decimal point of number
  154. func (so *so_SO) Decimal() string {
  155. return so.decimal
  156. }
  157. // Group returns the group of number
  158. func (so *so_SO) Group() string {
  159. return so.group
  160. }
  161. // Group returns the minus sign of number
  162. func (so *so_SO) Minus() string {
  163. return so.minus
  164. }
  165. // FmtNumber returns 'num' with digits/precision of 'v' for 'so_SO' and handles both Whole and Real numbers based on 'v'
  166. func (so *so_SO) FmtNumber(num float64, v uint64) string {
  167. return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  168. }
  169. // FmtPercent returns 'num' with digits/precision of 'v' for 'so_SO' and handles both Whole and Real numbers based on 'v'
  170. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  171. func (so *so_SO) FmtPercent(num float64, v uint64) string {
  172. return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  173. }
  174. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'so_SO'
  175. func (so *so_SO) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  176. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  177. symbol := so.currencies[currency]
  178. l := len(s) + len(symbol) + 1 + 1*len(s[:len(s)-int(v)-1])/3
  179. count := 0
  180. inWhole := v == 0
  181. b := make([]byte, 0, l)
  182. for i := len(s) - 1; i >= 0; i-- {
  183. if s[i] == '.' {
  184. b = append(b, so.decimal[0])
  185. inWhole = true
  186. continue
  187. }
  188. if inWhole {
  189. if count == 3 {
  190. b = append(b, so.group[0])
  191. count = 1
  192. } else {
  193. count++
  194. }
  195. }
  196. b = append(b, s[i])
  197. }
  198. for j := len(symbol) - 1; j >= 0; j-- {
  199. b = append(b, symbol[j])
  200. }
  201. if num < 0 {
  202. b = append(b, so.minus[0])
  203. }
  204. // reverse
  205. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  206. b[i], b[j] = b[j], b[i]
  207. }
  208. if int(v) < 2 {
  209. if v == 0 {
  210. b = append(b, so.decimal...)
  211. }
  212. for i := 0; i < 2-int(v); i++ {
  213. b = append(b, '0')
  214. }
  215. }
  216. return string(b)
  217. }
  218. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'so_SO'
  219. // in accounting notation.
  220. func (so *so_SO) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  221. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  222. symbol := so.currencies[currency]
  223. l := len(s) + len(symbol) + 1 + 1*len(s[:len(s)-int(v)-1])/3
  224. count := 0
  225. inWhole := v == 0
  226. b := make([]byte, 0, l)
  227. for i := len(s) - 1; i >= 0; i-- {
  228. if s[i] == '.' {
  229. b = append(b, so.decimal[0])
  230. inWhole = true
  231. continue
  232. }
  233. if inWhole {
  234. if count == 3 {
  235. b = append(b, so.group[0])
  236. count = 1
  237. } else {
  238. count++
  239. }
  240. }
  241. b = append(b, s[i])
  242. }
  243. if num < 0 {
  244. for j := len(symbol) - 1; j >= 0; j-- {
  245. b = append(b, symbol[j])
  246. }
  247. b = append(b, so.minus[0])
  248. } else {
  249. for j := len(symbol) - 1; j >= 0; j-- {
  250. b = append(b, symbol[j])
  251. }
  252. }
  253. // reverse
  254. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  255. b[i], b[j] = b[j], b[i]
  256. }
  257. if int(v) < 2 {
  258. if v == 0 {
  259. b = append(b, so.decimal...)
  260. }
  261. for i := 0; i < 2-int(v); i++ {
  262. b = append(b, '0')
  263. }
  264. }
  265. return string(b)
  266. }
  267. // FmtDateShort returns the short date representation of 't' for 'so_SO'
  268. func (so *so_SO) FmtDateShort(t time.Time) string {
  269. b := make([]byte, 0, 32)
  270. if t.Day() < 10 {
  271. b = append(b, '0')
  272. }
  273. b = strconv.AppendInt(b, int64(t.Day()), 10)
  274. b = append(b, []byte{0x2f}...)
  275. if t.Month() < 10 {
  276. b = append(b, '0')
  277. }
  278. b = strconv.AppendInt(b, int64(t.Month()), 10)
  279. b = append(b, []byte{0x2f}...)
  280. if t.Year() > 9 {
  281. b = append(b, strconv.Itoa(t.Year())[2:]...)
  282. } else {
  283. b = append(b, strconv.Itoa(t.Year())[1:]...)
  284. }
  285. return string(b)
  286. }
  287. // FmtDateMedium returns the medium date representation of 't' for 'so_SO'
  288. func (so *so_SO) FmtDateMedium(t time.Time) string {
  289. b := make([]byte, 0, 32)
  290. if t.Day() < 10 {
  291. b = append(b, '0')
  292. }
  293. b = strconv.AppendInt(b, int64(t.Day()), 10)
  294. b = append(b, []byte{0x2d}...)
  295. b = append(b, so.monthsAbbreviated[t.Month()]...)
  296. b = append(b, []byte{0x2d}...)
  297. if t.Year() > 0 {
  298. b = strconv.AppendInt(b, int64(t.Year()), 10)
  299. } else {
  300. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  301. }
  302. return string(b)
  303. }
  304. // FmtDateLong returns the long date representation of 't' for 'so_SO'
  305. func (so *so_SO) FmtDateLong(t time.Time) string {
  306. b := make([]byte, 0, 32)
  307. if t.Day() < 10 {
  308. b = append(b, '0')
  309. }
  310. b = strconv.AppendInt(b, int64(t.Day()), 10)
  311. b = append(b, []byte{0x20}...)
  312. b = append(b, so.monthsWide[t.Month()]...)
  313. b = append(b, []byte{0x20}...)
  314. if t.Year() > 0 {
  315. b = strconv.AppendInt(b, int64(t.Year()), 10)
  316. } else {
  317. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  318. }
  319. return string(b)
  320. }
  321. // FmtDateFull returns the full date representation of 't' for 'so_SO'
  322. func (so *so_SO) FmtDateFull(t time.Time) string {
  323. b := make([]byte, 0, 32)
  324. b = append(b, so.daysWide[t.Weekday()]...)
  325. b = append(b, []byte{0x2c, 0x20}...)
  326. b = append(b, so.monthsWide[t.Month()]...)
  327. b = append(b, []byte{0x20}...)
  328. if t.Day() < 10 {
  329. b = append(b, '0')
  330. }
  331. b = strconv.AppendInt(b, int64(t.Day()), 10)
  332. b = append(b, []byte{0x2c, 0x20}...)
  333. if t.Year() > 0 {
  334. b = strconv.AppendInt(b, int64(t.Year()), 10)
  335. } else {
  336. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  337. }
  338. return string(b)
  339. }
  340. // FmtTimeShort returns the short time representation of 't' for 'so_SO'
  341. func (so *so_SO) FmtTimeShort(t time.Time) string {
  342. b := make([]byte, 0, 32)
  343. h := t.Hour()
  344. if h > 12 {
  345. h -= 12
  346. }
  347. b = strconv.AppendInt(b, int64(h), 10)
  348. b = append(b, so.timeSeparator...)
  349. if t.Minute() < 10 {
  350. b = append(b, '0')
  351. }
  352. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  353. b = append(b, []byte{0x20}...)
  354. if t.Hour() < 12 {
  355. b = append(b, so.periodsAbbreviated[0]...)
  356. } else {
  357. b = append(b, so.periodsAbbreviated[1]...)
  358. }
  359. return string(b)
  360. }
  361. // FmtTimeMedium returns the medium time representation of 't' for 'so_SO'
  362. func (so *so_SO) FmtTimeMedium(t time.Time) string {
  363. b := make([]byte, 0, 32)
  364. h := t.Hour()
  365. if h > 12 {
  366. h -= 12
  367. }
  368. b = strconv.AppendInt(b, int64(h), 10)
  369. b = append(b, so.timeSeparator...)
  370. if t.Minute() < 10 {
  371. b = append(b, '0')
  372. }
  373. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  374. b = append(b, so.timeSeparator...)
  375. if t.Second() < 10 {
  376. b = append(b, '0')
  377. }
  378. b = strconv.AppendInt(b, int64(t.Second()), 10)
  379. b = append(b, []byte{0x20}...)
  380. if t.Hour() < 12 {
  381. b = append(b, so.periodsAbbreviated[0]...)
  382. } else {
  383. b = append(b, so.periodsAbbreviated[1]...)
  384. }
  385. return string(b)
  386. }
  387. // FmtTimeLong returns the long time representation of 't' for 'so_SO'
  388. func (so *so_SO) FmtTimeLong(t time.Time) string {
  389. b := make([]byte, 0, 32)
  390. h := t.Hour()
  391. if h > 12 {
  392. h -= 12
  393. }
  394. b = strconv.AppendInt(b, int64(h), 10)
  395. b = append(b, so.timeSeparator...)
  396. if t.Minute() < 10 {
  397. b = append(b, '0')
  398. }
  399. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  400. b = append(b, so.timeSeparator...)
  401. if t.Second() < 10 {
  402. b = append(b, '0')
  403. }
  404. b = strconv.AppendInt(b, int64(t.Second()), 10)
  405. b = append(b, []byte{0x20}...)
  406. if t.Hour() < 12 {
  407. b = append(b, so.periodsAbbreviated[0]...)
  408. } else {
  409. b = append(b, so.periodsAbbreviated[1]...)
  410. }
  411. b = append(b, []byte{0x20}...)
  412. tz, _ := t.Zone()
  413. b = append(b, tz...)
  414. return string(b)
  415. }
  416. // FmtTimeFull returns the full time representation of 't' for 'so_SO'
  417. func (so *so_SO) FmtTimeFull(t time.Time) string {
  418. b := make([]byte, 0, 32)
  419. h := t.Hour()
  420. if h > 12 {
  421. h -= 12
  422. }
  423. b = strconv.AppendInt(b, int64(h), 10)
  424. b = append(b, so.timeSeparator...)
  425. if t.Minute() < 10 {
  426. b = append(b, '0')
  427. }
  428. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  429. b = append(b, so.timeSeparator...)
  430. if t.Second() < 10 {
  431. b = append(b, '0')
  432. }
  433. b = strconv.AppendInt(b, int64(t.Second()), 10)
  434. b = append(b, []byte{0x20}...)
  435. if t.Hour() < 12 {
  436. b = append(b, so.periodsAbbreviated[0]...)
  437. } else {
  438. b = append(b, so.periodsAbbreviated[1]...)
  439. }
  440. b = append(b, []byte{0x20}...)
  441. tz, _ := t.Zone()
  442. if btz, ok := so.timezones[tz]; ok {
  443. b = append(b, btz...)
  444. } else {
  445. b = append(b, tz...)
  446. }
  447. return string(b)
  448. }