...

Source file src/github.com/go-playground/locales/os_GE/os_GE.go

Documentation: github.com/go-playground/locales/os_GE

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

View as plain text