...

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

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

     1  package sq_MK
     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 sq_MK 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  	currencyNegativePrefix string
    27  	currencyNegativeSuffix string
    28  	monthsAbbreviated      []string
    29  	monthsNarrow           []string
    30  	monthsWide             []string
    31  	daysAbbreviated        []string
    32  	daysNarrow             []string
    33  	daysShort              []string
    34  	daysWide               []string
    35  	periodsAbbreviated     []string
    36  	periodsNarrow          []string
    37  	periodsShort           []string
    38  	periodsWide            []string
    39  	erasAbbreviated        []string
    40  	erasNarrow             []string
    41  	erasWide               []string
    42  	timezones              map[string]string
    43  }
    44  
    45  // New returns a new instance of translator for the 'sq_MK' locale
    46  func New() locales.Translator {
    47  	return &sq_MK{
    48  		locale:                 "sq_MK",
    49  		pluralsCardinal:        []locales.PluralRule{2, 6},
    50  		pluralsOrdinal:         []locales.PluralRule{2, 5, 6},
    51  		pluralsRange:           []locales.PluralRule{2, 6},
    52  		decimal:                ",",
    53  		group:                  " ",
    54  		minus:                  "-",
    55  		percent:                "%",
    56  		perMille:               "‰",
    57  		timeSeparator:          ":",
    58  		inifinity:              "∞",
    59  		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", "den", "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"},
    60  		currencyPositiveSuffix: " ",
    61  		currencyNegativePrefix: "(",
    62  		currencyNegativeSuffix: " )",
    63  		monthsAbbreviated:      []string{"", "jan", "shk", "mar", "pri", "maj", "qer", "korr", "gush", "sht", "tet", "nën", "dhj"},
    64  		monthsNarrow:           []string{"", "j", "sh", "m", "p", "m", "q", "k", "g", "sh", "t", "n", "dh"},
    65  		monthsWide:             []string{"", "janar", "shkurt", "mars", "prill", "maj", "qershor", "korrik", "gusht", "shtator", "tetor", "nëntor", "dhjetor"},
    66  		daysAbbreviated:        []string{"Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Sht"},
    67  		daysNarrow:             []string{"d", "h", "m", "m", "e", "p", "sh"},
    68  		daysShort:              []string{"die", "hën", "mar", "mër", "enj", "pre", "sht"},
    69  		daysWide:               []string{"e diel", "e hënë", "e martë", "e mërkurë", "e enjte", "e premte", "e shtunë"},
    70  		periodsAbbreviated:     []string{"p.d.", "m.d."},
    71  		periodsNarrow:          []string{"p.d.", "m.d."},
    72  		periodsWide:            []string{"e paradites", "e pasdites"},
    73  		erasAbbreviated:        []string{"p.K.", "mb.K."},
    74  		erasNarrow:             []string{"p.K.", "mb.K."},
    75  		erasWide:               []string{"para Krishtit", "mbas Krishtit"},
    76  		timezones:              map[string]string{"ACDT": "Ora verore e Australisë Qendrore", "ACST": "Ora standarde e Australisë Qendrore", "ACWDT": "Ora verore e Australisë Qendroro-Perëndimore", "ACWST": "Ora standarde e Australisë Qendroro-Perëndimore", "ADT": "Ora verore e Atlantikut", "AEDT": "Ora verore e Australisë Lindore", "AEST": "Ora standarde e Australisë Lindore", "AKDT": "Ora verore e Alaskës", "AKST": "Ora standarde e Alaskës", "ARST": "Ora verore e Argjentinës", "ART": "Ora standarde e Argjentinës", "AST": "Ora standarde e Atlantikut", "AWDT": "Ora verore e Australisë Perëndimore", "AWST": "Ora standarde e Australisë Perëndimore", "BOT": "Ora e Bolivisë", "BT": "Ora e Butanit", "CAT": "Ora e Afrikës Qendrore", "CDT": "Ora verore e SHBA-së Qendrore", "CHADT": "Ora verore e Katamit", "CHAST": "Ora standarde e Katamit", "CLST": "Ora verore e Kilit", "CLT": "Ora standarde e Kilit", "COST": "Ora verore e Kolumbisë", "COT": "Ora standarde e Kolumbisë", "CST": "Ora standarde e SHBA-së Qendrore", "ChST": "Ora e Kamorros", "EAT": "Ora e Afrikës Lindore", "ECT": "Ora e Ekuadorit", "EDT": "Ora verore e SHBA-së Lindore", "EST": "Ora standarde e SHBA-së Lindore", "GFT": "Ora e Guajanës Franceze", "GMT": "Ora e Grinuiçit", "GST": "Ora e Gjirit", "GYT": "Ora e Guajanës", "HADT": "Ora verore e Ishujve Hauai-Aleutian", "HAST": "Ora standarde e Ishujve Hauai-Aleutian", "HAT": "Ora verore e Njufaundlendit [Tokës së Re]", "HECU": "Ora verore e Kubës", "HEEG": "Ora verore e Grenlandës Lindore", "HENOMX": "Ora verore e Meksikës Veriperëndimore", "HEOG": "Ora verore e Grënlandës Perëndimore", "HEPM": "Ora verore e Shën-Pier dhe Mikelon", "HEPMX": "Ora verore e Territoreve Meksikane të Bregut të Paqësorit", "HKST": "Ora verore e Hong-Kongut", "HKT": "Ora standarde e Hong-Kongut", "HNCU": "Ora standarde e Kubës", "HNEG": "Ora standarde e Grenlandës Lindore", "HNNOMX": "Ora standarde e Meksikës Veriperëndimore", "HNOG": "Ora standarde e Grënlandës Perëndimore", "HNPM": "Ora standarde e Shën-Pier dhe Mikelon", "HNPMX": "Ora standarde e Territoreve Meksikane të Bregut të Paqësorit", "HNT": "Ora standarde e Njufaundlendit [Tokës së Re]", "IST": "Ora standarde e Indisë", "JDT": "Ora verore e Japonisë", "JST": "Ora standarde e Japonisë", "LHDT": "Ora verore e Lord-Houit", "LHST": "Ora standarde e Lord-Houit", "MDT": "Ora verore e Territoreve Amerikane të Brezit Malor", "MESZ": "Ora verore e Evropës Qendrore", "MEZ": "Ora standarde e Evropës Qendrore", "MST": "Ora standarde e Territoreve Amerikane të Brezit Malor", "MYT": "Ora e Malajzisë", "NZDT": "Ora verore e Zelandës së Re", "NZST": "Ora standarde e Zelandës së Re", "OESZ": "Ora verore e Evropës Lindore", "OEZ": "Ora standarde e Evropës Lindore", "PDT": "Ora verore e Territoreve Amerikane të Bregut të Paqësorit", "PST": "Ora standarde e Territoreve Amerikane të Bregut të Paqësorit", "SAST": "Ora standarde e Afrikës Jugore", "SGT": "Ora e Singaporit", "SRT": "Ora e Surinamit", "TMST": "Ora verore e Turkmenistanit", "TMT": "Ora standarde e Turkmenistanit", "UYST": "Ora verore e Uruguait", "UYT": "Ora standarde e Uruguait", "VET": "Ora e Venezuelës", "WARST": "Ora verore e Argjentinës Perëndimore", "WART": "Ora standarde e Argjentinës Perëndimore", "WAST": "Ora verore e Afrikës Perëndimore", "WAT": "Ora standarde e Afrikës Perëndimore", "WESZ": "Ora verore e Evropës Perëndimore", "WEZ": "Ora standarde e Evropës Perëndimore", "WIB": "Ora e Indonezisë Perëndimore", "WIT": "Ora e Indonezisë Lindore", "WITA": "Ora e Indonezisë Qendrore", "∅∅∅": "Ora verore e Brazilisë"},
    77  	}
    78  }
    79  
    80  // Locale returns the current translators string locale
    81  func (sq *sq_MK) Locale() string {
    82  	return sq.locale
    83  }
    84  
    85  // PluralsCardinal returns the list of cardinal plural rules associated with 'sq_MK'
    86  func (sq *sq_MK) PluralsCardinal() []locales.PluralRule {
    87  	return sq.pluralsCardinal
    88  }
    89  
    90  // PluralsOrdinal returns the list of ordinal plural rules associated with 'sq_MK'
    91  func (sq *sq_MK) PluralsOrdinal() []locales.PluralRule {
    92  	return sq.pluralsOrdinal
    93  }
    94  
    95  // PluralsRange returns the list of range plural rules associated with 'sq_MK'
    96  func (sq *sq_MK) PluralsRange() []locales.PluralRule {
    97  	return sq.pluralsRange
    98  }
    99  
   100  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'sq_MK'
   101  func (sq *sq_MK) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
   102  
   103  	n := math.Abs(num)
   104  
   105  	if n == 1 {
   106  		return locales.PluralRuleOne
   107  	}
   108  
   109  	return locales.PluralRuleOther
   110  }
   111  
   112  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'sq_MK'
   113  func (sq *sq_MK) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   114  
   115  	n := math.Abs(num)
   116  	nMod10 := math.Mod(n, 10)
   117  	nMod100 := math.Mod(n, 100)
   118  
   119  	if n == 1 {
   120  		return locales.PluralRuleOne
   121  	} else if nMod10 == 4 && nMod100 != 14 {
   122  		return locales.PluralRuleMany
   123  	}
   124  
   125  	return locales.PluralRuleOther
   126  }
   127  
   128  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'sq_MK'
   129  func (sq *sq_MK) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   130  
   131  	start := sq.CardinalPluralRule(num1, v1)
   132  	end := sq.CardinalPluralRule(num2, v2)
   133  
   134  	if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
   135  		return locales.PluralRuleOther
   136  	} else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
   137  		return locales.PluralRuleOne
   138  	}
   139  
   140  	return locales.PluralRuleOther
   141  
   142  }
   143  
   144  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   145  func (sq *sq_MK) MonthAbbreviated(month time.Month) string {
   146  	return sq.monthsAbbreviated[month]
   147  }
   148  
   149  // MonthsAbbreviated returns the locales abbreviated months
   150  func (sq *sq_MK) MonthsAbbreviated() []string {
   151  	return sq.monthsAbbreviated[1:]
   152  }
   153  
   154  // MonthNarrow returns the locales narrow month given the 'month' provided
   155  func (sq *sq_MK) MonthNarrow(month time.Month) string {
   156  	return sq.monthsNarrow[month]
   157  }
   158  
   159  // MonthsNarrow returns the locales narrow months
   160  func (sq *sq_MK) MonthsNarrow() []string {
   161  	return sq.monthsNarrow[1:]
   162  }
   163  
   164  // MonthWide returns the locales wide month given the 'month' provided
   165  func (sq *sq_MK) MonthWide(month time.Month) string {
   166  	return sq.monthsWide[month]
   167  }
   168  
   169  // MonthsWide returns the locales wide months
   170  func (sq *sq_MK) MonthsWide() []string {
   171  	return sq.monthsWide[1:]
   172  }
   173  
   174  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   175  func (sq *sq_MK) WeekdayAbbreviated(weekday time.Weekday) string {
   176  	return sq.daysAbbreviated[weekday]
   177  }
   178  
   179  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   180  func (sq *sq_MK) WeekdaysAbbreviated() []string {
   181  	return sq.daysAbbreviated
   182  }
   183  
   184  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   185  func (sq *sq_MK) WeekdayNarrow(weekday time.Weekday) string {
   186  	return sq.daysNarrow[weekday]
   187  }
   188  
   189  // WeekdaysNarrow returns the locales narrow weekdays
   190  func (sq *sq_MK) WeekdaysNarrow() []string {
   191  	return sq.daysNarrow
   192  }
   193  
   194  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   195  func (sq *sq_MK) WeekdayShort(weekday time.Weekday) string {
   196  	return sq.daysShort[weekday]
   197  }
   198  
   199  // WeekdaysShort returns the locales short weekdays
   200  func (sq *sq_MK) WeekdaysShort() []string {
   201  	return sq.daysShort
   202  }
   203  
   204  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   205  func (sq *sq_MK) WeekdayWide(weekday time.Weekday) string {
   206  	return sq.daysWide[weekday]
   207  }
   208  
   209  // WeekdaysWide returns the locales wide weekdays
   210  func (sq *sq_MK) WeekdaysWide() []string {
   211  	return sq.daysWide
   212  }
   213  
   214  // Decimal returns the decimal point of number
   215  func (sq *sq_MK) Decimal() string {
   216  	return sq.decimal
   217  }
   218  
   219  // Group returns the group of number
   220  func (sq *sq_MK) Group() string {
   221  	return sq.group
   222  }
   223  
   224  // Group returns the minus sign of number
   225  func (sq *sq_MK) Minus() string {
   226  	return sq.minus
   227  }
   228  
   229  // FmtNumber returns 'num' with digits/precision of 'v' for 'sq_MK' and handles both Whole and Real numbers based on 'v'
   230  func (sq *sq_MK) FmtNumber(num float64, v uint64) string {
   231  
   232  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   233  	l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
   234  	count := 0
   235  	inWhole := v == 0
   236  	b := make([]byte, 0, l)
   237  
   238  	for i := len(s) - 1; i >= 0; i-- {
   239  
   240  		if s[i] == '.' {
   241  			b = append(b, sq.decimal[0])
   242  			inWhole = true
   243  			continue
   244  		}
   245  
   246  		if inWhole {
   247  			if count == 3 {
   248  				for j := len(sq.group) - 1; j >= 0; j-- {
   249  					b = append(b, sq.group[j])
   250  				}
   251  				count = 1
   252  			} else {
   253  				count++
   254  			}
   255  		}
   256  
   257  		b = append(b, s[i])
   258  	}
   259  
   260  	if num < 0 {
   261  		b = append(b, sq.minus[0])
   262  	}
   263  
   264  	// reverse
   265  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   266  		b[i], b[j] = b[j], b[i]
   267  	}
   268  
   269  	return string(b)
   270  }
   271  
   272  // FmtPercent returns 'num' with digits/precision of 'v' for 'sq_MK' and handles both Whole and Real numbers based on 'v'
   273  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   274  func (sq *sq_MK) FmtPercent(num float64, v uint64) string {
   275  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   276  	l := len(s) + 3
   277  	b := make([]byte, 0, l)
   278  
   279  	for i := len(s) - 1; i >= 0; i-- {
   280  
   281  		if s[i] == '.' {
   282  			b = append(b, sq.decimal[0])
   283  			continue
   284  		}
   285  
   286  		b = append(b, s[i])
   287  	}
   288  
   289  	if num < 0 {
   290  		b = append(b, sq.minus[0])
   291  	}
   292  
   293  	// reverse
   294  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   295  		b[i], b[j] = b[j], b[i]
   296  	}
   297  
   298  	b = append(b, sq.percent...)
   299  
   300  	return string(b)
   301  }
   302  
   303  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'sq_MK'
   304  func (sq *sq_MK) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   305  
   306  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   307  	symbol := sq.currencies[currency]
   308  	l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
   309  	count := 0
   310  	inWhole := v == 0
   311  	b := make([]byte, 0, l)
   312  
   313  	for i := len(s) - 1; i >= 0; i-- {
   314  
   315  		if s[i] == '.' {
   316  			b = append(b, sq.decimal[0])
   317  			inWhole = true
   318  			continue
   319  		}
   320  
   321  		if inWhole {
   322  			if count == 3 {
   323  				for j := len(sq.group) - 1; j >= 0; j-- {
   324  					b = append(b, sq.group[j])
   325  				}
   326  				count = 1
   327  			} else {
   328  				count++
   329  			}
   330  		}
   331  
   332  		b = append(b, s[i])
   333  	}
   334  
   335  	if num < 0 {
   336  		b = append(b, sq.minus[0])
   337  	}
   338  
   339  	// reverse
   340  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   341  		b[i], b[j] = b[j], b[i]
   342  	}
   343  
   344  	if int(v) < 2 {
   345  
   346  		if v == 0 {
   347  			b = append(b, sq.decimal...)
   348  		}
   349  
   350  		for i := 0; i < 2-int(v); i++ {
   351  			b = append(b, '0')
   352  		}
   353  	}
   354  
   355  	b = append(b, sq.currencyPositiveSuffix...)
   356  
   357  	b = append(b, symbol...)
   358  
   359  	return string(b)
   360  }
   361  
   362  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sq_MK'
   363  // in accounting notation.
   364  func (sq *sq_MK) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   365  
   366  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   367  	symbol := sq.currencies[currency]
   368  	l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
   369  	count := 0
   370  	inWhole := v == 0
   371  	b := make([]byte, 0, l)
   372  
   373  	for i := len(s) - 1; i >= 0; i-- {
   374  
   375  		if s[i] == '.' {
   376  			b = append(b, sq.decimal[0])
   377  			inWhole = true
   378  			continue
   379  		}
   380  
   381  		if inWhole {
   382  			if count == 3 {
   383  				for j := len(sq.group) - 1; j >= 0; j-- {
   384  					b = append(b, sq.group[j])
   385  				}
   386  				count = 1
   387  			} else {
   388  				count++
   389  			}
   390  		}
   391  
   392  		b = append(b, s[i])
   393  	}
   394  
   395  	if num < 0 {
   396  
   397  		b = append(b, sq.currencyNegativePrefix[0])
   398  
   399  	}
   400  
   401  	// reverse
   402  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   403  		b[i], b[j] = b[j], b[i]
   404  	}
   405  
   406  	if int(v) < 2 {
   407  
   408  		if v == 0 {
   409  			b = append(b, sq.decimal...)
   410  		}
   411  
   412  		for i := 0; i < 2-int(v); i++ {
   413  			b = append(b, '0')
   414  		}
   415  	}
   416  
   417  	if num < 0 {
   418  		b = append(b, sq.currencyNegativeSuffix...)
   419  		b = append(b, symbol...)
   420  	} else {
   421  
   422  		b = append(b, sq.currencyPositiveSuffix...)
   423  		b = append(b, symbol...)
   424  	}
   425  
   426  	return string(b)
   427  }
   428  
   429  // FmtDateShort returns the short date representation of 't' for 'sq_MK'
   430  func (sq *sq_MK) FmtDateShort(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{0x2e}...)
   436  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   437  	b = append(b, []byte{0x2e}...)
   438  
   439  	if t.Year() > 9 {
   440  		b = append(b, strconv.Itoa(t.Year())[2:]...)
   441  	} else {
   442  		b = append(b, strconv.Itoa(t.Year())[1:]...)
   443  	}
   444  
   445  	return string(b)
   446  }
   447  
   448  // FmtDateMedium returns the medium date representation of 't' for 'sq_MK'
   449  func (sq *sq_MK) FmtDateMedium(t time.Time) string {
   450  
   451  	b := make([]byte, 0, 32)
   452  
   453  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   454  	b = append(b, []byte{0x20}...)
   455  	b = append(b, sq.monthsAbbreviated[t.Month()]...)
   456  	b = append(b, []byte{0x20}...)
   457  
   458  	if t.Year() > 0 {
   459  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   460  	} else {
   461  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   462  	}
   463  
   464  	return string(b)
   465  }
   466  
   467  // FmtDateLong returns the long date representation of 't' for 'sq_MK'
   468  func (sq *sq_MK) FmtDateLong(t time.Time) string {
   469  
   470  	b := make([]byte, 0, 32)
   471  
   472  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   473  	b = append(b, []byte{0x20}...)
   474  	b = append(b, sq.monthsWide[t.Month()]...)
   475  	b = append(b, []byte{0x20}...)
   476  
   477  	if t.Year() > 0 {
   478  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   479  	} else {
   480  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   481  	}
   482  
   483  	return string(b)
   484  }
   485  
   486  // FmtDateFull returns the full date representation of 't' for 'sq_MK'
   487  func (sq *sq_MK) FmtDateFull(t time.Time) string {
   488  
   489  	b := make([]byte, 0, 32)
   490  
   491  	b = append(b, sq.daysWide[t.Weekday()]...)
   492  	b = append(b, []byte{0x2c, 0x20}...)
   493  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   494  	b = append(b, []byte{0x20}...)
   495  	b = append(b, sq.monthsWide[t.Month()]...)
   496  	b = append(b, []byte{0x20}...)
   497  
   498  	if t.Year() > 0 {
   499  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   500  	} else {
   501  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   502  	}
   503  
   504  	return string(b)
   505  }
   506  
   507  // FmtTimeShort returns the short time representation of 't' for 'sq_MK'
   508  func (sq *sq_MK) FmtTimeShort(t time.Time) string {
   509  
   510  	b := make([]byte, 0, 32)
   511  
   512  	if t.Hour() < 10 {
   513  		b = append(b, '0')
   514  	}
   515  
   516  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   517  	b = append(b, sq.timeSeparator...)
   518  
   519  	if t.Minute() < 10 {
   520  		b = append(b, '0')
   521  	}
   522  
   523  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   524  
   525  	return string(b)
   526  }
   527  
   528  // FmtTimeMedium returns the medium time representation of 't' for 'sq_MK'
   529  func (sq *sq_MK) FmtTimeMedium(t time.Time) string {
   530  
   531  	b := make([]byte, 0, 32)
   532  
   533  	if t.Hour() < 10 {
   534  		b = append(b, '0')
   535  	}
   536  
   537  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   538  	b = append(b, sq.timeSeparator...)
   539  
   540  	if t.Minute() < 10 {
   541  		b = append(b, '0')
   542  	}
   543  
   544  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   545  	b = append(b, sq.timeSeparator...)
   546  
   547  	if t.Second() < 10 {
   548  		b = append(b, '0')
   549  	}
   550  
   551  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   552  
   553  	return string(b)
   554  }
   555  
   556  // FmtTimeLong returns the long time representation of 't' for 'sq_MK'
   557  func (sq *sq_MK) FmtTimeLong(t time.Time) string {
   558  
   559  	b := make([]byte, 0, 32)
   560  
   561  	if t.Hour() < 10 {
   562  		b = append(b, '0')
   563  	}
   564  
   565  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   566  	b = append(b, sq.timeSeparator...)
   567  
   568  	if t.Minute() < 10 {
   569  		b = append(b, '0')
   570  	}
   571  
   572  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   573  	b = append(b, sq.timeSeparator...)
   574  
   575  	if t.Second() < 10 {
   576  		b = append(b, '0')
   577  	}
   578  
   579  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   580  	b = append(b, []byte{0x20}...)
   581  
   582  	tz, _ := t.Zone()
   583  	b = append(b, tz...)
   584  
   585  	return string(b)
   586  }
   587  
   588  // FmtTimeFull returns the full time representation of 't' for 'sq_MK'
   589  func (sq *sq_MK) FmtTimeFull(t time.Time) string {
   590  
   591  	b := make([]byte, 0, 32)
   592  
   593  	if t.Hour() < 10 {
   594  		b = append(b, '0')
   595  	}
   596  
   597  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   598  	b = append(b, sq.timeSeparator...)
   599  
   600  	if t.Minute() < 10 {
   601  		b = append(b, '0')
   602  	}
   603  
   604  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   605  	b = append(b, sq.timeSeparator...)
   606  
   607  	if t.Second() < 10 {
   608  		b = append(b, '0')
   609  	}
   610  
   611  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   612  	b = append(b, []byte{0x20}...)
   613  
   614  	tz, _ := t.Zone()
   615  
   616  	if btz, ok := sq.timezones[tz]; ok {
   617  		b = append(b, btz...)
   618  	} else {
   619  		b = append(b, tz...)
   620  	}
   621  
   622  	return string(b)
   623  }
   624  

View as plain text