1package uk_UA 2 3import ( 4 "math" 5 "strconv" 6 "time" 7 8 "github.com/go-playground/locales" 9 "github.com/go-playground/locales/currency" 10) 11 12type uk_UA struct { 13 locale string 14 pluralsCardinal []locales.PluralRule 15 pluralsOrdinal []locales.PluralRule 16 pluralsRange []locales.PluralRule 17 decimal string 18 group string 19 minus string 20 percent string 21 perMille string 22 timeSeparator string 23 inifinity string 24 currencies []string // idx = enum of currency code 25 currencyNegativePrefix string 26 currencyNegativeSuffix string 27 monthsAbbreviated []string 28 monthsNarrow []string 29 monthsWide []string 30 daysAbbreviated []string 31 daysNarrow []string 32 daysShort []string 33 daysWide []string 34 periodsAbbreviated []string 35 periodsNarrow []string 36 periodsShort []string 37 periodsWide []string 38 erasAbbreviated []string 39 erasNarrow []string 40 erasWide []string 41 timezones map[string]string 42} 43 44// New returns a new instance of translator for the 'uk_UA' locale 45func New() locales.Translator { 46 return &uk_UA{ 47 locale: "uk_UA", 48 pluralsCardinal: []locales.PluralRule{2, 4, 5, 6}, 49 pluralsOrdinal: []locales.PluralRule{4, 6}, 50 pluralsRange: []locales.PluralRule{2, 4, 5, 6}, 51 decimal: ",", 52 group: " ", 53 minus: "-", 54 percent: "%", 55 perMille: "‰", 56 timeSeparator: ":", 57 inifinity: "∞", 58 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"}, 59 currencyNegativePrefix: "(", 60 currencyNegativeSuffix: ")", 61 monthsAbbreviated: []string{"", "січ.", "лют.", "бер.", "квіт.", "трав.", "черв.", "лип.", "серп.", "вер.", "жовт.", "лист.", "груд."}, 62 monthsNarrow: []string{"", "с", "л", "б", "к", "т", "ч", "л", "с", "в", "ж", "л", "г"}, 63 monthsWide: []string{"", "січня", "лютого", "березня", "квітня", "травня", "червня", "липня", "серпня", "вересня", "жовтня", "листопада", "грудня"}, 64 daysAbbreviated: []string{"нд", "пн", "вт", "ср", "чт", "пт", "сб"}, 65 daysNarrow: []string{"Н", "П", "В", "С", "Ч", "П", "С"}, 66 daysShort: []string{"нд", "пн", "вт", "ср", "чт", "пт", "сб"}, 67 daysWide: []string{"неділя", "понеділок", "вівторок", "середа", "четвер", "пʼятниця", "субота"}, 68 periodsAbbreviated: []string{"дп", "пп"}, 69 periodsNarrow: []string{"дп", "пп"}, 70 periodsWide: []string{"дп", "пп"}, 71 erasAbbreviated: []string{"до н. е.", "н. е."}, 72 erasNarrow: []string{"до н.е.", "н.е."}, 73 erasWide: []string{"до нашої ери", "нашої ери"}, 74 timezones: map[string]string{"ARST": "за літнім аргентинським часом", "WAST": "за західноафриканським літнім часом", "BOT": "за болівійським часом", "EDT": "за північноамериканським східним літнім часом", "VET": "за часом у Венесуелі", "CLT": "за стандартним чилійським часом", "HAST": "за стандартним гавайсько-алеутським часом", "EST": "за північноамериканським східним стандартним часом", "PDT": "за північноамериканським тихоокеанським літнім часом", "HEEG": "за літнім східним часом у Ґренландії", "EAT": "за східноафриканським часом", "GYT": "за часом у Ґаяні", "CST": "за північноамериканським центральним стандартним часом", "AKDT": "за літнім часом на Алясці", "ECT": "за часом в Еквадорі", "HNPM": "за стандартним часом на островах Сен-П’єр і Мікелон", "SRT": "за часом у Суринамі", "TMST": "за літнім часом у Туркменістані", "NZDT": "за літнім часом у Новій Зеландії", "WITA": "за центральноіндонезійським часом", "ACST": "за стандартним центральноавстралійським часом", "ACWDT": "за літнім центральнозахідним австралійським часом", "MESZ": "за центральноєвропейським літнім часом", "LHDT": "за літнім часом на острові Лорд-Хау", "UYST": "за літнім часом в Уруґваї", "HNCU": "за стандартним часом на Кубі", "HEPMX": "за літнім тихоокеанським часом у Мексиці", "ACWST": "за стандартним центральнозахідним австралійським часом", "LHST": "за стандартним часом на острові Лорд-Хау", "ChST": "за часом на Північних Маріанських островах", "CDT": "за північноамериканським центральним літнім часом", "UYT": "за стандартним часом в Уруґваї", "CHADT": "за літнім часом на архіпелазі Чатем", "AEDT": "за літнім східноавстралійським часом", "HKST": "за літнім часом у Гонконзі", "MST": "MST", "OESZ": "за східноєвропейським літнім часом", "∅∅∅": "за літнім часом на Амазонці", "PST": "за північноамериканським тихоокеанським стандартним часом", "AEST": "за стандартним східноавстралійським часом", "WIB": "за західноіндонезійським часом", "JDT": "за японським літнім часом", "IST": "за індійським стандартним часом", "CAT": "за центральноафриканським часом", "HADT": "за літнім гавайсько-алеутським часом", "HEPM": "за літнім часом на островах Сен-П’єр і Мікелон", "COST": "за літнім колумбійським часом", "ADT": "за атлантичним літнім часом", "SAST": "за південноафриканським часом", "WAT": "за західноафриканським стандартним часом", "BT": "за часом у Бутані", "NZST": "за стандартним часом у Новій Зеландії", "CLST": "за літнім чилійським часом", "COT": "за стандартним колумбійським часом", "JST": "за японським стандартним часом", "ACDT": "за літнім центральноавстралійським часом", "CHAST": "за стандартним часом на архіпелазі Чатем", "AWST": "за стандартним західноавстралійським часом", "HNPMX": "за стандартним тихоокеанським часом у Мексиці", "AST": "за атлантичним стандартним часом", "MYT": "за часом у Малайзії", "SGT": "за часом у Сінґапурі", "MDT": "MDT", "ART": "за стандартним аргентинським часом", "HNEG": "за стандартним східним часом у Ґренландії", "WARST": "за літнім за західноаргентинським часом", "AWDT": "за літнім західноавстралійським часом", "AKST": "за стандартним часом на Алясці", "HKT": "за стандартним часом у Гонконзі", "OEZ": "за східноєвропейським стандартним часом", "MEZ": "за центральноєвропейським стандартним часом", "WART": "за стандартним західноаргентинським часом", "HNNOMX": "за стандартним північнозахідним часом у Мексиці", "HECU": "за літнім часом на Кубі", "HEOG": "за літнім західним часом у Ґренландії", "GFT": "за часом Французької Гвіани", "HNT": "за стандартним часом на острові Ньюфаундленд", "WIT": "за східноіндонезійським часом", "WEZ": "за західноєвропейським стандартним часом", "WESZ": "за західноєвропейським літнім часом", "HNOG": "за стандартним західним часом у Ґренландії", "HAT": "за літнім часом у Ньюфаундленд", "HENOMX": "за літнім північнозахідним часом у Мексиці", "TMT": "за стандартним часом у Туркменістані", "GMT": "за Ґрінвічем"}, 75 } 76} 77 78// Locale returns the current translators string locale 79func (uk *uk_UA) Locale() string { 80 return uk.locale 81} 82 83// PluralsCardinal returns the list of cardinal plural rules associated with 'uk_UA' 84func (uk *uk_UA) PluralsCardinal() []locales.PluralRule { 85 return uk.pluralsCardinal 86} 87 88// PluralsOrdinal returns the list of ordinal plural rules associated with 'uk_UA' 89func (uk *uk_UA) PluralsOrdinal() []locales.PluralRule { 90 return uk.pluralsOrdinal 91} 92 93// PluralsRange returns the list of range plural rules associated with 'uk_UA' 94func (uk *uk_UA) PluralsRange() []locales.PluralRule { 95 return uk.pluralsRange 96} 97 98// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'uk_UA' 99func (uk *uk_UA) CardinalPluralRule(num float64, v uint64) locales.PluralRule { 100 101 n := math.Abs(num) 102 i := int64(n) 103 iMod10 := i % 10 104 iMod100 := i % 100 105 106 if v == 0 && iMod10 == 1 && iMod100 != 11 { 107 return locales.PluralRuleOne 108 } else if v == 0 && iMod10 >= 2 && iMod10 <= 4 && (iMod100 < 12 || iMod100 > 14) { 109 return locales.PluralRuleFew 110 } else if (v == 0 && iMod10 == 0) || (v == 0 && iMod10 >= 5 && iMod10 <= 9) || (v == 0 && iMod100 >= 11 && iMod100 <= 14) { 111 return locales.PluralRuleMany 112 } 113 114 return locales.PluralRuleOther 115} 116 117// OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'uk_UA' 118func (uk *uk_UA) OrdinalPluralRule(num float64, v uint64) locales.PluralRule { 119 120 n := math.Abs(num) 121 nMod10 := math.Mod(n, 10) 122 nMod100 := math.Mod(n, 100) 123 124 if nMod10 == 3 && nMod100 != 13 { 125 return locales.PluralRuleFew 126 } 127 128 return locales.PluralRuleOther 129} 130 131// RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'uk_UA' 132func (uk *uk_UA) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule { 133 134 start := uk.CardinalPluralRule(num1, v1) 135 end := uk.CardinalPluralRule(num2, v2) 136 137 if start == locales.PluralRuleOne && end == locales.PluralRuleOne { 138 return locales.PluralRuleOne 139 } else if start == locales.PluralRuleOne && end == locales.PluralRuleFew { 140 return locales.PluralRuleFew 141 } else if start == locales.PluralRuleOne && end == locales.PluralRuleMany { 142 return locales.PluralRuleMany 143 } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther { 144 return locales.PluralRuleOther 145 } else if start == locales.PluralRuleFew && end == locales.PluralRuleOne { 146 return locales.PluralRuleOne 147 } else if start == locales.PluralRuleFew && end == locales.PluralRuleFew { 148 return locales.PluralRuleFew 149 } else if start == locales.PluralRuleFew && end == locales.PluralRuleMany { 150 return locales.PluralRuleMany 151 } else if start == locales.PluralRuleFew && end == locales.PluralRuleOther { 152 return locales.PluralRuleOther 153 } else if start == locales.PluralRuleMany && end == locales.PluralRuleOne { 154 return locales.PluralRuleOne 155 } else if start == locales.PluralRuleMany && end == locales.PluralRuleFew { 156 return locales.PluralRuleFew 157 } else if start == locales.PluralRuleMany && end == locales.PluralRuleMany { 158 return locales.PluralRuleMany 159 } else if start == locales.PluralRuleMany && end == locales.PluralRuleOther { 160 return locales.PluralRuleOther 161 } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne { 162 return locales.PluralRuleOne 163 } else if start == locales.PluralRuleOther && end == locales.PluralRuleFew { 164 return locales.PluralRuleFew 165 } else if start == locales.PluralRuleOther && end == locales.PluralRuleMany { 166 return locales.PluralRuleMany 167 } 168 169 return locales.PluralRuleOther 170 171} 172 173// MonthAbbreviated returns the locales abbreviated month given the 'month' provided 174func (uk *uk_UA) MonthAbbreviated(month time.Month) string { 175 return uk.monthsAbbreviated[month] 176} 177 178// MonthsAbbreviated returns the locales abbreviated months 179func (uk *uk_UA) MonthsAbbreviated() []string { 180 return uk.monthsAbbreviated[1:] 181} 182 183// MonthNarrow returns the locales narrow month given the 'month' provided 184func (uk *uk_UA) MonthNarrow(month time.Month) string { 185 return uk.monthsNarrow[month] 186} 187 188// MonthsNarrow returns the locales narrow months 189func (uk *uk_UA) MonthsNarrow() []string { 190 return uk.monthsNarrow[1:] 191} 192 193// MonthWide returns the locales wide month given the 'month' provided 194func (uk *uk_UA) MonthWide(month time.Month) string { 195 return uk.monthsWide[month] 196} 197 198// MonthsWide returns the locales wide months 199func (uk *uk_UA) MonthsWide() []string { 200 return uk.monthsWide[1:] 201} 202 203// WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided 204func (uk *uk_UA) WeekdayAbbreviated(weekday time.Weekday) string { 205 return uk.daysAbbreviated[weekday] 206} 207 208// WeekdaysAbbreviated returns the locales abbreviated weekdays 209func (uk *uk_UA) WeekdaysAbbreviated() []string { 210 return uk.daysAbbreviated 211} 212 213// WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided 214func (uk *uk_UA) WeekdayNarrow(weekday time.Weekday) string { 215 return uk.daysNarrow[weekday] 216} 217 218// WeekdaysNarrow returns the locales narrow weekdays 219func (uk *uk_UA) WeekdaysNarrow() []string { 220 return uk.daysNarrow 221} 222 223// WeekdayShort returns the locales short weekday given the 'weekday' provided 224func (uk *uk_UA) WeekdayShort(weekday time.Weekday) string { 225 return uk.daysShort[weekday] 226} 227 228// WeekdaysShort returns the locales short weekdays 229func (uk *uk_UA) WeekdaysShort() []string { 230 return uk.daysShort 231} 232 233// WeekdayWide returns the locales wide weekday given the 'weekday' provided 234func (uk *uk_UA) WeekdayWide(weekday time.Weekday) string { 235 return uk.daysWide[weekday] 236} 237 238// WeekdaysWide returns the locales wide weekdays 239func (uk *uk_UA) WeekdaysWide() []string { 240 return uk.daysWide 241} 242 243// Decimal returns the decimal point of number 244func (uk *uk_UA) Decimal() string { 245 return uk.decimal 246} 247 248// Group returns the group of number 249func (uk *uk_UA) Group() string { 250 return uk.group 251} 252 253// Group returns the minus sign of number 254func (uk *uk_UA) Minus() string { 255 return uk.minus 256} 257 258// FmtNumber returns 'num' with digits/precision of 'v' for 'uk_UA' and handles both Whole and Real numbers based on 'v' 259func (uk *uk_UA) FmtNumber(num float64, v uint64) string { 260 261 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 262 l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3 263 count := 0 264 inWhole := v == 0 265 b := make([]byte, 0, l) 266 267 for i := len(s) - 1; i >= 0; i-- { 268 269 if s[i] == '.' { 270 b = append(b, uk.decimal[0]) 271 inWhole = true 272 continue 273 } 274 275 if inWhole { 276 if count == 3 { 277 for j := len(uk.group) - 1; j >= 0; j-- { 278 b = append(b, uk.group[j]) 279 } 280 count = 1 281 } else { 282 count++ 283 } 284 } 285 286 b = append(b, s[i]) 287 } 288 289 if num < 0 { 290 b = append(b, uk.minus[0]) 291 } 292 293 // reverse 294 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 295 b[i], b[j] = b[j], b[i] 296 } 297 298 return string(b) 299} 300 301// FmtPercent returns 'num' with digits/precision of 'v' for 'uk_UA' and handles both Whole and Real numbers based on 'v' 302// NOTE: 'num' passed into FmtPercent is assumed to be in percent already 303func (uk *uk_UA) FmtPercent(num float64, v uint64) string { 304 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 305 l := len(s) + 3 306 b := make([]byte, 0, l) 307 308 for i := len(s) - 1; i >= 0; i-- { 309 310 if s[i] == '.' { 311 b = append(b, uk.decimal[0]) 312 continue 313 } 314 315 b = append(b, s[i]) 316 } 317 318 if num < 0 { 319 b = append(b, uk.minus[0]) 320 } 321 322 // reverse 323 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 324 b[i], b[j] = b[j], b[i] 325 } 326 327 b = append(b, uk.percent...) 328 329 return string(b) 330} 331 332// FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'uk_UA' 333func (uk *uk_UA) FmtCurrency(num float64, v uint64, currency currency.Type) string { 334 335 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 336 symbol := uk.currencies[currency] 337 l := len(s) + len(symbol) + 2 + 2*len(s[:len(s)-int(v)-1])/3 338 count := 0 339 inWhole := v == 0 340 b := make([]byte, 0, l) 341 342 for i := len(s) - 1; i >= 0; i-- { 343 344 if s[i] == '.' { 345 b = append(b, uk.decimal[0]) 346 inWhole = true 347 continue 348 } 349 350 if inWhole { 351 if count == 3 { 352 for j := len(uk.group) - 1; j >= 0; j-- { 353 b = append(b, uk.group[j]) 354 } 355 count = 1 356 } else { 357 count++ 358 } 359 } 360 361 b = append(b, s[i]) 362 } 363 364 if num < 0 { 365 b = append(b, uk.minus[0]) 366 } 367 368 // reverse 369 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 370 b[i], b[j] = b[j], b[i] 371 } 372 373 if int(v) < 2 { 374 375 if v == 0 { 376 b = append(b, uk.decimal...) 377 } 378 379 for i := 0; i < 2-int(v); i++ { 380 b = append(b, '0') 381 } 382 } 383 384 b = append(b, symbol...) 385 386 return string(b) 387} 388 389// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'uk_UA' 390// in accounting notation. 391func (uk *uk_UA) FmtAccounting(num float64, v uint64, currency currency.Type) string { 392 393 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64) 394 symbol := uk.currencies[currency] 395 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3 396 count := 0 397 inWhole := v == 0 398 b := make([]byte, 0, l) 399 400 for i := len(s) - 1; i >= 0; i-- { 401 402 if s[i] == '.' { 403 b = append(b, uk.decimal[0]) 404 inWhole = true 405 continue 406 } 407 408 if inWhole { 409 if count == 3 { 410 for j := len(uk.group) - 1; j >= 0; j-- { 411 b = append(b, uk.group[j]) 412 } 413 count = 1 414 } else { 415 count++ 416 } 417 } 418 419 b = append(b, s[i]) 420 } 421 422 if num < 0 { 423 424 b = append(b, uk.currencyNegativePrefix[0]) 425 426 } 427 428 // reverse 429 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 { 430 b[i], b[j] = b[j], b[i] 431 } 432 433 if int(v) < 2 { 434 435 if v == 0 { 436 b = append(b, uk.decimal...) 437 } 438 439 for i := 0; i < 2-int(v); i++ { 440 b = append(b, '0') 441 } 442 } 443 444 if num < 0 { 445 b = append(b, uk.currencyNegativeSuffix...) 446 b = append(b, symbol...) 447 } else { 448 449 b = append(b, symbol...) 450 } 451 452 return string(b) 453} 454 455// FmtDateShort returns the short date representation of 't' for 'uk_UA' 456func (uk *uk_UA) FmtDateShort(t time.Time) string { 457 458 b := make([]byte, 0, 32) 459 460 if t.Day() < 10 { 461 b = append(b, '0') 462 } 463 464 b = strconv.AppendInt(b, int64(t.Day()), 10) 465 b = append(b, []byte{0x2e}...) 466 467 if t.Month() < 10 { 468 b = append(b, '0') 469 } 470 471 b = strconv.AppendInt(b, int64(t.Month()), 10) 472 473 b = append(b, []byte{0x2e}...) 474 475 if t.Year() > 9 { 476 b = append(b, strconv.Itoa(t.Year())[2:]...) 477 } else { 478 b = append(b, strconv.Itoa(t.Year())[1:]...) 479 } 480 481 return string(b) 482} 483 484// FmtDateMedium returns the medium date representation of 't' for 'uk_UA' 485func (uk *uk_UA) FmtDateMedium(t time.Time) string { 486 487 b := make([]byte, 0, 32) 488 489 b = strconv.AppendInt(b, int64(t.Day()), 10) 490 b = append(b, []byte{0x20}...) 491 b = append(b, uk.monthsAbbreviated[t.Month()]...) 492 b = append(b, []byte{0x20}...) 493 494 if t.Year() > 0 { 495 b = strconv.AppendInt(b, int64(t.Year()), 10) 496 } else { 497 b = strconv.AppendInt(b, int64(-t.Year()), 10) 498 } 499 500 b = append(b, []byte{0x20, 0xd1, 0x80}...) 501 b = append(b, []byte{0x2e}...) 502 503 return string(b) 504} 505 506// FmtDateLong returns the long date representation of 't' for 'uk_UA' 507func (uk *uk_UA) FmtDateLong(t time.Time) string { 508 509 b := make([]byte, 0, 32) 510 511 b = strconv.AppendInt(b, int64(t.Day()), 10) 512 b = append(b, []byte{0x20}...) 513 b = append(b, uk.monthsWide[t.Month()]...) 514 b = append(b, []byte{0x20}...) 515 516 if t.Year() > 0 { 517 b = strconv.AppendInt(b, int64(t.Year()), 10) 518 } else { 519 b = strconv.AppendInt(b, int64(-t.Year()), 10) 520 } 521 522 b = append(b, []byte{0x20, 0xd1, 0x80}...) 523 b = append(b, []byte{0x2e}...) 524 525 return string(b) 526} 527 528// FmtDateFull returns the full date representation of 't' for 'uk_UA' 529func (uk *uk_UA) FmtDateFull(t time.Time) string { 530 531 b := make([]byte, 0, 32) 532 533 b = append(b, uk.daysWide[t.Weekday()]...) 534 b = append(b, []byte{0x2c, 0x20}...) 535 b = strconv.AppendInt(b, int64(t.Day()), 10) 536 b = append(b, []byte{0x20}...) 537 b = append(b, uk.monthsWide[t.Month()]...) 538 b = append(b, []byte{0x20}...) 539 540 if t.Year() > 0 { 541 b = strconv.AppendInt(b, int64(t.Year()), 10) 542 } else { 543 b = strconv.AppendInt(b, int64(-t.Year()), 10) 544 } 545 546 b = append(b, []byte{0x20, 0xd1, 0x80}...) 547 b = append(b, []byte{0x2e}...) 548 549 return string(b) 550} 551 552// FmtTimeShort returns the short time representation of 't' for 'uk_UA' 553func (uk *uk_UA) FmtTimeShort(t time.Time) string { 554 555 b := make([]byte, 0, 32) 556 557 if t.Hour() < 10 { 558 b = append(b, '0') 559 } 560 561 b = strconv.AppendInt(b, int64(t.Hour()), 10) 562 b = append(b, uk.timeSeparator...) 563 564 if t.Minute() < 10 { 565 b = append(b, '0') 566 } 567 568 b = strconv.AppendInt(b, int64(t.Minute()), 10) 569 570 return string(b) 571} 572 573// FmtTimeMedium returns the medium time representation of 't' for 'uk_UA' 574func (uk *uk_UA) FmtTimeMedium(t time.Time) string { 575 576 b := make([]byte, 0, 32) 577 578 if t.Hour() < 10 { 579 b = append(b, '0') 580 } 581 582 b = strconv.AppendInt(b, int64(t.Hour()), 10) 583 b = append(b, uk.timeSeparator...) 584 585 if t.Minute() < 10 { 586 b = append(b, '0') 587 } 588 589 b = strconv.AppendInt(b, int64(t.Minute()), 10) 590 b = append(b, uk.timeSeparator...) 591 592 if t.Second() < 10 { 593 b = append(b, '0') 594 } 595 596 b = strconv.AppendInt(b, int64(t.Second()), 10) 597 598 return string(b) 599} 600 601// FmtTimeLong returns the long time representation of 't' for 'uk_UA' 602func (uk *uk_UA) FmtTimeLong(t time.Time) string { 603 604 b := make([]byte, 0, 32) 605 606 if t.Hour() < 10 { 607 b = append(b, '0') 608 } 609 610 b = strconv.AppendInt(b, int64(t.Hour()), 10) 611 b = append(b, uk.timeSeparator...) 612 613 if t.Minute() < 10 { 614 b = append(b, '0') 615 } 616 617 b = strconv.AppendInt(b, int64(t.Minute()), 10) 618 b = append(b, uk.timeSeparator...) 619 620 if t.Second() < 10 { 621 b = append(b, '0') 622 } 623 624 b = strconv.AppendInt(b, int64(t.Second()), 10) 625 b = append(b, []byte{0x20}...) 626 627 tz, _ := t.Zone() 628 b = append(b, tz...) 629 630 return string(b) 631} 632 633// FmtTimeFull returns the full time representation of 't' for 'uk_UA' 634func (uk *uk_UA) FmtTimeFull(t time.Time) string { 635 636 b := make([]byte, 0, 32) 637 638 if t.Hour() < 10 { 639 b = append(b, '0') 640 } 641 642 b = strconv.AppendInt(b, int64(t.Hour()), 10) 643 b = append(b, uk.timeSeparator...) 644 645 if t.Minute() < 10 { 646 b = append(b, '0') 647 } 648 649 b = strconv.AppendInt(b, int64(t.Minute()), 10) 650 b = append(b, uk.timeSeparator...) 651 652 if t.Second() < 10 { 653 b = append(b, '0') 654 } 655 656 b = strconv.AppendInt(b, int64(t.Second()), 10) 657 b = append(b, []byte{0x20}...) 658 659 tz, _ := t.Zone() 660 661 if btz, ok := uk.timezones[tz]; ok { 662 b = append(b, btz...) 663 } else { 664 b = append(b, tz...) 665 } 666 667 return string(b) 668} 669