...

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

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

     1  package lg
     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 lg 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  	monthsAbbreviated  []string
    26  	monthsNarrow       []string
    27  	monthsWide         []string
    28  	daysAbbreviated    []string
    29  	daysNarrow         []string
    30  	daysShort          []string
    31  	daysWide           []string
    32  	periodsAbbreviated []string
    33  	periodsNarrow      []string
    34  	periodsShort       []string
    35  	periodsWide        []string
    36  	erasAbbreviated    []string
    37  	erasNarrow         []string
    38  	erasWide           []string
    39  	timezones          map[string]string
    40  }
    41  
    42  // New returns a new instance of translator for the 'lg' locale
    43  func New() locales.Translator {
    44  	return &lg{
    45  		locale:            "lg",
    46  		pluralsCardinal:   []locales.PluralRule{2, 6},
    47  		pluralsOrdinal:    nil,
    48  		pluralsRange:      nil,
    49  		timeSeparator:     ":",
    50  		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", "USh", "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"},
    51  		monthsAbbreviated: []string{"", "Jan", "Feb", "Mar", "Apu", "Maa", "Juu", "Jul", "Agu", "Seb", "Oki", "Nov", "Des"},
    52  		monthsNarrow:      []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
    53  		monthsWide:        []string{"", "Janwaliyo", "Febwaliyo", "Marisi", "Apuli", "Maayi", "Juuni", "Julaayi", "Agusito", "Sebuttemba", "Okitobba", "Novemba", "Desemba"},
    54  		daysAbbreviated:   []string{"Sab", "Bal", "Lw2", "Lw3", "Lw4", "Lw5", "Lw6"},
    55  		daysNarrow:        []string{"S", "B", "L", "L", "L", "L", "L"},
    56  		daysWide:          []string{"Sabbiiti", "Balaza", "Lwakubiri", "Lwakusatu", "Lwakuna", "Lwakutaano", "Lwamukaaga"},
    57  		erasAbbreviated:   []string{"BC", "AD"},
    58  		erasNarrow:        []string{"", ""},
    59  		erasWide:          []string{"Kulisito nga tannaza", "Bukya Kulisito Azaal"},
    60  		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": "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": "MESZ", "MEZ": "MEZ", "MST": "MST", "MYT": "MYT", "NZDT": "NZDT", "NZST": "NZST", "OESZ": "OESZ", "OEZ": "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": "WESZ", "WEZ": "WEZ", "WIB": "WIB", "WIT": "WIT", "WITA": "WITA", "∅∅∅": "∅∅∅"},
    61  	}
    62  }
    63  
    64  // Locale returns the current translators string locale
    65  func (lg *lg) Locale() string {
    66  	return lg.locale
    67  }
    68  
    69  // PluralsCardinal returns the list of cardinal plural rules associated with 'lg'
    70  func (lg *lg) PluralsCardinal() []locales.PluralRule {
    71  	return lg.pluralsCardinal
    72  }
    73  
    74  // PluralsOrdinal returns the list of ordinal plural rules associated with 'lg'
    75  func (lg *lg) PluralsOrdinal() []locales.PluralRule {
    76  	return lg.pluralsOrdinal
    77  }
    78  
    79  // PluralsRange returns the list of range plural rules associated with 'lg'
    80  func (lg *lg) PluralsRange() []locales.PluralRule {
    81  	return lg.pluralsRange
    82  }
    83  
    84  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'lg'
    85  func (lg *lg) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
    86  
    87  	n := math.Abs(num)
    88  
    89  	if n == 1 {
    90  		return locales.PluralRuleOne
    91  	}
    92  
    93  	return locales.PluralRuleOther
    94  }
    95  
    96  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'lg'
    97  func (lg *lg) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
    98  	return locales.PluralRuleUnknown
    99  }
   100  
   101  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'lg'
   102  func (lg *lg) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   103  	return locales.PluralRuleUnknown
   104  }
   105  
   106  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   107  func (lg *lg) MonthAbbreviated(month time.Month) string {
   108  	return lg.monthsAbbreviated[month]
   109  }
   110  
   111  // MonthsAbbreviated returns the locales abbreviated months
   112  func (lg *lg) MonthsAbbreviated() []string {
   113  	return lg.monthsAbbreviated[1:]
   114  }
   115  
   116  // MonthNarrow returns the locales narrow month given the 'month' provided
   117  func (lg *lg) MonthNarrow(month time.Month) string {
   118  	return lg.monthsNarrow[month]
   119  }
   120  
   121  // MonthsNarrow returns the locales narrow months
   122  func (lg *lg) MonthsNarrow() []string {
   123  	return lg.monthsNarrow[1:]
   124  }
   125  
   126  // MonthWide returns the locales wide month given the 'month' provided
   127  func (lg *lg) MonthWide(month time.Month) string {
   128  	return lg.monthsWide[month]
   129  }
   130  
   131  // MonthsWide returns the locales wide months
   132  func (lg *lg) MonthsWide() []string {
   133  	return lg.monthsWide[1:]
   134  }
   135  
   136  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   137  func (lg *lg) WeekdayAbbreviated(weekday time.Weekday) string {
   138  	return lg.daysAbbreviated[weekday]
   139  }
   140  
   141  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   142  func (lg *lg) WeekdaysAbbreviated() []string {
   143  	return lg.daysAbbreviated
   144  }
   145  
   146  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   147  func (lg *lg) WeekdayNarrow(weekday time.Weekday) string {
   148  	return lg.daysNarrow[weekday]
   149  }
   150  
   151  // WeekdaysNarrow returns the locales narrow weekdays
   152  func (lg *lg) WeekdaysNarrow() []string {
   153  	return lg.daysNarrow
   154  }
   155  
   156  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   157  func (lg *lg) WeekdayShort(weekday time.Weekday) string {
   158  	return lg.daysShort[weekday]
   159  }
   160  
   161  // WeekdaysShort returns the locales short weekdays
   162  func (lg *lg) WeekdaysShort() []string {
   163  	return lg.daysShort
   164  }
   165  
   166  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   167  func (lg *lg) WeekdayWide(weekday time.Weekday) string {
   168  	return lg.daysWide[weekday]
   169  }
   170  
   171  // WeekdaysWide returns the locales wide weekdays
   172  func (lg *lg) WeekdaysWide() []string {
   173  	return lg.daysWide
   174  }
   175  
   176  // Decimal returns the decimal point of number
   177  func (lg *lg) Decimal() string {
   178  	return lg.decimal
   179  }
   180  
   181  // Group returns the group of number
   182  func (lg *lg) Group() string {
   183  	return lg.group
   184  }
   185  
   186  // Group returns the minus sign of number
   187  func (lg *lg) Minus() string {
   188  	return lg.minus
   189  }
   190  
   191  // FmtNumber returns 'num' with digits/precision of 'v' for 'lg' and handles both Whole and Real numbers based on 'v'
   192  func (lg *lg) FmtNumber(num float64, v uint64) string {
   193  
   194  	return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   195  }
   196  
   197  // FmtPercent returns 'num' with digits/precision of 'v' for 'lg' and handles both Whole and Real numbers based on 'v'
   198  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   199  func (lg *lg) FmtPercent(num float64, v uint64) string {
   200  	return strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   201  }
   202  
   203  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'lg'
   204  func (lg *lg) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   205  
   206  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   207  	symbol := lg.currencies[currency]
   208  	l := len(s) + len(symbol) + 0
   209  	count := 0
   210  	inWhole := v == 0
   211  	b := make([]byte, 0, l)
   212  
   213  	for i := len(s) - 1; i >= 0; i-- {
   214  
   215  		if s[i] == '.' {
   216  			b = append(b, lg.decimal[0])
   217  			inWhole = true
   218  			continue
   219  		}
   220  
   221  		if inWhole {
   222  			if count == 3 {
   223  				b = append(b, lg.group[0])
   224  				count = 1
   225  			} else {
   226  				count++
   227  			}
   228  		}
   229  
   230  		b = append(b, s[i])
   231  	}
   232  
   233  	if num < 0 {
   234  		b = append(b, lg.minus[0])
   235  	}
   236  
   237  	// reverse
   238  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   239  		b[i], b[j] = b[j], b[i]
   240  	}
   241  
   242  	if int(v) < 2 {
   243  
   244  		if v == 0 {
   245  			b = append(b, lg.decimal...)
   246  		}
   247  
   248  		for i := 0; i < 2-int(v); i++ {
   249  			b = append(b, '0')
   250  		}
   251  	}
   252  
   253  	b = append(b, symbol...)
   254  
   255  	return string(b)
   256  }
   257  
   258  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lg'
   259  // in accounting notation.
   260  func (lg *lg) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   261  
   262  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   263  	symbol := lg.currencies[currency]
   264  	l := len(s) + len(symbol) + 0
   265  	count := 0
   266  	inWhole := v == 0
   267  	b := make([]byte, 0, l)
   268  
   269  	for i := len(s) - 1; i >= 0; i-- {
   270  
   271  		if s[i] == '.' {
   272  			b = append(b, lg.decimal[0])
   273  			inWhole = true
   274  			continue
   275  		}
   276  
   277  		if inWhole {
   278  			if count == 3 {
   279  				b = append(b, lg.group[0])
   280  				count = 1
   281  			} else {
   282  				count++
   283  			}
   284  		}
   285  
   286  		b = append(b, s[i])
   287  	}
   288  
   289  	if num < 0 {
   290  
   291  		b = append(b, lg.minus[0])
   292  
   293  	}
   294  
   295  	// reverse
   296  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   297  		b[i], b[j] = b[j], b[i]
   298  	}
   299  
   300  	if int(v) < 2 {
   301  
   302  		if v == 0 {
   303  			b = append(b, lg.decimal...)
   304  		}
   305  
   306  		for i := 0; i < 2-int(v); i++ {
   307  			b = append(b, '0')
   308  		}
   309  	}
   310  
   311  	if num < 0 {
   312  		b = append(b, symbol...)
   313  	} else {
   314  
   315  		b = append(b, symbol...)
   316  	}
   317  
   318  	return string(b)
   319  }
   320  
   321  // FmtDateShort returns the short date representation of 't' for 'lg'
   322  func (lg *lg) FmtDateShort(t time.Time) string {
   323  
   324  	b := make([]byte, 0, 32)
   325  
   326  	if t.Day() < 10 {
   327  		b = append(b, '0')
   328  	}
   329  
   330  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   331  	b = append(b, []byte{0x2f}...)
   332  
   333  	if t.Month() < 10 {
   334  		b = append(b, '0')
   335  	}
   336  
   337  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   338  
   339  	b = append(b, []byte{0x2f}...)
   340  
   341  	if t.Year() > 0 {
   342  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   343  	} else {
   344  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   345  	}
   346  
   347  	return string(b)
   348  }
   349  
   350  // FmtDateMedium returns the medium date representation of 't' for 'lg'
   351  func (lg *lg) FmtDateMedium(t time.Time) string {
   352  
   353  	b := make([]byte, 0, 32)
   354  
   355  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   356  	b = append(b, []byte{0x20}...)
   357  	b = append(b, lg.monthsAbbreviated[t.Month()]...)
   358  	b = append(b, []byte{0x20}...)
   359  
   360  	if t.Year() > 0 {
   361  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   362  	} else {
   363  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   364  	}
   365  
   366  	return string(b)
   367  }
   368  
   369  // FmtDateLong returns the long date representation of 't' for 'lg'
   370  func (lg *lg) FmtDateLong(t time.Time) string {
   371  
   372  	b := make([]byte, 0, 32)
   373  
   374  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   375  	b = append(b, []byte{0x20}...)
   376  	b = append(b, lg.monthsWide[t.Month()]...)
   377  	b = append(b, []byte{0x20}...)
   378  
   379  	if t.Year() > 0 {
   380  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   381  	} else {
   382  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   383  	}
   384  
   385  	return string(b)
   386  }
   387  
   388  // FmtDateFull returns the full date representation of 't' for 'lg'
   389  func (lg *lg) FmtDateFull(t time.Time) string {
   390  
   391  	b := make([]byte, 0, 32)
   392  
   393  	b = append(b, lg.daysWide[t.Weekday()]...)
   394  	b = append(b, []byte{0x2c, 0x20}...)
   395  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   396  	b = append(b, []byte{0x20}...)
   397  	b = append(b, lg.monthsWide[t.Month()]...)
   398  	b = append(b, []byte{0x20}...)
   399  
   400  	if t.Year() > 0 {
   401  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   402  	} else {
   403  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   404  	}
   405  
   406  	return string(b)
   407  }
   408  
   409  // FmtTimeShort returns the short time representation of 't' for 'lg'
   410  func (lg *lg) FmtTimeShort(t time.Time) string {
   411  
   412  	b := make([]byte, 0, 32)
   413  
   414  	if t.Hour() < 10 {
   415  		b = append(b, '0')
   416  	}
   417  
   418  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   419  	b = append(b, lg.timeSeparator...)
   420  
   421  	if t.Minute() < 10 {
   422  		b = append(b, '0')
   423  	}
   424  
   425  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   426  
   427  	return string(b)
   428  }
   429  
   430  // FmtTimeMedium returns the medium time representation of 't' for 'lg'
   431  func (lg *lg) FmtTimeMedium(t time.Time) string {
   432  
   433  	b := make([]byte, 0, 32)
   434  
   435  	if t.Hour() < 10 {
   436  		b = append(b, '0')
   437  	}
   438  
   439  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   440  	b = append(b, lg.timeSeparator...)
   441  
   442  	if t.Minute() < 10 {
   443  		b = append(b, '0')
   444  	}
   445  
   446  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   447  	b = append(b, lg.timeSeparator...)
   448  
   449  	if t.Second() < 10 {
   450  		b = append(b, '0')
   451  	}
   452  
   453  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   454  
   455  	return string(b)
   456  }
   457  
   458  // FmtTimeLong returns the long time representation of 't' for 'lg'
   459  func (lg *lg) FmtTimeLong(t time.Time) string {
   460  
   461  	b := make([]byte, 0, 32)
   462  
   463  	if t.Hour() < 10 {
   464  		b = append(b, '0')
   465  	}
   466  
   467  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   468  	b = append(b, lg.timeSeparator...)
   469  
   470  	if t.Minute() < 10 {
   471  		b = append(b, '0')
   472  	}
   473  
   474  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   475  	b = append(b, lg.timeSeparator...)
   476  
   477  	if t.Second() < 10 {
   478  		b = append(b, '0')
   479  	}
   480  
   481  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   482  	b = append(b, []byte{0x20}...)
   483  
   484  	tz, _ := t.Zone()
   485  	b = append(b, tz...)
   486  
   487  	return string(b)
   488  }
   489  
   490  // FmtTimeFull returns the full time representation of 't' for 'lg'
   491  func (lg *lg) FmtTimeFull(t time.Time) string {
   492  
   493  	b := make([]byte, 0, 32)
   494  
   495  	if t.Hour() < 10 {
   496  		b = append(b, '0')
   497  	}
   498  
   499  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   500  	b = append(b, lg.timeSeparator...)
   501  
   502  	if t.Minute() < 10 {
   503  		b = append(b, '0')
   504  	}
   505  
   506  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   507  	b = append(b, lg.timeSeparator...)
   508  
   509  	if t.Second() < 10 {
   510  		b = append(b, '0')
   511  	}
   512  
   513  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   514  	b = append(b, []byte{0x20}...)
   515  
   516  	tz, _ := t.Zone()
   517  
   518  	if btz, ok := lg.timezones[tz]; ok {
   519  		b = append(b, btz...)
   520  	} else {
   521  		b = append(b, tz...)
   522  	}
   523  
   524  	return string(b)
   525  }
   526  

View as plain text