...

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

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

     1  package mua
     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 mua 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 'mua' locale
    45  func New() locales.Translator {
    46  	return &mua{
    47  		locale:                 "mua",
    48  		pluralsCardinal:        nil,
    49  		pluralsOrdinal:         nil,
    50  		pluralsRange:           nil,
    51  		decimal:                ",",
    52  		group:                  ".",
    53  		timeSeparator:          ":",
    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", "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"},
    55  		currencyNegativePrefix: "(",
    56  		currencyNegativeSuffix: ")",
    57  		monthsAbbreviated:      []string{"", "FLO", "CLA", "CKI", "FMF", "MAD", "MBI", "MLI", "MAM", "FDE", "FMU", "FGW", "FYU"},
    58  		monthsNarrow:           []string{"", "O", "A", "I", "F", "D", "B", "L", "M", "E", "U", "W", "Y"},
    59  		monthsWide:             []string{"", "Fĩi Loo", "Cokcwaklaŋne", "Cokcwaklii", "Fĩi Marfoo", "Madǝǝuutǝbijaŋ", "Mamǝŋgwãafahbii", "Mamǝŋgwãalii", "Madǝmbii", "Fĩi Dǝɓlii", "Fĩi Mundaŋ", "Fĩi Gwahlle", "Fĩi Yuru"},
    60  		daysAbbreviated:        []string{"Cya", "Cla", "Czi", "Cko", "Cka", "Cga", "Cze"},
    61  		daysNarrow:             []string{"Y", "L", "Z", "O", "A", "G", "E"},
    62  		daysWide:               []string{"Com’yakke", "Comlaaɗii", "Comzyiiɗii", "Comkolle", "Comkaldǝɓlii", "Comgaisuu", "Comzyeɓsuu"},
    63  		periodsAbbreviated:     []string{"comme", "lilli"},
    64  		periodsWide:            []string{"comme", "lilli"},
    65  		erasAbbreviated:        []string{"KK", "PK"},
    66  		erasNarrow:             []string{"", ""},
    67  		erasWide:               []string{"KǝPel Kristu", "Pel Kristu"},
    68  		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", "∅∅∅": "∅∅∅"},
    69  	}
    70  }
    71  
    72  // Locale returns the current translators string locale
    73  func (mua *mua) Locale() string {
    74  	return mua.locale
    75  }
    76  
    77  // PluralsCardinal returns the list of cardinal plural rules associated with 'mua'
    78  func (mua *mua) PluralsCardinal() []locales.PluralRule {
    79  	return mua.pluralsCardinal
    80  }
    81  
    82  // PluralsOrdinal returns the list of ordinal plural rules associated with 'mua'
    83  func (mua *mua) PluralsOrdinal() []locales.PluralRule {
    84  	return mua.pluralsOrdinal
    85  }
    86  
    87  // PluralsRange returns the list of range plural rules associated with 'mua'
    88  func (mua *mua) PluralsRange() []locales.PluralRule {
    89  	return mua.pluralsRange
    90  }
    91  
    92  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'mua'
    93  func (mua *mua) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
    94  	return locales.PluralRuleUnknown
    95  }
    96  
    97  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'mua'
    98  func (mua *mua) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
    99  	return locales.PluralRuleUnknown
   100  }
   101  
   102  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'mua'
   103  func (mua *mua) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   104  	return locales.PluralRuleUnknown
   105  }
   106  
   107  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   108  func (mua *mua) MonthAbbreviated(month time.Month) string {
   109  	return mua.monthsAbbreviated[month]
   110  }
   111  
   112  // MonthsAbbreviated returns the locales abbreviated months
   113  func (mua *mua) MonthsAbbreviated() []string {
   114  	return mua.monthsAbbreviated[1:]
   115  }
   116  
   117  // MonthNarrow returns the locales narrow month given the 'month' provided
   118  func (mua *mua) MonthNarrow(month time.Month) string {
   119  	return mua.monthsNarrow[month]
   120  }
   121  
   122  // MonthsNarrow returns the locales narrow months
   123  func (mua *mua) MonthsNarrow() []string {
   124  	return mua.monthsNarrow[1:]
   125  }
   126  
   127  // MonthWide returns the locales wide month given the 'month' provided
   128  func (mua *mua) MonthWide(month time.Month) string {
   129  	return mua.monthsWide[month]
   130  }
   131  
   132  // MonthsWide returns the locales wide months
   133  func (mua *mua) MonthsWide() []string {
   134  	return mua.monthsWide[1:]
   135  }
   136  
   137  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   138  func (mua *mua) WeekdayAbbreviated(weekday time.Weekday) string {
   139  	return mua.daysAbbreviated[weekday]
   140  }
   141  
   142  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   143  func (mua *mua) WeekdaysAbbreviated() []string {
   144  	return mua.daysAbbreviated
   145  }
   146  
   147  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   148  func (mua *mua) WeekdayNarrow(weekday time.Weekday) string {
   149  	return mua.daysNarrow[weekday]
   150  }
   151  
   152  // WeekdaysNarrow returns the locales narrow weekdays
   153  func (mua *mua) WeekdaysNarrow() []string {
   154  	return mua.daysNarrow
   155  }
   156  
   157  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   158  func (mua *mua) WeekdayShort(weekday time.Weekday) string {
   159  	return mua.daysShort[weekday]
   160  }
   161  
   162  // WeekdaysShort returns the locales short weekdays
   163  func (mua *mua) WeekdaysShort() []string {
   164  	return mua.daysShort
   165  }
   166  
   167  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   168  func (mua *mua) WeekdayWide(weekday time.Weekday) string {
   169  	return mua.daysWide[weekday]
   170  }
   171  
   172  // WeekdaysWide returns the locales wide weekdays
   173  func (mua *mua) WeekdaysWide() []string {
   174  	return mua.daysWide
   175  }
   176  
   177  // Decimal returns the decimal point of number
   178  func (mua *mua) Decimal() string {
   179  	return mua.decimal
   180  }
   181  
   182  // Group returns the group of number
   183  func (mua *mua) Group() string {
   184  	return mua.group
   185  }
   186  
   187  // Group returns the minus sign of number
   188  func (mua *mua) Minus() string {
   189  	return mua.minus
   190  }
   191  
   192  // FmtNumber returns 'num' with digits/precision of 'v' for 'mua' and handles both Whole and Real numbers based on 'v'
   193  func (mua *mua) FmtNumber(num float64, v uint64) string {
   194  
   195  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   196  	l := len(s) + 1 + 1*len(s[:len(s)-int(v)-1])/3
   197  	count := 0
   198  	inWhole := v == 0
   199  	b := make([]byte, 0, l)
   200  
   201  	for i := len(s) - 1; i >= 0; i-- {
   202  
   203  		if s[i] == '.' {
   204  			b = append(b, mua.decimal[0])
   205  			inWhole = true
   206  			continue
   207  		}
   208  
   209  		if inWhole {
   210  			if count == 3 {
   211  				b = append(b, mua.group[0])
   212  				count = 1
   213  			} else {
   214  				count++
   215  			}
   216  		}
   217  
   218  		b = append(b, s[i])
   219  	}
   220  
   221  	if num < 0 {
   222  		b = append(b, mua.minus[0])
   223  	}
   224  
   225  	// reverse
   226  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   227  		b[i], b[j] = b[j], b[i]
   228  	}
   229  
   230  	return string(b)
   231  }
   232  
   233  // FmtPercent returns 'num' with digits/precision of 'v' for 'mua' and handles both Whole and Real numbers based on 'v'
   234  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   235  func (mua *mua) FmtPercent(num float64, v uint64) string {
   236  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   237  	l := len(s) + 1
   238  	b := make([]byte, 0, l)
   239  
   240  	for i := len(s) - 1; i >= 0; i-- {
   241  
   242  		if s[i] == '.' {
   243  			b = append(b, mua.decimal[0])
   244  			continue
   245  		}
   246  
   247  		b = append(b, s[i])
   248  	}
   249  
   250  	if num < 0 {
   251  		b = append(b, mua.minus[0])
   252  	}
   253  
   254  	// reverse
   255  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   256  		b[i], b[j] = b[j], b[i]
   257  	}
   258  
   259  	b = append(b, mua.percent...)
   260  
   261  	return string(b)
   262  }
   263  
   264  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'mua'
   265  func (mua *mua) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   266  
   267  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   268  	symbol := mua.currencies[currency]
   269  	l := len(s) + len(symbol) + 1 + 1*len(s[:len(s)-int(v)-1])/3
   270  	count := 0
   271  	inWhole := v == 0
   272  	b := make([]byte, 0, l)
   273  
   274  	for i := len(s) - 1; i >= 0; i-- {
   275  
   276  		if s[i] == '.' {
   277  			b = append(b, mua.decimal[0])
   278  			inWhole = true
   279  			continue
   280  		}
   281  
   282  		if inWhole {
   283  			if count == 3 {
   284  				b = append(b, mua.group[0])
   285  				count = 1
   286  			} else {
   287  				count++
   288  			}
   289  		}
   290  
   291  		b = append(b, s[i])
   292  	}
   293  
   294  	for j := len(symbol) - 1; j >= 0; j-- {
   295  		b = append(b, symbol[j])
   296  	}
   297  
   298  	if num < 0 {
   299  		b = append(b, mua.minus[0])
   300  	}
   301  
   302  	// reverse
   303  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   304  		b[i], b[j] = b[j], b[i]
   305  	}
   306  
   307  	if int(v) < 2 {
   308  
   309  		if v == 0 {
   310  			b = append(b, mua.decimal...)
   311  		}
   312  
   313  		for i := 0; i < 2-int(v); i++ {
   314  			b = append(b, '0')
   315  		}
   316  	}
   317  
   318  	return string(b)
   319  }
   320  
   321  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mua'
   322  // in accounting notation.
   323  func (mua *mua) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   324  
   325  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   326  	symbol := mua.currencies[currency]
   327  	l := len(s) + len(symbol) + 3 + 1*len(s[:len(s)-int(v)-1])/3
   328  	count := 0
   329  	inWhole := v == 0
   330  	b := make([]byte, 0, l)
   331  
   332  	for i := len(s) - 1; i >= 0; i-- {
   333  
   334  		if s[i] == '.' {
   335  			b = append(b, mua.decimal[0])
   336  			inWhole = true
   337  			continue
   338  		}
   339  
   340  		if inWhole {
   341  			if count == 3 {
   342  				b = append(b, mua.group[0])
   343  				count = 1
   344  			} else {
   345  				count++
   346  			}
   347  		}
   348  
   349  		b = append(b, s[i])
   350  	}
   351  
   352  	if num < 0 {
   353  
   354  		for j := len(symbol) - 1; j >= 0; j-- {
   355  			b = append(b, symbol[j])
   356  		}
   357  
   358  		b = append(b, mua.currencyNegativePrefix[0])
   359  
   360  	} else {
   361  
   362  		for j := len(symbol) - 1; j >= 0; j-- {
   363  			b = append(b, symbol[j])
   364  		}
   365  
   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, mua.decimal...)
   377  		}
   378  
   379  		for i := 0; i < 2-int(v); i++ {
   380  			b = append(b, '0')
   381  		}
   382  	}
   383  
   384  	if num < 0 {
   385  		b = append(b, mua.currencyNegativeSuffix...)
   386  	}
   387  
   388  	return string(b)
   389  }
   390  
   391  // FmtDateShort returns the short date representation of 't' for 'mua'
   392  func (mua *mua) FmtDateShort(t time.Time) string {
   393  
   394  	b := make([]byte, 0, 32)
   395  
   396  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   397  	b = append(b, []byte{0x2f}...)
   398  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   399  	b = append(b, []byte{0x2f}...)
   400  
   401  	if t.Year() > 0 {
   402  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   403  	} else {
   404  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   405  	}
   406  
   407  	return string(b)
   408  }
   409  
   410  // FmtDateMedium returns the medium date representation of 't' for 'mua'
   411  func (mua *mua) FmtDateMedium(t time.Time) string {
   412  
   413  	b := make([]byte, 0, 32)
   414  
   415  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   416  	b = append(b, []byte{0x20}...)
   417  	b = append(b, mua.monthsAbbreviated[t.Month()]...)
   418  	b = append(b, []byte{0x20}...)
   419  
   420  	if t.Year() > 0 {
   421  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   422  	} else {
   423  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   424  	}
   425  
   426  	return string(b)
   427  }
   428  
   429  // FmtDateLong returns the long date representation of 't' for 'mua'
   430  func (mua *mua) FmtDateLong(t time.Time) string {
   431  
   432  	b := make([]byte, 0, 32)
   433  
   434  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   435  	b = append(b, []byte{0x20}...)
   436  	b = append(b, mua.monthsWide[t.Month()]...)
   437  	b = append(b, []byte{0x20}...)
   438  
   439  	if t.Year() > 0 {
   440  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   441  	} else {
   442  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   443  	}
   444  
   445  	return string(b)
   446  }
   447  
   448  // FmtDateFull returns the full date representation of 't' for 'mua'
   449  func (mua *mua) FmtDateFull(t time.Time) string {
   450  
   451  	b := make([]byte, 0, 32)
   452  
   453  	b = append(b, mua.daysWide[t.Weekday()]...)
   454  	b = append(b, []byte{0x20}...)
   455  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   456  	b = append(b, []byte{0x20}...)
   457  	b = append(b, mua.monthsWide[t.Month()]...)
   458  	b = append(b, []byte{0x20}...)
   459  
   460  	if t.Year() > 0 {
   461  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   462  	} else {
   463  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   464  	}
   465  
   466  	return string(b)
   467  }
   468  
   469  // FmtTimeShort returns the short time representation of 't' for 'mua'
   470  func (mua *mua) FmtTimeShort(t time.Time) string {
   471  
   472  	b := make([]byte, 0, 32)
   473  
   474  	if t.Hour() < 10 {
   475  		b = append(b, '0')
   476  	}
   477  
   478  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   479  	b = append(b, mua.timeSeparator...)
   480  
   481  	if t.Minute() < 10 {
   482  		b = append(b, '0')
   483  	}
   484  
   485  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   486  
   487  	return string(b)
   488  }
   489  
   490  // FmtTimeMedium returns the medium time representation of 't' for 'mua'
   491  func (mua *mua) FmtTimeMedium(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, mua.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, mua.timeSeparator...)
   508  
   509  	if t.Second() < 10 {
   510  		b = append(b, '0')
   511  	}
   512  
   513  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   514  
   515  	return string(b)
   516  }
   517  
   518  // FmtTimeLong returns the long time representation of 't' for 'mua'
   519  func (mua *mua) FmtTimeLong(t time.Time) string {
   520  
   521  	b := make([]byte, 0, 32)
   522  
   523  	if t.Hour() < 10 {
   524  		b = append(b, '0')
   525  	}
   526  
   527  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   528  	b = append(b, mua.timeSeparator...)
   529  
   530  	if t.Minute() < 10 {
   531  		b = append(b, '0')
   532  	}
   533  
   534  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   535  	b = append(b, mua.timeSeparator...)
   536  
   537  	if t.Second() < 10 {
   538  		b = append(b, '0')
   539  	}
   540  
   541  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   542  	b = append(b, []byte{0x20}...)
   543  
   544  	tz, _ := t.Zone()
   545  	b = append(b, tz...)
   546  
   547  	return string(b)
   548  }
   549  
   550  // FmtTimeFull returns the full time representation of 't' for 'mua'
   551  func (mua *mua) FmtTimeFull(t time.Time) string {
   552  
   553  	b := make([]byte, 0, 32)
   554  
   555  	if t.Hour() < 10 {
   556  		b = append(b, '0')
   557  	}
   558  
   559  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   560  	b = append(b, mua.timeSeparator...)
   561  
   562  	if t.Minute() < 10 {
   563  		b = append(b, '0')
   564  	}
   565  
   566  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   567  	b = append(b, mua.timeSeparator...)
   568  
   569  	if t.Second() < 10 {
   570  		b = append(b, '0')
   571  	}
   572  
   573  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   574  	b = append(b, []byte{0x20}...)
   575  
   576  	tz, _ := t.Zone()
   577  
   578  	if btz, ok := mua.timezones[tz]; ok {
   579  		b = append(b, btz...)
   580  	} else {
   581  		b = append(b, tz...)
   582  	}
   583  
   584  	return string(b)
   585  }
   586  

View as plain text