...

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

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

     1  package nmg_CM
     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 nmg_CM 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  	currencyPositiveSuffix 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 'nmg_CM' locale
    45  func New() locales.Translator {
    46  	return &nmg_CM{
    47  		locale:                 "nmg_CM",
    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  		currencyPositiveSuffix: " ",
    56  		currencyNegativeSuffix: " ",
    57  		monthsAbbreviated:      []string{"", "ng1", "ng2", "ng3", "ng4", "ng5", "ng6", "ng7", "ng8", "ng9", "ng10", "ng11", "kris"},
    58  		monthsWide:             []string{"", "ngwɛn matáhra", "ngwɛn ńmba", "ngwɛn ńlal", "ngwɛn ńna", "ngwɛn ńtan", "ngwɛn ńtuó", "ngwɛn hɛmbuɛrí", "ngwɛn lɔmbi", "ngwɛn rɛbvuâ", "ngwɛn wum", "ngwɛn wum navǔr", "krísimin"},
    59  		daysAbbreviated:        []string{"sɔ́n", "mɔ́n", "smb", "sml", "smn", "mbs", "sas"},
    60  		daysNarrow:             []string{"s", "m", "s", "s", "s", "m", "s"},
    61  		daysWide:               []string{"sɔ́ndɔ", "mɔ́ndɔ", "sɔ́ndɔ mafú mába", "sɔ́ndɔ mafú málal", "sɔ́ndɔ mafú mána", "mabágá má sukul", "sásadi"},
    62  		periodsAbbreviated:     []string{"maná", "kugú"},
    63  		periodsWide:            []string{"maná", "kugú"},
    64  		erasAbbreviated:        []string{"BL", "PB"},
    65  		erasNarrow:             []string{"", ""},
    66  		erasWide:               []string{"Bó Lahlɛ̄", "Pfiɛ Burī"},
    67  		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", "∅∅∅": "∅∅∅"},
    68  	}
    69  }
    70  
    71  // Locale returns the current translators string locale
    72  func (nmg *nmg_CM) Locale() string {
    73  	return nmg.locale
    74  }
    75  
    76  // PluralsCardinal returns the list of cardinal plural rules associated with 'nmg_CM'
    77  func (nmg *nmg_CM) PluralsCardinal() []locales.PluralRule {
    78  	return nmg.pluralsCardinal
    79  }
    80  
    81  // PluralsOrdinal returns the list of ordinal plural rules associated with 'nmg_CM'
    82  func (nmg *nmg_CM) PluralsOrdinal() []locales.PluralRule {
    83  	return nmg.pluralsOrdinal
    84  }
    85  
    86  // PluralsRange returns the list of range plural rules associated with 'nmg_CM'
    87  func (nmg *nmg_CM) PluralsRange() []locales.PluralRule {
    88  	return nmg.pluralsRange
    89  }
    90  
    91  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'nmg_CM'
    92  func (nmg *nmg_CM) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
    93  	return locales.PluralRuleUnknown
    94  }
    95  
    96  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'nmg_CM'
    97  func (nmg *nmg_CM) 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 'nmg_CM'
   102  func (nmg *nmg_CM) 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 (nmg *nmg_CM) MonthAbbreviated(month time.Month) string {
   108  	return nmg.monthsAbbreviated[month]
   109  }
   110  
   111  // MonthsAbbreviated returns the locales abbreviated months
   112  func (nmg *nmg_CM) MonthsAbbreviated() []string {
   113  	return nmg.monthsAbbreviated[1:]
   114  }
   115  
   116  // MonthNarrow returns the locales narrow month given the 'month' provided
   117  func (nmg *nmg_CM) MonthNarrow(month time.Month) string {
   118  	return nmg.monthsNarrow[month]
   119  }
   120  
   121  // MonthsNarrow returns the locales narrow months
   122  func (nmg *nmg_CM) MonthsNarrow() []string {
   123  	return nil
   124  }
   125  
   126  // MonthWide returns the locales wide month given the 'month' provided
   127  func (nmg *nmg_CM) MonthWide(month time.Month) string {
   128  	return nmg.monthsWide[month]
   129  }
   130  
   131  // MonthsWide returns the locales wide months
   132  func (nmg *nmg_CM) MonthsWide() []string {
   133  	return nmg.monthsWide[1:]
   134  }
   135  
   136  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   137  func (nmg *nmg_CM) WeekdayAbbreviated(weekday time.Weekday) string {
   138  	return nmg.daysAbbreviated[weekday]
   139  }
   140  
   141  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   142  func (nmg *nmg_CM) WeekdaysAbbreviated() []string {
   143  	return nmg.daysAbbreviated
   144  }
   145  
   146  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   147  func (nmg *nmg_CM) WeekdayNarrow(weekday time.Weekday) string {
   148  	return nmg.daysNarrow[weekday]
   149  }
   150  
   151  // WeekdaysNarrow returns the locales narrow weekdays
   152  func (nmg *nmg_CM) WeekdaysNarrow() []string {
   153  	return nmg.daysNarrow
   154  }
   155  
   156  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   157  func (nmg *nmg_CM) WeekdayShort(weekday time.Weekday) string {
   158  	return nmg.daysShort[weekday]
   159  }
   160  
   161  // WeekdaysShort returns the locales short weekdays
   162  func (nmg *nmg_CM) WeekdaysShort() []string {
   163  	return nmg.daysShort
   164  }
   165  
   166  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   167  func (nmg *nmg_CM) WeekdayWide(weekday time.Weekday) string {
   168  	return nmg.daysWide[weekday]
   169  }
   170  
   171  // WeekdaysWide returns the locales wide weekdays
   172  func (nmg *nmg_CM) WeekdaysWide() []string {
   173  	return nmg.daysWide
   174  }
   175  
   176  // Decimal returns the decimal point of number
   177  func (nmg *nmg_CM) Decimal() string {
   178  	return nmg.decimal
   179  }
   180  
   181  // Group returns the group of number
   182  func (nmg *nmg_CM) Group() string {
   183  	return nmg.group
   184  }
   185  
   186  // Group returns the minus sign of number
   187  func (nmg *nmg_CM) Minus() string {
   188  	return nmg.minus
   189  }
   190  
   191  // FmtNumber returns 'num' with digits/precision of 'v' for 'nmg_CM' and handles both Whole and Real numbers based on 'v'
   192  func (nmg *nmg_CM) FmtNumber(num float64, v uint64) string {
   193  
   194  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   195  	l := len(s) + 1 + 2*len(s[:len(s)-int(v)-1])/3
   196  	count := 0
   197  	inWhole := v == 0
   198  	b := make([]byte, 0, l)
   199  
   200  	for i := len(s) - 1; i >= 0; i-- {
   201  
   202  		if s[i] == '.' {
   203  			b = append(b, nmg.decimal[0])
   204  			inWhole = true
   205  			continue
   206  		}
   207  
   208  		if inWhole {
   209  			if count == 3 {
   210  				for j := len(nmg.group) - 1; j >= 0; j-- {
   211  					b = append(b, nmg.group[j])
   212  				}
   213  				count = 1
   214  			} else {
   215  				count++
   216  			}
   217  		}
   218  
   219  		b = append(b, s[i])
   220  	}
   221  
   222  	if num < 0 {
   223  		b = append(b, nmg.minus[0])
   224  	}
   225  
   226  	// reverse
   227  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   228  		b[i], b[j] = b[j], b[i]
   229  	}
   230  
   231  	return string(b)
   232  }
   233  
   234  // FmtPercent returns 'num' with digits/precision of 'v' for 'nmg_CM' and handles both Whole and Real numbers based on 'v'
   235  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   236  func (nmg *nmg_CM) FmtPercent(num float64, v uint64) string {
   237  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   238  	l := len(s) + 1
   239  	b := make([]byte, 0, l)
   240  
   241  	for i := len(s) - 1; i >= 0; i-- {
   242  
   243  		if s[i] == '.' {
   244  			b = append(b, nmg.decimal[0])
   245  			continue
   246  		}
   247  
   248  		b = append(b, s[i])
   249  	}
   250  
   251  	if num < 0 {
   252  		b = append(b, nmg.minus[0])
   253  	}
   254  
   255  	// reverse
   256  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   257  		b[i], b[j] = b[j], b[i]
   258  	}
   259  
   260  	b = append(b, nmg.percent...)
   261  
   262  	return string(b)
   263  }
   264  
   265  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'nmg_CM'
   266  func (nmg *nmg_CM) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   267  
   268  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   269  	symbol := nmg.currencies[currency]
   270  	l := len(s) + len(symbol) + 3 + 2*len(s[:len(s)-int(v)-1])/3
   271  	count := 0
   272  	inWhole := v == 0
   273  	b := make([]byte, 0, l)
   274  
   275  	for i := len(s) - 1; i >= 0; i-- {
   276  
   277  		if s[i] == '.' {
   278  			b = append(b, nmg.decimal[0])
   279  			inWhole = true
   280  			continue
   281  		}
   282  
   283  		if inWhole {
   284  			if count == 3 {
   285  				for j := len(nmg.group) - 1; j >= 0; j-- {
   286  					b = append(b, nmg.group[j])
   287  				}
   288  				count = 1
   289  			} else {
   290  				count++
   291  			}
   292  		}
   293  
   294  		b = append(b, s[i])
   295  	}
   296  
   297  	if num < 0 {
   298  		b = append(b, nmg.minus[0])
   299  	}
   300  
   301  	// reverse
   302  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   303  		b[i], b[j] = b[j], b[i]
   304  	}
   305  
   306  	if int(v) < 2 {
   307  
   308  		if v == 0 {
   309  			b = append(b, nmg.decimal...)
   310  		}
   311  
   312  		for i := 0; i < 2-int(v); i++ {
   313  			b = append(b, '0')
   314  		}
   315  	}
   316  
   317  	b = append(b, nmg.currencyPositiveSuffix...)
   318  
   319  	b = append(b, symbol...)
   320  
   321  	return string(b)
   322  }
   323  
   324  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nmg_CM'
   325  // in accounting notation.
   326  func (nmg *nmg_CM) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   327  
   328  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   329  	symbol := nmg.currencies[currency]
   330  	l := len(s) + len(symbol) + 3 + 2*len(s[:len(s)-int(v)-1])/3
   331  	count := 0
   332  	inWhole := v == 0
   333  	b := make([]byte, 0, l)
   334  
   335  	for i := len(s) - 1; i >= 0; i-- {
   336  
   337  		if s[i] == '.' {
   338  			b = append(b, nmg.decimal[0])
   339  			inWhole = true
   340  			continue
   341  		}
   342  
   343  		if inWhole {
   344  			if count == 3 {
   345  				for j := len(nmg.group) - 1; j >= 0; j-- {
   346  					b = append(b, nmg.group[j])
   347  				}
   348  				count = 1
   349  			} else {
   350  				count++
   351  			}
   352  		}
   353  
   354  		b = append(b, s[i])
   355  	}
   356  
   357  	if num < 0 {
   358  
   359  		b = append(b, nmg.minus[0])
   360  
   361  	}
   362  
   363  	// reverse
   364  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   365  		b[i], b[j] = b[j], b[i]
   366  	}
   367  
   368  	if int(v) < 2 {
   369  
   370  		if v == 0 {
   371  			b = append(b, nmg.decimal...)
   372  		}
   373  
   374  		for i := 0; i < 2-int(v); i++ {
   375  			b = append(b, '0')
   376  		}
   377  	}
   378  
   379  	if num < 0 {
   380  		b = append(b, nmg.currencyNegativeSuffix...)
   381  		b = append(b, symbol...)
   382  	} else {
   383  
   384  		b = append(b, nmg.currencyPositiveSuffix...)
   385  		b = append(b, symbol...)
   386  	}
   387  
   388  	return string(b)
   389  }
   390  
   391  // FmtDateShort returns the short date representation of 't' for 'nmg_CM'
   392  func (nmg *nmg_CM) 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 'nmg_CM'
   411  func (nmg *nmg_CM) 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, nmg.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 'nmg_CM'
   430  func (nmg *nmg_CM) 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, nmg.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 'nmg_CM'
   449  func (nmg *nmg_CM) FmtDateFull(t time.Time) string {
   450  
   451  	b := make([]byte, 0, 32)
   452  
   453  	b = append(b, nmg.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, nmg.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 'nmg_CM'
   470  func (nmg *nmg_CM) 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, nmg.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 'nmg_CM'
   491  func (nmg *nmg_CM) 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, nmg.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, nmg.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 'nmg_CM'
   519  func (nmg *nmg_CM) 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, nmg.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, nmg.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 'nmg_CM'
   551  func (nmg *nmg_CM) 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, nmg.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, nmg.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 := nmg.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