...

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

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

     1  package mg_MG
     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 mg_MG 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 'mg_MG' locale
    43  func New() locales.Translator {
    44  	return &mg_MG{
    45  		locale:             "mg_MG",
    46  		pluralsCardinal:    []locales.PluralRule{2, 6},
    47  		pluralsOrdinal:     nil,
    48  		pluralsRange:       nil,
    49  		decimal:            ".",
    50  		group:              ",",
    51  		minus:              "-",
    52  		percent:            "%",
    53  		perMille:           "‰",
    54  		timeSeparator:      ":",
    55  		inifinity:          "∞",
    56  		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"},
    57  		monthsAbbreviated:  []string{"", "Jan", "Feb", "Mar", "Apr", "Mey", "Jon", "Jol", "Aog", "Sep", "Okt", "Nov", "Des"},
    58  		monthsNarrow:       []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
    59  		monthsWide:         []string{"", "Janoary", "Febroary", "Martsa", "Aprily", "Mey", "Jona", "Jolay", "Aogositra", "Septambra", "Oktobra", "Novambra", "Desambra"},
    60  		daysAbbreviated:    []string{"Alah", "Alats", "Tal", "Alar", "Alak", "Zom", "Asab"},
    61  		daysNarrow:         []string{"A", "A", "T", "A", "A", "Z", "A"},
    62  		daysShort:          []string{"Alah", "Alats", "Tal", "Alar", "Alak", "Zom", "Asab"},
    63  		daysWide:           []string{"Alahady", "Alatsinainy", "Talata", "Alarobia", "Alakamisy", "Zoma", "Asabotsy"},
    64  		periodsAbbreviated: []string{"AM", "PM"},
    65  		periodsNarrow:      []string{"AM", "PM"},
    66  		periodsWide:        []string{"AM", "PM"},
    67  		erasAbbreviated:    []string{"BC", "AD"},
    68  		erasNarrow:         []string{"", ""},
    69  		erasWide:           []string{"Alohan’i JK", "Aorian’i JK"},
    70  		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", "∅∅∅": "∅∅∅"},
    71  	}
    72  }
    73  
    74  // Locale returns the current translators string locale
    75  func (mg *mg_MG) Locale() string {
    76  	return mg.locale
    77  }
    78  
    79  // PluralsCardinal returns the list of cardinal plural rules associated with 'mg_MG'
    80  func (mg *mg_MG) PluralsCardinal() []locales.PluralRule {
    81  	return mg.pluralsCardinal
    82  }
    83  
    84  // PluralsOrdinal returns the list of ordinal plural rules associated with 'mg_MG'
    85  func (mg *mg_MG) PluralsOrdinal() []locales.PluralRule {
    86  	return mg.pluralsOrdinal
    87  }
    88  
    89  // PluralsRange returns the list of range plural rules associated with 'mg_MG'
    90  func (mg *mg_MG) PluralsRange() []locales.PluralRule {
    91  	return mg.pluralsRange
    92  }
    93  
    94  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'mg_MG'
    95  func (mg *mg_MG) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
    96  
    97  	n := math.Abs(num)
    98  
    99  	if n >= 0 && n <= 1 {
   100  		return locales.PluralRuleOne
   101  	}
   102  
   103  	return locales.PluralRuleOther
   104  }
   105  
   106  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'mg_MG'
   107  func (mg *mg_MG) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   108  	return locales.PluralRuleUnknown
   109  }
   110  
   111  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'mg_MG'
   112  func (mg *mg_MG) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   113  	return locales.PluralRuleUnknown
   114  }
   115  
   116  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   117  func (mg *mg_MG) MonthAbbreviated(month time.Month) string {
   118  	return mg.monthsAbbreviated[month]
   119  }
   120  
   121  // MonthsAbbreviated returns the locales abbreviated months
   122  func (mg *mg_MG) MonthsAbbreviated() []string {
   123  	return mg.monthsAbbreviated[1:]
   124  }
   125  
   126  // MonthNarrow returns the locales narrow month given the 'month' provided
   127  func (mg *mg_MG) MonthNarrow(month time.Month) string {
   128  	return mg.monthsNarrow[month]
   129  }
   130  
   131  // MonthsNarrow returns the locales narrow months
   132  func (mg *mg_MG) MonthsNarrow() []string {
   133  	return mg.monthsNarrow[1:]
   134  }
   135  
   136  // MonthWide returns the locales wide month given the 'month' provided
   137  func (mg *mg_MG) MonthWide(month time.Month) string {
   138  	return mg.monthsWide[month]
   139  }
   140  
   141  // MonthsWide returns the locales wide months
   142  func (mg *mg_MG) MonthsWide() []string {
   143  	return mg.monthsWide[1:]
   144  }
   145  
   146  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   147  func (mg *mg_MG) WeekdayAbbreviated(weekday time.Weekday) string {
   148  	return mg.daysAbbreviated[weekday]
   149  }
   150  
   151  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   152  func (mg *mg_MG) WeekdaysAbbreviated() []string {
   153  	return mg.daysAbbreviated
   154  }
   155  
   156  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   157  func (mg *mg_MG) WeekdayNarrow(weekday time.Weekday) string {
   158  	return mg.daysNarrow[weekday]
   159  }
   160  
   161  // WeekdaysNarrow returns the locales narrow weekdays
   162  func (mg *mg_MG) WeekdaysNarrow() []string {
   163  	return mg.daysNarrow
   164  }
   165  
   166  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   167  func (mg *mg_MG) WeekdayShort(weekday time.Weekday) string {
   168  	return mg.daysShort[weekday]
   169  }
   170  
   171  // WeekdaysShort returns the locales short weekdays
   172  func (mg *mg_MG) WeekdaysShort() []string {
   173  	return mg.daysShort
   174  }
   175  
   176  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   177  func (mg *mg_MG) WeekdayWide(weekday time.Weekday) string {
   178  	return mg.daysWide[weekday]
   179  }
   180  
   181  // WeekdaysWide returns the locales wide weekdays
   182  func (mg *mg_MG) WeekdaysWide() []string {
   183  	return mg.daysWide
   184  }
   185  
   186  // Decimal returns the decimal point of number
   187  func (mg *mg_MG) Decimal() string {
   188  	return mg.decimal
   189  }
   190  
   191  // Group returns the group of number
   192  func (mg *mg_MG) Group() string {
   193  	return mg.group
   194  }
   195  
   196  // Group returns the minus sign of number
   197  func (mg *mg_MG) Minus() string {
   198  	return mg.minus
   199  }
   200  
   201  // FmtNumber returns 'num' with digits/precision of 'v' for 'mg_MG' and handles both Whole and Real numbers based on 'v'
   202  func (mg *mg_MG) FmtNumber(num float64, v uint64) string {
   203  
   204  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   205  	l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
   206  	count := 0
   207  	inWhole := v == 0
   208  	b := make([]byte, 0, l)
   209  
   210  	for i := len(s) - 1; i >= 0; i-- {
   211  
   212  		if s[i] == '.' {
   213  			b = append(b, mg.decimal[0])
   214  			inWhole = true
   215  			continue
   216  		}
   217  
   218  		if inWhole {
   219  			if count == 3 {
   220  				b = append(b, mg.group[0])
   221  				count = 1
   222  			} else {
   223  				count++
   224  			}
   225  		}
   226  
   227  		b = append(b, s[i])
   228  	}
   229  
   230  	if num < 0 {
   231  		b = append(b, mg.minus[0])
   232  	}
   233  
   234  	// reverse
   235  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   236  		b[i], b[j] = b[j], b[i]
   237  	}
   238  
   239  	return string(b)
   240  }
   241  
   242  // FmtPercent returns 'num' with digits/precision of 'v' for 'mg_MG' and handles both Whole and Real numbers based on 'v'
   243  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   244  func (mg *mg_MG) FmtPercent(num float64, v uint64) string {
   245  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   246  	l := len(s) + 3
   247  	b := make([]byte, 0, l)
   248  
   249  	for i := len(s) - 1; i >= 0; i-- {
   250  
   251  		if s[i] == '.' {
   252  			b = append(b, mg.decimal[0])
   253  			continue
   254  		}
   255  
   256  		b = append(b, s[i])
   257  	}
   258  
   259  	if num < 0 {
   260  		b = append(b, mg.minus[0])
   261  	}
   262  
   263  	// reverse
   264  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   265  		b[i], b[j] = b[j], b[i]
   266  	}
   267  
   268  	b = append(b, mg.percent...)
   269  
   270  	return string(b)
   271  }
   272  
   273  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'mg_MG'
   274  func (mg *mg_MG) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   275  
   276  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   277  	symbol := mg.currencies[currency]
   278  	l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
   279  	count := 0
   280  	inWhole := v == 0
   281  	b := make([]byte, 0, l)
   282  
   283  	for i := len(s) - 1; i >= 0; i-- {
   284  
   285  		if s[i] == '.' {
   286  			b = append(b, mg.decimal[0])
   287  			inWhole = true
   288  			continue
   289  		}
   290  
   291  		if inWhole {
   292  			if count == 3 {
   293  				b = append(b, mg.group[0])
   294  				count = 1
   295  			} else {
   296  				count++
   297  			}
   298  		}
   299  
   300  		b = append(b, s[i])
   301  	}
   302  
   303  	for j := len(symbol) - 1; j >= 0; j-- {
   304  		b = append(b, symbol[j])
   305  	}
   306  
   307  	if num < 0 {
   308  		b = append(b, mg.minus[0])
   309  	}
   310  
   311  	// reverse
   312  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   313  		b[i], b[j] = b[j], b[i]
   314  	}
   315  
   316  	if int(v) < 2 {
   317  
   318  		if v == 0 {
   319  			b = append(b, mg.decimal...)
   320  		}
   321  
   322  		for i := 0; i < 2-int(v); i++ {
   323  			b = append(b, '0')
   324  		}
   325  	}
   326  
   327  	return string(b)
   328  }
   329  
   330  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mg_MG'
   331  // in accounting notation.
   332  func (mg *mg_MG) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   333  
   334  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   335  	symbol := mg.currencies[currency]
   336  	l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
   337  	count := 0
   338  	inWhole := v == 0
   339  	b := make([]byte, 0, l)
   340  
   341  	for i := len(s) - 1; i >= 0; i-- {
   342  
   343  		if s[i] == '.' {
   344  			b = append(b, mg.decimal[0])
   345  			inWhole = true
   346  			continue
   347  		}
   348  
   349  		if inWhole {
   350  			if count == 3 {
   351  				b = append(b, mg.group[0])
   352  				count = 1
   353  			} else {
   354  				count++
   355  			}
   356  		}
   357  
   358  		b = append(b, s[i])
   359  	}
   360  
   361  	if num < 0 {
   362  
   363  		for j := len(symbol) - 1; j >= 0; j-- {
   364  			b = append(b, symbol[j])
   365  		}
   366  
   367  		b = append(b, mg.minus[0])
   368  
   369  	} else {
   370  
   371  		for j := len(symbol) - 1; j >= 0; j-- {
   372  			b = append(b, symbol[j])
   373  		}
   374  
   375  	}
   376  
   377  	// reverse
   378  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   379  		b[i], b[j] = b[j], b[i]
   380  	}
   381  
   382  	if int(v) < 2 {
   383  
   384  		if v == 0 {
   385  			b = append(b, mg.decimal...)
   386  		}
   387  
   388  		for i := 0; i < 2-int(v); i++ {
   389  			b = append(b, '0')
   390  		}
   391  	}
   392  
   393  	return string(b)
   394  }
   395  
   396  // FmtDateShort returns the short date representation of 't' for 'mg_MG'
   397  func (mg *mg_MG) FmtDateShort(t time.Time) string {
   398  
   399  	b := make([]byte, 0, 32)
   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  	b = append(b, []byte{0x2d}...)
   408  
   409  	if t.Month() < 10 {
   410  		b = append(b, '0')
   411  	}
   412  
   413  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   414  
   415  	b = append(b, []byte{0x2d}...)
   416  
   417  	if t.Day() < 10 {
   418  		b = append(b, '0')
   419  	}
   420  
   421  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   422  
   423  	return string(b)
   424  }
   425  
   426  // FmtDateMedium returns the medium date representation of 't' for 'mg_MG'
   427  func (mg *mg_MG) FmtDateMedium(t time.Time) string {
   428  
   429  	b := make([]byte, 0, 32)
   430  
   431  	if t.Year() > 0 {
   432  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   433  	} else {
   434  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   435  	}
   436  
   437  	b = append(b, []byte{0x20}...)
   438  	b = append(b, mg.monthsAbbreviated[t.Month()]...)
   439  	b = append(b, []byte{0x20}...)
   440  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   441  
   442  	return string(b)
   443  }
   444  
   445  // FmtDateLong returns the long date representation of 't' for 'mg_MG'
   446  func (mg *mg_MG) FmtDateLong(t time.Time) string {
   447  
   448  	b := make([]byte, 0, 32)
   449  
   450  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   451  	b = append(b, []byte{0x20}...)
   452  	b = append(b, mg.monthsWide[t.Month()]...)
   453  	b = append(b, []byte{0x20}...)
   454  
   455  	if t.Year() > 0 {
   456  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   457  	} else {
   458  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   459  	}
   460  
   461  	return string(b)
   462  }
   463  
   464  // FmtDateFull returns the full date representation of 't' for 'mg_MG'
   465  func (mg *mg_MG) FmtDateFull(t time.Time) string {
   466  
   467  	b := make([]byte, 0, 32)
   468  
   469  	b = append(b, mg.daysWide[t.Weekday()]...)
   470  	b = append(b, []byte{0x20}...)
   471  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   472  	b = append(b, []byte{0x20}...)
   473  	b = append(b, mg.monthsWide[t.Month()]...)
   474  	b = append(b, []byte{0x20}...)
   475  
   476  	if t.Year() > 0 {
   477  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   478  	} else {
   479  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   480  	}
   481  
   482  	return string(b)
   483  }
   484  
   485  // FmtTimeShort returns the short time representation of 't' for 'mg_MG'
   486  func (mg *mg_MG) FmtTimeShort(t time.Time) string {
   487  
   488  	b := make([]byte, 0, 32)
   489  
   490  	if t.Hour() < 10 {
   491  		b = append(b, '0')
   492  	}
   493  
   494  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   495  	b = append(b, mg.timeSeparator...)
   496  
   497  	if t.Minute() < 10 {
   498  		b = append(b, '0')
   499  	}
   500  
   501  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   502  
   503  	return string(b)
   504  }
   505  
   506  // FmtTimeMedium returns the medium time representation of 't' for 'mg_MG'
   507  func (mg *mg_MG) FmtTimeMedium(t time.Time) string {
   508  
   509  	b := make([]byte, 0, 32)
   510  
   511  	if t.Hour() < 10 {
   512  		b = append(b, '0')
   513  	}
   514  
   515  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   516  	b = append(b, mg.timeSeparator...)
   517  
   518  	if t.Minute() < 10 {
   519  		b = append(b, '0')
   520  	}
   521  
   522  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   523  	b = append(b, mg.timeSeparator...)
   524  
   525  	if t.Second() < 10 {
   526  		b = append(b, '0')
   527  	}
   528  
   529  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   530  
   531  	return string(b)
   532  }
   533  
   534  // FmtTimeLong returns the long time representation of 't' for 'mg_MG'
   535  func (mg *mg_MG) FmtTimeLong(t time.Time) string {
   536  
   537  	b := make([]byte, 0, 32)
   538  
   539  	if t.Hour() < 10 {
   540  		b = append(b, '0')
   541  	}
   542  
   543  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   544  	b = append(b, mg.timeSeparator...)
   545  
   546  	if t.Minute() < 10 {
   547  		b = append(b, '0')
   548  	}
   549  
   550  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   551  	b = append(b, mg.timeSeparator...)
   552  
   553  	if t.Second() < 10 {
   554  		b = append(b, '0')
   555  	}
   556  
   557  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   558  	b = append(b, []byte{0x20}...)
   559  
   560  	tz, _ := t.Zone()
   561  	b = append(b, tz...)
   562  
   563  	return string(b)
   564  }
   565  
   566  // FmtTimeFull returns the full time representation of 't' for 'mg_MG'
   567  func (mg *mg_MG) FmtTimeFull(t time.Time) string {
   568  
   569  	b := make([]byte, 0, 32)
   570  
   571  	if t.Hour() < 10 {
   572  		b = append(b, '0')
   573  	}
   574  
   575  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   576  	b = append(b, mg.timeSeparator...)
   577  
   578  	if t.Minute() < 10 {
   579  		b = append(b, '0')
   580  	}
   581  
   582  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   583  	b = append(b, mg.timeSeparator...)
   584  
   585  	if t.Second() < 10 {
   586  		b = append(b, '0')
   587  	}
   588  
   589  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   590  	b = append(b, []byte{0x20}...)
   591  
   592  	tz, _ := t.Zone()
   593  
   594  	if btz, ok := mg.timezones[tz]; ok {
   595  		b = append(b, btz...)
   596  	} else {
   597  		b = append(b, tz...)
   598  	}
   599  
   600  	return string(b)
   601  }
   602  

View as plain text