...

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

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

     1  package sr_Latn_ME
     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 sr_Latn_ME 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 'sr_Latn_ME' locale
    46  func New() locales.Translator {
    47  	return &sr_Latn_ME{
    48  		locale:                 "sr_Latn_ME",
    49  		pluralsCardinal:        []locales.PluralRule{2, 4, 6},
    50  		pluralsOrdinal:         []locales.PluralRule{6},
    51  		pluralsRange:           []locales.PluralRule{2, 4, 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", "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"},
    60  		currencyPositiveSuffix: " ",
    61  		currencyNegativePrefix: "(",
    62  		currencyNegativeSuffix: " )",
    63  		monthsAbbreviated:      []string{"", "mart", "maj", "jun", "jul", "sept"},
    64  		monthsNarrow:           []string{"", "ј", "ф", "м", "а", "м", "ј", "ј", "а", "с", "о", "н", "д"},
    65  		monthsWide:             []string{"", "јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар"},
    66  		daysAbbreviated:        []string{"нед", "пон", "уто", "сре", "чет", "пет", "суб"},
    67  		daysNarrow:             []string{"н", "п", "у", "с", "ч", "п", "с"},
    68  		daysShort:              []string{"не", "по", "ут", "ср", "че", "пе", "су"},
    69  		daysWide:               []string{"nedjelja", "ponedeljak", "utorak", "srijeda", "četvrtak", "petak", "subota"},
    70  		periodsAbbreviated:     []string{"prije podne", "po podne"},
    71  		periodsNarrow:          []string{"", ""},
    72  		periodsWide:            []string{"prije podne", "po podne"},
    73  		erasAbbreviated:        []string{"", ""},
    74  		erasNarrow:             []string{"", ""},
    75  		erasWide:               []string{"", ""},
    76  		timezones:              map[string]string{"ACDT": "Аустралијско централно летње време", "ACST": "Аустралијско централно стандардно време", "ACWDT": "Аустралијско централно западно летње време", "ACWST": "Аустралијско централно западно стандардно време", "ADT": "Атлантско летње време", "AEDT": "Аустралијско источно летње време", "AEST": "Аустралијско источно стандардно време", "AKDT": "Аљаска, летње време", "AKST": "Аљаска, стандардно време", "ARST": "Аргентина, летње време", "ART": "Аргентина, стандардно време", "AST": "Атлантско стандардно време", "AWDT": "Аустралијско западно летње време", "AWST": "Аустралијско западно стандардно време", "BOT": "Боливија време", "BT": "Бутан време", "CAT": "Централно-афричко време", "CDT": "Северноамеричко централно летње време", "CHADT": "Чатам, летње време", "CHAST": "Чатам, стандардно време", "CLST": "Чиле, летње време", "CLT": "Чиле, стандардно време", "COST": "Колумбија, летње време", "COT": "Колумбија, стандардно време", "CST": "Северноамеричко централно стандардно време", "ChST": "Чаморо време", "EAT": "Источно-афричко време", "ECT": "Еквадор време", "EDT": "Северноамеричко источно летње време", "EST": "Северноамеричко источно стандардно време", "GFT": "Француска Гвајана време", "GMT": "Средње време по Гриничу", "GST": "Заливско време", "GYT": "Гвајана време", "HADT": "Хавајско-алеутско летње време", "HAST": "Хавајско-алеутско стандардно време", "HAT": "Њуфаундленд, летње време", "HECU": "Куба, летње време", "HEEG": "Источни Гренланд, летње време", "HENOMX": "Северозападни Мексико, летње време", "HEOG": "Западни Гренланд, летње време", "HEPM": "Сен Пјер и Микелон, летње време", "HEPMX": "Мексички Пацифик, летње време", "HKST": "Хонг Конг, летње време", "HKT": "Хонг Конг, стандардно време", "HNCU": "Куба, стандардно време", "HNEG": "Источни Гренланд, стандардно време", "HNNOMX": "Северозападни Мексико, стандардно време", "HNOG": "Западни Гренланд, стандардно време", "HNPM": "Сен Пјер и Микелон, стандардно време", "HNPMX": "Мексички Пацифик, стандардно време", "HNT": "Њуфаундленд, стандардно време", "IST": "Индијско стандардно време", "JDT": "Јапанско летње време", "JST": "Јапанско стандардно време", "LHDT": "Лорд Хов, летње време", "LHST": "Лорд Хов, стандардно време", "MDT": "Северноамеричко планинско летње време", "MESZ": "Средњеевропско летње време", "MEZ": "Средњеевропско стандардно време", "MST": "Северноамеричко планинско стандардно време", "MYT": "Малезија време", "NZDT": "Нови Зеланд, летње време", "NZST": "Нови Зеланд, стандардно време", "OESZ": "Источноевропско летње време", "OEZ": "Источноевропско стандардно време", "PDT": "Северноамеричко пацифичко летње време", "PST": "Северноамеричко пацифичко стандардно време", "SAST": "Јужно-афричко време", "SGT": "Сингапур, стандардно време", "SRT": "Суринам време", "TMST": "Туркменистан, летње време", "TMT": "Туркменистан, стандардно време", "UYST": "Уругвај, летње време", "UYT": "Уругвај, стандардно време", "VET": "Венецуела време", "WARST": "Западна Аргентина, летње време", "WART": "Западна Аргентина, стандардно време", "WAST": "Западно-афричко летње време", "WAT": "Западно-афричко стандардно време", "WESZ": "Западноевропско летње време", "WEZ": "Западноевропско стандардно време", "WIB": "Западно-индонезијско време", "WIT": "Источно-индонезијско време", "WITA": "Централно-индонезијско време", "∅∅∅": "Азори, летње време"},
    77  	}
    78  }
    79  
    80  // Locale returns the current translators string locale
    81  func (sr *sr_Latn_ME) Locale() string {
    82  	return sr.locale
    83  }
    84  
    85  // PluralsCardinal returns the list of cardinal plural rules associated with 'sr_Latn_ME'
    86  func (sr *sr_Latn_ME) PluralsCardinal() []locales.PluralRule {
    87  	return sr.pluralsCardinal
    88  }
    89  
    90  // PluralsOrdinal returns the list of ordinal plural rules associated with 'sr_Latn_ME'
    91  func (sr *sr_Latn_ME) PluralsOrdinal() []locales.PluralRule {
    92  	return sr.pluralsOrdinal
    93  }
    94  
    95  // PluralsRange returns the list of range plural rules associated with 'sr_Latn_ME'
    96  func (sr *sr_Latn_ME) PluralsRange() []locales.PluralRule {
    97  	return sr.pluralsRange
    98  }
    99  
   100  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'sr_Latn_ME'
   101  func (sr *sr_Latn_ME) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
   102  
   103  	n := math.Abs(num)
   104  	i := int64(n)
   105  	f := locales.F(n, v)
   106  	iMod10 := i % 10
   107  	iMod100 := i % 100
   108  	fMod10 := f % 10
   109  	fMod100 := f % 100
   110  
   111  	if (v == 0 && iMod10 == 1 && iMod100 != 11) || (fMod10 == 1 && fMod100 != 11) {
   112  		return locales.PluralRuleOne
   113  	} else if (v == 0 && iMod10 >= 2 && iMod10 <= 4 && (iMod100 < 12 || iMod100 > 14)) || (fMod10 >= 2 && fMod10 <= 4 && (fMod100 < 12 || fMod100 > 14)) {
   114  		return locales.PluralRuleFew
   115  	}
   116  
   117  	return locales.PluralRuleOther
   118  }
   119  
   120  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'sr_Latn_ME'
   121  func (sr *sr_Latn_ME) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   122  	return locales.PluralRuleOther
   123  }
   124  
   125  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'sr_Latn_ME'
   126  func (sr *sr_Latn_ME) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   127  
   128  	start := sr.CardinalPluralRule(num1, v1)
   129  	end := sr.CardinalPluralRule(num2, v2)
   130  
   131  	if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
   132  		return locales.PluralRuleOne
   133  	} else if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
   134  		return locales.PluralRuleFew
   135  	} else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
   136  		return locales.PluralRuleOther
   137  	} else if start == locales.PluralRuleFew && end == locales.PluralRuleOne {
   138  		return locales.PluralRuleOne
   139  	} else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
   140  		return locales.PluralRuleFew
   141  	} else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
   142  		return locales.PluralRuleOther
   143  	} else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
   144  		return locales.PluralRuleOne
   145  	} else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
   146  		return locales.PluralRuleFew
   147  	}
   148  
   149  	return locales.PluralRuleOther
   150  
   151  }
   152  
   153  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   154  func (sr *sr_Latn_ME) MonthAbbreviated(month time.Month) string {
   155  	return sr.monthsAbbreviated[month]
   156  }
   157  
   158  // MonthsAbbreviated returns the locales abbreviated months
   159  func (sr *sr_Latn_ME) MonthsAbbreviated() []string {
   160  	return sr.monthsAbbreviated[1:]
   161  }
   162  
   163  // MonthNarrow returns the locales narrow month given the 'month' provided
   164  func (sr *sr_Latn_ME) MonthNarrow(month time.Month) string {
   165  	return sr.monthsNarrow[month]
   166  }
   167  
   168  // MonthsNarrow returns the locales narrow months
   169  func (sr *sr_Latn_ME) MonthsNarrow() []string {
   170  	return sr.monthsNarrow[1:]
   171  }
   172  
   173  // MonthWide returns the locales wide month given the 'month' provided
   174  func (sr *sr_Latn_ME) MonthWide(month time.Month) string {
   175  	return sr.monthsWide[month]
   176  }
   177  
   178  // MonthsWide returns the locales wide months
   179  func (sr *sr_Latn_ME) MonthsWide() []string {
   180  	return sr.monthsWide[1:]
   181  }
   182  
   183  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   184  func (sr *sr_Latn_ME) WeekdayAbbreviated(weekday time.Weekday) string {
   185  	return sr.daysAbbreviated[weekday]
   186  }
   187  
   188  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   189  func (sr *sr_Latn_ME) WeekdaysAbbreviated() []string {
   190  	return sr.daysAbbreviated
   191  }
   192  
   193  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   194  func (sr *sr_Latn_ME) WeekdayNarrow(weekday time.Weekday) string {
   195  	return sr.daysNarrow[weekday]
   196  }
   197  
   198  // WeekdaysNarrow returns the locales narrow weekdays
   199  func (sr *sr_Latn_ME) WeekdaysNarrow() []string {
   200  	return sr.daysNarrow
   201  }
   202  
   203  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   204  func (sr *sr_Latn_ME) WeekdayShort(weekday time.Weekday) string {
   205  	return sr.daysShort[weekday]
   206  }
   207  
   208  // WeekdaysShort returns the locales short weekdays
   209  func (sr *sr_Latn_ME) WeekdaysShort() []string {
   210  	return sr.daysShort
   211  }
   212  
   213  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   214  func (sr *sr_Latn_ME) WeekdayWide(weekday time.Weekday) string {
   215  	return sr.daysWide[weekday]
   216  }
   217  
   218  // WeekdaysWide returns the locales wide weekdays
   219  func (sr *sr_Latn_ME) WeekdaysWide() []string {
   220  	return sr.daysWide
   221  }
   222  
   223  // Decimal returns the decimal point of number
   224  func (sr *sr_Latn_ME) Decimal() string {
   225  	return sr.decimal
   226  }
   227  
   228  // Group returns the group of number
   229  func (sr *sr_Latn_ME) Group() string {
   230  	return sr.group
   231  }
   232  
   233  // Group returns the minus sign of number
   234  func (sr *sr_Latn_ME) Minus() string {
   235  	return sr.minus
   236  }
   237  
   238  // FmtNumber returns 'num' with digits/precision of 'v' for 'sr_Latn_ME' and handles both Whole and Real numbers based on 'v'
   239  func (sr *sr_Latn_ME) FmtNumber(num float64, v uint64) string {
   240  
   241  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   242  	l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
   243  	count := 0
   244  	inWhole := v == 0
   245  	b := make([]byte, 0, l)
   246  
   247  	for i := len(s) - 1; i >= 0; i-- {
   248  
   249  		if s[i] == '.' {
   250  			b = append(b, sr.decimal[0])
   251  			inWhole = true
   252  			continue
   253  		}
   254  
   255  		if inWhole {
   256  			if count == 3 {
   257  				b = append(b, sr.group[0])
   258  				count = 1
   259  			} else {
   260  				count++
   261  			}
   262  		}
   263  
   264  		b = append(b, s[i])
   265  	}
   266  
   267  	if num < 0 {
   268  		b = append(b, sr.minus[0])
   269  	}
   270  
   271  	// reverse
   272  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   273  		b[i], b[j] = b[j], b[i]
   274  	}
   275  
   276  	return string(b)
   277  }
   278  
   279  // FmtPercent returns 'num' with digits/precision of 'v' for 'sr_Latn_ME' and handles both Whole and Real numbers based on 'v'
   280  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   281  func (sr *sr_Latn_ME) FmtPercent(num float64, v uint64) string {
   282  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   283  	l := len(s) + 3
   284  	b := make([]byte, 0, l)
   285  
   286  	for i := len(s) - 1; i >= 0; i-- {
   287  
   288  		if s[i] == '.' {
   289  			b = append(b, sr.decimal[0])
   290  			continue
   291  		}
   292  
   293  		b = append(b, s[i])
   294  	}
   295  
   296  	if num < 0 {
   297  		b = append(b, sr.minus[0])
   298  	}
   299  
   300  	// reverse
   301  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   302  		b[i], b[j] = b[j], b[i]
   303  	}
   304  
   305  	b = append(b, sr.percent...)
   306  
   307  	return string(b)
   308  }
   309  
   310  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'sr_Latn_ME'
   311  func (sr *sr_Latn_ME) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   312  
   313  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   314  	symbol := sr.currencies[currency]
   315  	l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
   316  	count := 0
   317  	inWhole := v == 0
   318  	b := make([]byte, 0, l)
   319  
   320  	for i := len(s) - 1; i >= 0; i-- {
   321  
   322  		if s[i] == '.' {
   323  			b = append(b, sr.decimal[0])
   324  			inWhole = true
   325  			continue
   326  		}
   327  
   328  		if inWhole {
   329  			if count == 3 {
   330  				b = append(b, sr.group[0])
   331  				count = 1
   332  			} else {
   333  				count++
   334  			}
   335  		}
   336  
   337  		b = append(b, s[i])
   338  	}
   339  
   340  	if num < 0 {
   341  		b = append(b, sr.minus[0])
   342  	}
   343  
   344  	// reverse
   345  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   346  		b[i], b[j] = b[j], b[i]
   347  	}
   348  
   349  	if int(v) < 2 {
   350  
   351  		if v == 0 {
   352  			b = append(b, sr.decimal...)
   353  		}
   354  
   355  		for i := 0; i < 2-int(v); i++ {
   356  			b = append(b, '0')
   357  		}
   358  	}
   359  
   360  	b = append(b, sr.currencyPositiveSuffix...)
   361  
   362  	b = append(b, symbol...)
   363  
   364  	return string(b)
   365  }
   366  
   367  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sr_Latn_ME'
   368  // in accounting notation.
   369  func (sr *sr_Latn_ME) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   370  
   371  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   372  	symbol := sr.currencies[currency]
   373  	l := len(s) + len(symbol) + 6 + 1*len(s[:len(s)-int(v)-1])/3
   374  	count := 0
   375  	inWhole := v == 0
   376  	b := make([]byte, 0, l)
   377  
   378  	for i := len(s) - 1; i >= 0; i-- {
   379  
   380  		if s[i] == '.' {
   381  			b = append(b, sr.decimal[0])
   382  			inWhole = true
   383  			continue
   384  		}
   385  
   386  		if inWhole {
   387  			if count == 3 {
   388  				b = append(b, sr.group[0])
   389  				count = 1
   390  			} else {
   391  				count++
   392  			}
   393  		}
   394  
   395  		b = append(b, s[i])
   396  	}
   397  
   398  	if num < 0 {
   399  
   400  		b = append(b, sr.currencyNegativePrefix[0])
   401  
   402  	}
   403  
   404  	// reverse
   405  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   406  		b[i], b[j] = b[j], b[i]
   407  	}
   408  
   409  	if int(v) < 2 {
   410  
   411  		if v == 0 {
   412  			b = append(b, sr.decimal...)
   413  		}
   414  
   415  		for i := 0; i < 2-int(v); i++ {
   416  			b = append(b, '0')
   417  		}
   418  	}
   419  
   420  	if num < 0 {
   421  		b = append(b, sr.currencyNegativeSuffix...)
   422  		b = append(b, symbol...)
   423  	} else {
   424  
   425  		b = append(b, sr.currencyPositiveSuffix...)
   426  		b = append(b, symbol...)
   427  	}
   428  
   429  	return string(b)
   430  }
   431  
   432  // FmtDateShort returns the short date representation of 't' for 'sr_Latn_ME'
   433  func (sr *sr_Latn_ME) FmtDateShort(t time.Time) string {
   434  
   435  	b := make([]byte, 0, 32)
   436  
   437  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   438  	b = append(b, []byte{0x2e}...)
   439  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   440  	b = append(b, []byte{0x2e}...)
   441  
   442  	if t.Year() > 9 {
   443  		b = append(b, strconv.Itoa(t.Year())[2:]...)
   444  	} else {
   445  		b = append(b, strconv.Itoa(t.Year())[1:]...)
   446  	}
   447  
   448  	b = append(b, []byte{0x2e}...)
   449  
   450  	return string(b)
   451  }
   452  
   453  // FmtDateMedium returns the medium date representation of 't' for 'sr_Latn_ME'
   454  func (sr *sr_Latn_ME) FmtDateMedium(t time.Time) string {
   455  
   456  	b := make([]byte, 0, 32)
   457  
   458  	if t.Day() < 10 {
   459  		b = append(b, '0')
   460  	}
   461  
   462  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   463  	b = append(b, []byte{0x2e}...)
   464  
   465  	if t.Month() < 10 {
   466  		b = append(b, '0')
   467  	}
   468  
   469  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   470  
   471  	b = append(b, []byte{0x2e}...)
   472  
   473  	if t.Year() > 0 {
   474  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   475  	} else {
   476  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   477  	}
   478  
   479  	b = append(b, []byte{0x2e}...)
   480  
   481  	return string(b)
   482  }
   483  
   484  // FmtDateLong returns the long date representation of 't' for 'sr_Latn_ME'
   485  func (sr *sr_Latn_ME) FmtDateLong(t time.Time) string {
   486  
   487  	b := make([]byte, 0, 32)
   488  
   489  	if t.Day() < 10 {
   490  		b = append(b, '0')
   491  	}
   492  
   493  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   494  	b = append(b, []byte{0x2e, 0x20}...)
   495  	b = append(b, sr.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  	b = append(b, []byte{0x2e}...)
   505  
   506  	return string(b)
   507  }
   508  
   509  // FmtDateFull returns the full date representation of 't' for 'sr_Latn_ME'
   510  func (sr *sr_Latn_ME) FmtDateFull(t time.Time) string {
   511  
   512  	b := make([]byte, 0, 32)
   513  
   514  	b = append(b, sr.daysWide[t.Weekday()]...)
   515  	b = append(b, []byte{0x2c, 0x20}...)
   516  
   517  	if t.Day() < 10 {
   518  		b = append(b, '0')
   519  	}
   520  
   521  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   522  	b = append(b, []byte{0x2e, 0x20}...)
   523  	b = append(b, sr.monthsWide[t.Month()]...)
   524  	b = append(b, []byte{0x20}...)
   525  
   526  	if t.Year() > 0 {
   527  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   528  	} else {
   529  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   530  	}
   531  
   532  	b = append(b, []byte{0x2e}...)
   533  
   534  	return string(b)
   535  }
   536  
   537  // FmtTimeShort returns the short time representation of 't' for 'sr_Latn_ME'
   538  func (sr *sr_Latn_ME) FmtTimeShort(t time.Time) string {
   539  
   540  	b := make([]byte, 0, 32)
   541  
   542  	if t.Hour() < 10 {
   543  		b = append(b, '0')
   544  	}
   545  
   546  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   547  	b = append(b, sr.timeSeparator...)
   548  
   549  	if t.Minute() < 10 {
   550  		b = append(b, '0')
   551  	}
   552  
   553  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   554  
   555  	return string(b)
   556  }
   557  
   558  // FmtTimeMedium returns the medium time representation of 't' for 'sr_Latn_ME'
   559  func (sr *sr_Latn_ME) FmtTimeMedium(t time.Time) string {
   560  
   561  	b := make([]byte, 0, 32)
   562  
   563  	if t.Hour() < 10 {
   564  		b = append(b, '0')
   565  	}
   566  
   567  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   568  	b = append(b, sr.timeSeparator...)
   569  
   570  	if t.Minute() < 10 {
   571  		b = append(b, '0')
   572  	}
   573  
   574  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   575  	b = append(b, sr.timeSeparator...)
   576  
   577  	if t.Second() < 10 {
   578  		b = append(b, '0')
   579  	}
   580  
   581  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   582  
   583  	return string(b)
   584  }
   585  
   586  // FmtTimeLong returns the long time representation of 't' for 'sr_Latn_ME'
   587  func (sr *sr_Latn_ME) FmtTimeLong(t time.Time) string {
   588  
   589  	b := make([]byte, 0, 32)
   590  
   591  	if t.Hour() < 10 {
   592  		b = append(b, '0')
   593  	}
   594  
   595  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   596  	b = append(b, sr.timeSeparator...)
   597  
   598  	if t.Minute() < 10 {
   599  		b = append(b, '0')
   600  	}
   601  
   602  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   603  	b = append(b, sr.timeSeparator...)
   604  
   605  	if t.Second() < 10 {
   606  		b = append(b, '0')
   607  	}
   608  
   609  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   610  	b = append(b, []byte{0x20}...)
   611  
   612  	tz, _ := t.Zone()
   613  	b = append(b, tz...)
   614  
   615  	return string(b)
   616  }
   617  
   618  // FmtTimeFull returns the full time representation of 't' for 'sr_Latn_ME'
   619  func (sr *sr_Latn_ME) FmtTimeFull(t time.Time) string {
   620  
   621  	b := make([]byte, 0, 32)
   622  
   623  	if t.Hour() < 10 {
   624  		b = append(b, '0')
   625  	}
   626  
   627  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   628  	b = append(b, sr.timeSeparator...)
   629  
   630  	if t.Minute() < 10 {
   631  		b = append(b, '0')
   632  	}
   633  
   634  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   635  	b = append(b, sr.timeSeparator...)
   636  
   637  	if t.Second() < 10 {
   638  		b = append(b, '0')
   639  	}
   640  
   641  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   642  	b = append(b, []byte{0x20}...)
   643  
   644  	tz, _ := t.Zone()
   645  
   646  	if btz, ok := sr.timezones[tz]; ok {
   647  		b = append(b, btz...)
   648  	} else {
   649  		b = append(b, tz...)
   650  	}
   651  
   652  	return string(b)
   653  }
   654  

View as plain text