el_CY.go 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. package el_CY
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type el_CY 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. currencyNegativeSuffix 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 'el_CY' locale
  41. func New() locales.Translator {
  42. return &el_CY{
  43. locale: "el_CY",
  44. pluralsCardinal: []locales.PluralRule{2, 6},
  45. pluralsOrdinal: []locales.PluralRule{6},
  46. pluralsRange: []locales.PluralRule{2, 6},
  47. decimal: ",",
  48. group: ".",
  49. minus: "-",
  50. percent: "%",
  51. perMille: "‰",
  52. timeSeparator: ":",
  53. inifinity: "∞",
  54. currencies: []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "AUD", "AWG", "AZM", "AZN", "BAD", "BAM", "BAN", "BBD", "BDT", "BEC", "BEF", "BEL", "BGL", "BGM", "BGN", "BGO", "BHD", "BIF", "BMD", "BND", "BOB", "BOL", "BOP", "BOV", "BRB", "BRC", "BRE", "BRL", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNH", "CNX", "CNY", "COP", "COU", "CRC", "CSD", "CSK", "CUC", "CUP", "CVE", "CYP", "CZK", "DDM", "DEM", "DJF", "DKK", "DOP", "DZD", "ECS", "ECV", "EEK", "EGP", "ERN", "ESA", "ESB", "ESP", "ETB", "EUR", "FIM", "FJD", "FKP", "FRF", "GBP", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HKD", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "ILS", "INR", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LTT", "LUC", "LUF", "LUL", "LVL", "LVR", "LYD", "MAD", "MAF", "MCF", "MDC", "MDL", "MGA", "MGF", "MKD", "MKN", "MLF", "MMK", "MNT", "MOP", "MRO", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "MXN", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZD", "OMR", "PAB", "PEI", "PEN", "PES", "PGK", "PHP", "PKR", "PLN", "PLZ", "PTE", "PYG", "QAR", "RHD", "ROL", "RON", "RSD", "RUB", "RUR", "RWF", "SAR", "SBD", "SCR", "SDD", "SDG", "SDP", "SEK", "SGD", "SHP", "SIT", "SKK", "SLL", "SOS", "SRD", "SRG", "SSP", "STD", "STN", "SUR", "SVC", "SYP", "SZL", "THB", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "TWD", "TZS", "UAH", "UAK", "UGS", "UGX", "USD", "USN", "USS", "UYI", "UYP", "UYU", "UZS", "VEB", "VEF", "VND", "VNN", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XEU", "XFO", "XFU", "XOF", "XPD", "XPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
  55. currencyPositiveSuffix: " ",
  56. currencyNegativeSuffix: " ",
  57. monthsAbbreviated: []string{"", "Ιαν", "Φεβ", "Μαρ", "Απρ", "Μαΐ", "Ιουν", "Ιουλ", "Αυγ", "Σεπ", "Οκτ", "Νοε", "Δεκ"},
  58. monthsNarrow: []string{"", "Ι", "Φ", "Μ", "Α", "Μ", "Ι", "Ι", "Α", "Σ", "Ο", "Ν", "Δ"},
  59. monthsWide: []string{"", "Ιανουαρίου", "Φεβρουαρίου", "Μαρτίου", "Απριλίου", "Μαΐου", "Ιουνίου", "Ιουλίου", "Αυγούστου", "Σεπτεμβρίου", "Οκτωβρίου", "Νοεμβρίου", "Δεκεμβρίου"},
  60. daysAbbreviated: []string{"Κυρ", "Δευ", "Τρί", "Τετ", "Πέμ", "Παρ", "Σάβ"},
  61. daysNarrow: []string{"Κ", "Δ", "Τ", "Τ", "Π", "Π", "Σ"},
  62. daysShort: []string{"Κυ", "Δε", "Τρ", "Τε", "Πέ", "Πα", "Σά"},
  63. daysWide: []string{"Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"},
  64. periodsAbbreviated: []string{"π.μ.", "μ.μ."},
  65. periodsNarrow: []string{"πμ", "μμ"},
  66. periodsWide: []string{"π.μ.", "μ.μ."},
  67. erasAbbreviated: []string{"π.Χ.", "μ.Χ."},
  68. erasNarrow: []string{"", ""},
  69. erasWide: []string{"προ Χριστού", "μετά Χριστόν"},
  70. timezones: map[string]string{"GYT": "Ώρα Γουιάνας", "GMT": "Μέση ώρα Γκρίνουιτς", "AEST": "Χειμερινή ώρα Ανατολικής Αυστραλίας", "WIB": "Ώρα Δυτικής Ινδονησίας", "MESZ": "Θερινή ώρα Κεντρικής Ευρώπης", "IST": "Ώρα Ινδίας", "SRT": "Ώρα Σουρινάμ", "ChST": "Ώρα Τσαμόρο", "PDT": "Θερινή ώρα Ειρηνικού", "HEPMX": "Θερινή ώρα Ειρηνικού Μεξικού", "CDT": "Κεντρική θερινή ώρα Βόρειας Αμερικής", "JST": "Χειμερινή ώρα Ιαπωνίας", "HNPM": "Χειμερινή ώρα Σεν Πιερ και Μικελόν", "CHAST": "Χειμερινή ώρα Τσάταμ", "SAST": "Χειμερινή ώρα Νότιας Αφρικής", "JDT": "Θερινή ώρα Ιαπωνίας", "HNEG": "Χειμερινή ώρα Ανατολικής Γροιλανδίας", "EDT": "Ανατολική θερινή ώρα Βόρειας Αμερικής", "HNNOMX": "Χειμερινή ώρα Βορειοδυτικού Μεξικού", "HADT": "Θερινή ώρα Χαβάης-Αλεούτιων Νήσων", "AST": "Χειμερινή ώρα Ατλαντικού", "ACST": "Χειμερινή ώρα Κεντρικής Αυστραλίας", "VET": "Ώρα Βενεζουέλας", "SGT": "Ώρα Σιγκαπούρης", "HKT": "Χειμερινή ώρα Χονγκ Κονγκ", "HAST": "Χειμερινή ώρα Χαβάης-Αλεούτιων Νήσων", "∅∅∅": "Θερινή ώρα Αμαζονίου", "AWDT": "Θερινή ώρα Δυτικής Αυστραλίας", "ADT": "Θερινή ώρα Ατλαντικού", "COST": "Θερινή ώρα Κολομβίας", "WEZ": "Χειμερινή ώρα Δυτικής Ευρώπης", "BOT": "Ώρα Βολιβίας", "HEEG": "Θερινή ώρα Ανατολικής Γροιλανδίας", "HKST": "Θερινή ώρα Χονγκ Κονγκ", "LHST": "Χειμερινή ώρα Λορντ Χάου", "HNT": "Χειμερινή ώρα Νέας Γης", "HAT": "Θερινή ώρα Νέας Γης", "HENOMX": "Θερινή ώρα Βορειοδυτικού Μεξικού", "TMT": "Χειμερινή ώρα Τουρκμενιστάν", "ART": "Χειμερινή ώρα Αργεντινής", "UYST": "Θερινή ώρα Ουρουγουάης", "HNOG": "Χειμερινή ώρα Δυτικής Γροιλανδίας", "EST": "Ανατολική χειμερινή ώρα Βόρειας Αμερικής", "WAST": "Θερινή ώρα Δυτικής Αφρικής", "AKST": "Χειμερινή ώρα Αλάσκας", "CLST": "Θερινή ώρα Χιλής", "WIT": "Ώρα Ανατολικής Ινδονησίας", "ARST": "Θερινή ώρα Αργεντινής", "HNCU": "Χειμερινή ώρα Κούβας", "HNPMX": "Χειμερινή ώρα Ειρηνικού Μεξικού", "AKDT": "Θερινή ώρα Αλάσκας", "MEZ": "Χειμερινή ώρα Κεντρικής Ευρώπης", "WITA": "Ώρα Κεντρικής Ινδονησίας", "COT": "Χειμερινή ώρα Κολομβίας", "GFT": "Ώρα Γαλλικής Γουιάνας", "ACDT": "Θερινή ώρα Κεντρικής Αυστραλίας", "HEOG": "Θερινή ώρα Δυτικής Γροιλανδίας", "OESZ": "Θερινή ώρα Ανατολικής Ευρώπης", "UYT": "Χειμερινή ώρα Ουρουγουάης", "WAT": "Χειμερινή ώρα Δυτικής Αφρικής", "LHDT": "Θερινή ώρα Λορντ Χάου", "CST": "Κεντρική χειμερινή ώρα Βόρειας Αμερικής", "WESZ": "Θερινή ώρα Δυτικής Ευρώπης", "ACWDT": "Θερινή ώρα Κεντροδυτικής Αυστραλίας", "WARST": "Θερινή ώρα Δυτικής Αργεντινής", "MST": "Χειμερινή ώρα Μακάο", "MDT": "Θερινή ώρα Μακάο", "TMST": "Θερινή ώρα Τουρκμενιστάν", "CHADT": "Θερινή ώρα Τσάταμ", "AEDT": "Θερινή ώρα Ανατολικής Αυστραλίας", "BT": "Ώρα Μπουτάν", "ACWST": "Χειμερινή ώρα Κεντροδυτικής Αυστραλίας", "CAT": "Ώρα Κεντρικής Αφρικής", "OEZ": "Χειμερινή ώρα Ανατολικής Ευρώπης", "AWST": "Χειμερινή ώρα Δυτικής Αυστραλίας", "NZDT": "Θερινή ώρα Νέας Ζηλανδίας", "MYT": "Ώρα Μαλαισίας", "ECT": "Ώρα Ισημερινού", "EAT": "Ώρα Ανατολικής Αφρικής", "CLT": "Χειμερινή ώρα Χιλής", "HECU": "Θερινή ώρα Κούβας", "PST": "Χειμερινή ώρα Ειρηνικού", "NZST": "Χειμερινή ώρα Νέας Ζηλανδίας", "WART": "Χειμερινή ώρα Δυτικής Αργεντινής", "HEPM": "Θερινή ώρα Σεν Πιερ και Μικελόν"},
  71. }
  72. }
  73. // Locale returns the current translators string locale
  74. func (el *el_CY) Locale() string {
  75. return el.locale
  76. }
  77. // PluralsCardinal returns the list of cardinal plural rules associated with 'el_CY'
  78. func (el *el_CY) PluralsCardinal() []locales.PluralRule {
  79. return el.pluralsCardinal
  80. }
  81. // PluralsOrdinal returns the list of ordinal plural rules associated with 'el_CY'
  82. func (el *el_CY) PluralsOrdinal() []locales.PluralRule {
  83. return el.pluralsOrdinal
  84. }
  85. // PluralsRange returns the list of range plural rules associated with 'el_CY'
  86. func (el *el_CY) PluralsRange() []locales.PluralRule {
  87. return el.pluralsRange
  88. }
  89. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'el_CY'
  90. func (el *el_CY) 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 'el_CY'
  98. func (el *el_CY) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  99. return locales.PluralRuleOther
  100. }
  101. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'el_CY'
  102. func (el *el_CY) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  103. start := el.CardinalPluralRule(num1, v1)
  104. end := el.CardinalPluralRule(num2, v2)
  105. if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  106. return locales.PluralRuleOther
  107. } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
  108. return locales.PluralRuleOne
  109. }
  110. return locales.PluralRuleOther
  111. }
  112. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  113. func (el *el_CY) MonthAbbreviated(month time.Month) string {
  114. return el.monthsAbbreviated[month]
  115. }
  116. // MonthsAbbreviated returns the locales abbreviated months
  117. func (el *el_CY) MonthsAbbreviated() []string {
  118. return el.monthsAbbreviated[1:]
  119. }
  120. // MonthNarrow returns the locales narrow month given the 'month' provided
  121. func (el *el_CY) MonthNarrow(month time.Month) string {
  122. return el.monthsNarrow[month]
  123. }
  124. // MonthsNarrow returns the locales narrow months
  125. func (el *el_CY) MonthsNarrow() []string {
  126. return el.monthsNarrow[1:]
  127. }
  128. // MonthWide returns the locales wide month given the 'month' provided
  129. func (el *el_CY) MonthWide(month time.Month) string {
  130. return el.monthsWide[month]
  131. }
  132. // MonthsWide returns the locales wide months
  133. func (el *el_CY) MonthsWide() []string {
  134. return el.monthsWide[1:]
  135. }
  136. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  137. func (el *el_CY) WeekdayAbbreviated(weekday time.Weekday) string {
  138. return el.daysAbbreviated[weekday]
  139. }
  140. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  141. func (el *el_CY) WeekdaysAbbreviated() []string {
  142. return el.daysAbbreviated
  143. }
  144. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  145. func (el *el_CY) WeekdayNarrow(weekday time.Weekday) string {
  146. return el.daysNarrow[weekday]
  147. }
  148. // WeekdaysNarrow returns the locales narrow weekdays
  149. func (el *el_CY) WeekdaysNarrow() []string {
  150. return el.daysNarrow
  151. }
  152. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  153. func (el *el_CY) WeekdayShort(weekday time.Weekday) string {
  154. return el.daysShort[weekday]
  155. }
  156. // WeekdaysShort returns the locales short weekdays
  157. func (el *el_CY) WeekdaysShort() []string {
  158. return el.daysShort
  159. }
  160. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  161. func (el *el_CY) WeekdayWide(weekday time.Weekday) string {
  162. return el.daysWide[weekday]
  163. }
  164. // WeekdaysWide returns the locales wide weekdays
  165. func (el *el_CY) WeekdaysWide() []string {
  166. return el.daysWide
  167. }
  168. // Decimal returns the decimal point of number
  169. func (el *el_CY) Decimal() string {
  170. return el.decimal
  171. }
  172. // Group returns the group of number
  173. func (el *el_CY) Group() string {
  174. return el.group
  175. }
  176. // Group returns the minus sign of number
  177. func (el *el_CY) Minus() string {
  178. return el.minus
  179. }
  180. // FmtNumber returns 'num' with digits/precision of 'v' for 'el_CY' and handles both Whole and Real numbers based on 'v'
  181. func (el *el_CY) FmtNumber(num float64, v uint64) string {
  182. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  183. l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  184. count := 0
  185. inWhole := v == 0
  186. b := make([]byte, 0, l)
  187. for i := len(s) - 1; i >= 0; i-- {
  188. if s[i] == '.' {
  189. b = append(b, el.decimal[0])
  190. inWhole = true
  191. continue
  192. }
  193. if inWhole {
  194. if count == 3 {
  195. b = append(b, el.group[0])
  196. count = 1
  197. } else {
  198. count++
  199. }
  200. }
  201. b = append(b, s[i])
  202. }
  203. if num < 0 {
  204. b = append(b, el.minus[0])
  205. }
  206. // reverse
  207. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  208. b[i], b[j] = b[j], b[i]
  209. }
  210. return string(b)
  211. }
  212. // FmtPercent returns 'num' with digits/precision of 'v' for 'el_CY' and handles both Whole and Real numbers based on 'v'
  213. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  214. func (el *el_CY) FmtPercent(num float64, v uint64) string {
  215. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  216. l := len(s) + 3
  217. b := make([]byte, 0, l)
  218. for i := len(s) - 1; i >= 0; i-- {
  219. if s[i] == '.' {
  220. b = append(b, el.decimal[0])
  221. continue
  222. }
  223. b = append(b, s[i])
  224. }
  225. if num < 0 {
  226. b = append(b, el.minus[0])
  227. }
  228. // reverse
  229. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  230. b[i], b[j] = b[j], b[i]
  231. }
  232. b = append(b, el.percent...)
  233. return string(b)
  234. }
  235. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'el_CY'
  236. func (el *el_CY) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  237. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  238. symbol := el.currencies[currency]
  239. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  240. count := 0
  241. inWhole := v == 0
  242. b := make([]byte, 0, l)
  243. for i := len(s) - 1; i >= 0; i-- {
  244. if s[i] == '.' {
  245. b = append(b, el.decimal[0])
  246. inWhole = true
  247. continue
  248. }
  249. if inWhole {
  250. if count == 3 {
  251. b = append(b, el.group[0])
  252. count = 1
  253. } else {
  254. count++
  255. }
  256. }
  257. b = append(b, s[i])
  258. }
  259. if num < 0 {
  260. b = append(b, el.minus[0])
  261. }
  262. // reverse
  263. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  264. b[i], b[j] = b[j], b[i]
  265. }
  266. if int(v) < 2 {
  267. if v == 0 {
  268. b = append(b, el.decimal...)
  269. }
  270. for i := 0; i < 2-int(v); i++ {
  271. b = append(b, '0')
  272. }
  273. }
  274. b = append(b, el.currencyPositiveSuffix...)
  275. b = append(b, symbol...)
  276. return string(b)
  277. }
  278. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'el_CY'
  279. // in accounting notation.
  280. func (el *el_CY) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  281. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  282. symbol := el.currencies[currency]
  283. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  284. count := 0
  285. inWhole := v == 0
  286. b := make([]byte, 0, l)
  287. for i := len(s) - 1; i >= 0; i-- {
  288. if s[i] == '.' {
  289. b = append(b, el.decimal[0])
  290. inWhole = true
  291. continue
  292. }
  293. if inWhole {
  294. if count == 3 {
  295. b = append(b, el.group[0])
  296. count = 1
  297. } else {
  298. count++
  299. }
  300. }
  301. b = append(b, s[i])
  302. }
  303. if num < 0 {
  304. b = append(b, el.minus[0])
  305. }
  306. // reverse
  307. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  308. b[i], b[j] = b[j], b[i]
  309. }
  310. if int(v) < 2 {
  311. if v == 0 {
  312. b = append(b, el.decimal...)
  313. }
  314. for i := 0; i < 2-int(v); i++ {
  315. b = append(b, '0')
  316. }
  317. }
  318. if num < 0 {
  319. b = append(b, el.currencyNegativeSuffix...)
  320. b = append(b, symbol...)
  321. } else {
  322. b = append(b, el.currencyPositiveSuffix...)
  323. b = append(b, symbol...)
  324. }
  325. return string(b)
  326. }
  327. // FmtDateShort returns the short date representation of 't' for 'el_CY'
  328. func (el *el_CY) FmtDateShort(t time.Time) string {
  329. b := make([]byte, 0, 32)
  330. b = strconv.AppendInt(b, int64(t.Day()), 10)
  331. b = append(b, []byte{0x2f}...)
  332. b = strconv.AppendInt(b, int64(t.Month()), 10)
  333. b = append(b, []byte{0x2f}...)
  334. if t.Year() > 9 {
  335. b = append(b, strconv.Itoa(t.Year())[2:]...)
  336. } else {
  337. b = append(b, strconv.Itoa(t.Year())[1:]...)
  338. }
  339. return string(b)
  340. }
  341. // FmtDateMedium returns the medium date representation of 't' for 'el_CY'
  342. func (el *el_CY) FmtDateMedium(t time.Time) string {
  343. b := make([]byte, 0, 32)
  344. b = strconv.AppendInt(b, int64(t.Day()), 10)
  345. b = append(b, []byte{0x20}...)
  346. b = append(b, el.monthsAbbreviated[t.Month()]...)
  347. b = append(b, []byte{0x20}...)
  348. if t.Year() > 0 {
  349. b = strconv.AppendInt(b, int64(t.Year()), 10)
  350. } else {
  351. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  352. }
  353. return string(b)
  354. }
  355. // FmtDateLong returns the long date representation of 't' for 'el_CY'
  356. func (el *el_CY) FmtDateLong(t time.Time) string {
  357. b := make([]byte, 0, 32)
  358. b = strconv.AppendInt(b, int64(t.Day()), 10)
  359. b = append(b, []byte{0x20}...)
  360. b = append(b, el.monthsWide[t.Month()]...)
  361. b = append(b, []byte{0x20}...)
  362. if t.Year() > 0 {
  363. b = strconv.AppendInt(b, int64(t.Year()), 10)
  364. } else {
  365. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  366. }
  367. return string(b)
  368. }
  369. // FmtDateFull returns the full date representation of 't' for 'el_CY'
  370. func (el *el_CY) FmtDateFull(t time.Time) string {
  371. b := make([]byte, 0, 32)
  372. b = append(b, el.daysWide[t.Weekday()]...)
  373. b = append(b, []byte{0x2c, 0x20}...)
  374. b = strconv.AppendInt(b, int64(t.Day()), 10)
  375. b = append(b, []byte{0x20}...)
  376. b = append(b, el.monthsWide[t.Month()]...)
  377. b = append(b, []byte{0x20}...)
  378. if t.Year() > 0 {
  379. b = strconv.AppendInt(b, int64(t.Year()), 10)
  380. } else {
  381. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  382. }
  383. return string(b)
  384. }
  385. // FmtTimeShort returns the short time representation of 't' for 'el_CY'
  386. func (el *el_CY) FmtTimeShort(t time.Time) string {
  387. b := make([]byte, 0, 32)
  388. h := t.Hour()
  389. if h > 12 {
  390. h -= 12
  391. }
  392. b = strconv.AppendInt(b, int64(h), 10)
  393. b = append(b, el.timeSeparator...)
  394. if t.Minute() < 10 {
  395. b = append(b, '0')
  396. }
  397. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  398. b = append(b, []byte{0x20}...)
  399. if t.Hour() < 12 {
  400. b = append(b, el.periodsAbbreviated[0]...)
  401. } else {
  402. b = append(b, el.periodsAbbreviated[1]...)
  403. }
  404. return string(b)
  405. }
  406. // FmtTimeMedium returns the medium time representation of 't' for 'el_CY'
  407. func (el *el_CY) FmtTimeMedium(t time.Time) string {
  408. b := make([]byte, 0, 32)
  409. h := t.Hour()
  410. if h > 12 {
  411. h -= 12
  412. }
  413. b = strconv.AppendInt(b, int64(h), 10)
  414. b = append(b, el.timeSeparator...)
  415. if t.Minute() < 10 {
  416. b = append(b, '0')
  417. }
  418. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  419. b = append(b, el.timeSeparator...)
  420. if t.Second() < 10 {
  421. b = append(b, '0')
  422. }
  423. b = strconv.AppendInt(b, int64(t.Second()), 10)
  424. b = append(b, []byte{0x20}...)
  425. if t.Hour() < 12 {
  426. b = append(b, el.periodsAbbreviated[0]...)
  427. } else {
  428. b = append(b, el.periodsAbbreviated[1]...)
  429. }
  430. return string(b)
  431. }
  432. // FmtTimeLong returns the long time representation of 't' for 'el_CY'
  433. func (el *el_CY) FmtTimeLong(t time.Time) string {
  434. b := make([]byte, 0, 32)
  435. h := t.Hour()
  436. if h > 12 {
  437. h -= 12
  438. }
  439. b = strconv.AppendInt(b, int64(h), 10)
  440. b = append(b, el.timeSeparator...)
  441. if t.Minute() < 10 {
  442. b = append(b, '0')
  443. }
  444. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  445. b = append(b, el.timeSeparator...)
  446. if t.Second() < 10 {
  447. b = append(b, '0')
  448. }
  449. b = strconv.AppendInt(b, int64(t.Second()), 10)
  450. b = append(b, []byte{0x20}...)
  451. if t.Hour() < 12 {
  452. b = append(b, el.periodsAbbreviated[0]...)
  453. } else {
  454. b = append(b, el.periodsAbbreviated[1]...)
  455. }
  456. b = append(b, []byte{0x20}...)
  457. tz, _ := t.Zone()
  458. b = append(b, tz...)
  459. return string(b)
  460. }
  461. // FmtTimeFull returns the full time representation of 't' for 'el_CY'
  462. func (el *el_CY) FmtTimeFull(t time.Time) string {
  463. b := make([]byte, 0, 32)
  464. h := t.Hour()
  465. if h > 12 {
  466. h -= 12
  467. }
  468. b = strconv.AppendInt(b, int64(h), 10)
  469. b = append(b, el.timeSeparator...)
  470. if t.Minute() < 10 {
  471. b = append(b, '0')
  472. }
  473. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  474. b = append(b, el.timeSeparator...)
  475. if t.Second() < 10 {
  476. b = append(b, '0')
  477. }
  478. b = strconv.AppendInt(b, int64(t.Second()), 10)
  479. b = append(b, []byte{0x20}...)
  480. if t.Hour() < 12 {
  481. b = append(b, el.periodsAbbreviated[0]...)
  482. } else {
  483. b = append(b, el.periodsAbbreviated[1]...)
  484. }
  485. b = append(b, []byte{0x20}...)
  486. tz, _ := t.Zone()
  487. if btz, ok := el.timezones[tz]; ok {
  488. b = append(b, btz...)
  489. } else {
  490. b = append(b, tz...)
  491. }
  492. return string(b)
  493. }