...

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

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

     1  package ro_MD
     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 ro_MD 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  	percentSuffix          string
    22  	perMille               string
    23  	timeSeparator          string
    24  	inifinity              string
    25  	currencies             []string // idx = enum of currency code
    26  	currencyPositiveSuffix string
    27  	currencyNegativePrefix string
    28  	currencyNegativeSuffix string
    29  	monthsAbbreviated      []string
    30  	monthsNarrow           []string
    31  	monthsWide             []string
    32  	daysAbbreviated        []string
    33  	daysNarrow             []string
    34  	daysShort              []string
    35  	daysWide               []string
    36  	periodsAbbreviated     []string
    37  	periodsNarrow          []string
    38  	periodsShort           []string
    39  	periodsWide            []string
    40  	erasAbbreviated        []string
    41  	erasNarrow             []string
    42  	erasWide               []string
    43  	timezones              map[string]string
    44  }
    45  
    46  // New returns a new instance of translator for the 'ro_MD' locale
    47  func New() locales.Translator {
    48  	return &ro_MD{
    49  		locale:                 "ro_MD",
    50  		pluralsCardinal:        []locales.PluralRule{2, 4, 6},
    51  		pluralsOrdinal:         []locales.PluralRule{2, 6},
    52  		pluralsRange:           []locales.PluralRule{4, 6},
    53  		decimal:                ",",
    54  		group:                  ".",
    55  		minus:                  "-",
    56  		percent:                "%",
    57  		perMille:               "‰",
    58  		timeSeparator:          ":",
    59  		inifinity:              "∞",
    60  		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", "L", "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"},
    61  		percentSuffix:          " ",
    62  		currencyPositiveSuffix: " ",
    63  		currencyNegativePrefix: "(",
    64  		currencyNegativeSuffix: " )",
    65  		monthsAbbreviated:      []string{"", "ian.", "feb.", "mar.", "apr.", "mai", "iun.", "iul.", "aug.", "sept.", "oct.", "nov.", "dec."},
    66  		monthsNarrow:           []string{"", "I", "F", "M", "A", "M", "I", "I", "A", "S", "O", "N", "D"},
    67  		monthsWide:             []string{"", "ianuarie", "februarie", "martie", "aprilie", "mai", "iunie", "iulie", "august", "septembrie", "octombrie", "noiembrie", "decembrie"},
    68  		daysAbbreviated:        []string{"Dum", "Lun", "Mar", "Mie", "Joi", "Vin", "Sâm"},
    69  		daysNarrow:             []string{"D", "L", "Ma", "Mi", "J", "V", "S"},
    70  		daysShort:              []string{"Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ"},
    71  		daysWide:               []string{"duminică", "luni", "marți", "miercuri", "joi", "vineri", "sâmbătă"},
    72  		periodsAbbreviated:     []string{"a.m.", "p.m."},
    73  		periodsNarrow:          []string{"", ""},
    74  		periodsWide:            []string{"", ""},
    75  		erasAbbreviated:        []string{"", ""},
    76  		erasNarrow:             []string{"", ""},
    77  		erasWide:               []string{"", ""},
    78  		timezones:              map[string]string{"ACDT": "Ora de vară a Australiei Centrale", "ACST": "Ora standard a Australiei Centrale", "ACWDT": "Ora de vară a Australiei Central Occidentale", "ACWST": "Ora standard a Australiei Central Occidentale", "ADT": "Ora de vară în zona Atlantic nord-americană", "AEDT": "Ora de vară a Australiei Orientale", "AEST": "Ora standard a Australiei Orientale", "AKDT": "Ora de vară din Alaska", "AKST": "Ora standard din Alaska", "ARST": "Ora de vară a Argentinei", "ART": "Ora standard a Argentinei", "AST": "Ora standard în zona Atlantic nord-americană", "AWDT": "Ora de vară a Australiei Occidentale", "AWST": "Ora standard a Australiei Occidentale", "BOT": "Ora Boliviei", "BT": "Ora Bhutanului", "CAT": "Ora Africii Centrale", "CDT": "Ora de vară centrală nord-americană", "CHADT": "Ora de vară din Chatham", "CHAST": "Ora standard din Chatham", "CLST": "Ora de vară din Chile", "CLT": "Ora standard din Chile", "COST": "Ora de vară a Columbiei", "COT": "Ora standard a Columbiei", "CST": "Ora standard centrală nord-americană", "ChST": "Ora din Chamorro", "EAT": "Ora Africii Orientale", "ECT": "Ora Ecuadorului", "EDT": "Ora de vară orientală nord-americană", "EST": "Ora standard orientală nord-americană", "GFT": "Ora din Guyana Franceză", "GMT": "Ora de Greenwhich", "GST": "Ora standard a Golfului", "GYT": "Ora din Guyana", "HADT": "Ora de vară din Hawaii-Aleutine", "HAST": "Ora standard din Hawaii-Aleutine", "HAT": "Ora de vară din Newfoundland", "HECU": "Ora de vară a Cubei", "HEEG": "Ora de vară a Groenlandei orientale", "HENOMX": "Ora de vară a Mexicului de nord-vest", "HEOG": "Ora de vară a Groenlandei occidentale", "HEPM": "Ora de vară din Saint-Pierre și Miquelon", "HEPMX": "Ora de vară a zonei Pacific mexicane", "HKST": "Ora de vară din Hong Kong", "HKT": "Ora standard din Hong Kong", "HNCU": "Ora standard a Cubei", "HNEG": "Ora standard a Groenlandei orientale", "HNNOMX": "Ora standard a Mexicului de nord-vest", "HNOG": "Ora standard a Groenlandei occidentale", "HNPM": "Ora standard din Saint-Pierre și Miquelon", "HNPMX": "Ora standard a zonei Pacific mexicane", "HNT": "Ora standard din Newfoundland", "IST": "Ora Indiei", "JDT": "Ora de vară a Japoniei", "JST": "Ora standard a Japoniei", "LHDT": "Ora de vară din Lord Howe", "LHST": "Ora standard din Lord Howe", "MDT": "Ora de vară în zona montană nord-americană", "MESZ": "Ora de vară a Europei Centrale", "MEZ": "Ora standard a Europei Centrale", "MST": "Ora standard în zona montană nord-americană", "MYT": "Ora din Malaysia", "NZDT": "Ora de vară a Noii Zeelande", "NZST": "Ora standard a Noii Zeelande", "OESZ": "Ora de vară a Europei de Est", "OEZ": "Ora standard a Europei de Est", "PDT": "Ora de vară în zona Pacific nord-americană", "PST": "Ora standard în zona Pacific nord-americană", "SAST": "Ora Africii Meridionale", "SGT": "Ora din Singapore", "SRT": "Ora Surinamului", "TMST": "Ora de vară din Turkmenistan", "TMT": "Ora standard din Turkmenistan", "UYST": "Ora de vară a Uruguayului", "UYT": "Ora standard a Uruguayului", "VET": "Ora Venezuelei", "WARST": "Ora de vară a Argentinei Occidentale", "WART": "Ora standard a Argentinei Occidentale", "WAST": "Ora de vară a Africii Occidentale", "WAT": "Ora standard a Africii Occidentale", "WESZ": "Ora de vară a Europei de Vest", "WEZ": "Ora standard a Europei de Vest", "WIB": "Ora Indoneziei de Vest", "WIT": "Ora Indoneziei de Est", "WITA": "Ora Indoneziei Centrale", "∅∅∅": "Ora de vară a Brasiliei"},
    79  	}
    80  }
    81  
    82  // Locale returns the current translators string locale
    83  func (ro *ro_MD) Locale() string {
    84  	return ro.locale
    85  }
    86  
    87  // PluralsCardinal returns the list of cardinal plural rules associated with 'ro_MD'
    88  func (ro *ro_MD) PluralsCardinal() []locales.PluralRule {
    89  	return ro.pluralsCardinal
    90  }
    91  
    92  // PluralsOrdinal returns the list of ordinal plural rules associated with 'ro_MD'
    93  func (ro *ro_MD) PluralsOrdinal() []locales.PluralRule {
    94  	return ro.pluralsOrdinal
    95  }
    96  
    97  // PluralsRange returns the list of range plural rules associated with 'ro_MD'
    98  func (ro *ro_MD) PluralsRange() []locales.PluralRule {
    99  	return ro.pluralsRange
   100  }
   101  
   102  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ro_MD'
   103  func (ro *ro_MD) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
   104  
   105  	n := math.Abs(num)
   106  	i := int64(n)
   107  	nMod100 := math.Mod(n, 100)
   108  
   109  	if i == 1 && v == 0 {
   110  		return locales.PluralRuleOne
   111  	} else if (v != 0) || (n == 0) || (nMod100 >= 2 && nMod100 <= 19) {
   112  		return locales.PluralRuleFew
   113  	}
   114  
   115  	return locales.PluralRuleOther
   116  }
   117  
   118  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ro_MD'
   119  func (ro *ro_MD) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   120  
   121  	n := math.Abs(num)
   122  
   123  	if n == 1 {
   124  		return locales.PluralRuleOne
   125  	}
   126  
   127  	return locales.PluralRuleOther
   128  }
   129  
   130  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ro_MD'
   131  func (ro *ro_MD) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   132  
   133  	start := ro.CardinalPluralRule(num1, v1)
   134  	end := ro.CardinalPluralRule(num2, v2)
   135  
   136  	if start == locales.PluralRuleOne && end == locales.PluralRuleFew {
   137  		return locales.PluralRuleFew
   138  	} else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
   139  		return locales.PluralRuleOther
   140  	} else if start == locales.PluralRuleFew && end == locales.PluralRuleOne {
   141  		return locales.PluralRuleFew
   142  	} else if start == locales.PluralRuleFew && end == locales.PluralRuleFew {
   143  		return locales.PluralRuleFew
   144  	} else if start == locales.PluralRuleFew && end == locales.PluralRuleOther {
   145  		return locales.PluralRuleOther
   146  	} else if start == locales.PluralRuleOther && end == locales.PluralRuleFew {
   147  		return locales.PluralRuleFew
   148  	}
   149  
   150  	return locales.PluralRuleOther
   151  
   152  }
   153  
   154  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   155  func (ro *ro_MD) MonthAbbreviated(month time.Month) string {
   156  	return ro.monthsAbbreviated[month]
   157  }
   158  
   159  // MonthsAbbreviated returns the locales abbreviated months
   160  func (ro *ro_MD) MonthsAbbreviated() []string {
   161  	return ro.monthsAbbreviated[1:]
   162  }
   163  
   164  // MonthNarrow returns the locales narrow month given the 'month' provided
   165  func (ro *ro_MD) MonthNarrow(month time.Month) string {
   166  	return ro.monthsNarrow[month]
   167  }
   168  
   169  // MonthsNarrow returns the locales narrow months
   170  func (ro *ro_MD) MonthsNarrow() []string {
   171  	return ro.monthsNarrow[1:]
   172  }
   173  
   174  // MonthWide returns the locales wide month given the 'month' provided
   175  func (ro *ro_MD) MonthWide(month time.Month) string {
   176  	return ro.monthsWide[month]
   177  }
   178  
   179  // MonthsWide returns the locales wide months
   180  func (ro *ro_MD) MonthsWide() []string {
   181  	return ro.monthsWide[1:]
   182  }
   183  
   184  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   185  func (ro *ro_MD) WeekdayAbbreviated(weekday time.Weekday) string {
   186  	return ro.daysAbbreviated[weekday]
   187  }
   188  
   189  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   190  func (ro *ro_MD) WeekdaysAbbreviated() []string {
   191  	return ro.daysAbbreviated
   192  }
   193  
   194  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   195  func (ro *ro_MD) WeekdayNarrow(weekday time.Weekday) string {
   196  	return ro.daysNarrow[weekday]
   197  }
   198  
   199  // WeekdaysNarrow returns the locales narrow weekdays
   200  func (ro *ro_MD) WeekdaysNarrow() []string {
   201  	return ro.daysNarrow
   202  }
   203  
   204  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   205  func (ro *ro_MD) WeekdayShort(weekday time.Weekday) string {
   206  	return ro.daysShort[weekday]
   207  }
   208  
   209  // WeekdaysShort returns the locales short weekdays
   210  func (ro *ro_MD) WeekdaysShort() []string {
   211  	return ro.daysShort
   212  }
   213  
   214  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   215  func (ro *ro_MD) WeekdayWide(weekday time.Weekday) string {
   216  	return ro.daysWide[weekday]
   217  }
   218  
   219  // WeekdaysWide returns the locales wide weekdays
   220  func (ro *ro_MD) WeekdaysWide() []string {
   221  	return ro.daysWide
   222  }
   223  
   224  // Decimal returns the decimal point of number
   225  func (ro *ro_MD) Decimal() string {
   226  	return ro.decimal
   227  }
   228  
   229  // Group returns the group of number
   230  func (ro *ro_MD) Group() string {
   231  	return ro.group
   232  }
   233  
   234  // Group returns the minus sign of number
   235  func (ro *ro_MD) Minus() string {
   236  	return ro.minus
   237  }
   238  
   239  // FmtNumber returns 'num' with digits/precision of 'v' for 'ro_MD' and handles both Whole and Real numbers based on 'v'
   240  func (ro *ro_MD) FmtNumber(num float64, v uint64) string {
   241  
   242  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   243  	l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
   244  	count := 0
   245  	inWhole := v == 0
   246  	b := make([]byte, 0, l)
   247  
   248  	for i := len(s) - 1; i >= 0; i-- {
   249  
   250  		if s[i] == '.' {
   251  			b = append(b, ro.decimal[0])
   252  			inWhole = true
   253  			continue
   254  		}
   255  
   256  		if inWhole {
   257  			if count == 3 {
   258  				b = append(b, ro.group[0])
   259  				count = 1
   260  			} else {
   261  				count++
   262  			}
   263  		}
   264  
   265  		b = append(b, s[i])
   266  	}
   267  
   268  	if num < 0 {
   269  		b = append(b, ro.minus[0])
   270  	}
   271  
   272  	// reverse
   273  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   274  		b[i], b[j] = b[j], b[i]
   275  	}
   276  
   277  	return string(b)
   278  }
   279  
   280  // FmtPercent returns 'num' with digits/precision of 'v' for 'ro_MD' and handles both Whole and Real numbers based on 'v'
   281  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   282  func (ro *ro_MD) FmtPercent(num float64, v uint64) string {
   283  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   284  	l := len(s) + 5
   285  	b := make([]byte, 0, l)
   286  
   287  	for i := len(s) - 1; i >= 0; i-- {
   288  
   289  		if s[i] == '.' {
   290  			b = append(b, ro.decimal[0])
   291  			continue
   292  		}
   293  
   294  		b = append(b, s[i])
   295  	}
   296  
   297  	if num < 0 {
   298  		b = append(b, ro.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  	b = append(b, ro.percentSuffix...)
   307  
   308  	b = append(b, ro.percent...)
   309  
   310  	return string(b)
   311  }
   312  
   313  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ro_MD'
   314  func (ro *ro_MD) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   315  
   316  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   317  	symbol := ro.currencies[currency]
   318  	l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
   319  	count := 0
   320  	inWhole := v == 0
   321  	b := make([]byte, 0, l)
   322  
   323  	for i := len(s) - 1; i >= 0; i-- {
   324  
   325  		if s[i] == '.' {
   326  			b = append(b, ro.decimal[0])
   327  			inWhole = true
   328  			continue
   329  		}
   330  
   331  		if inWhole {
   332  			if count == 3 {
   333  				b = append(b, ro.group[0])
   334  				count = 1
   335  			} else {
   336  				count++
   337  			}
   338  		}
   339  
   340  		b = append(b, s[i])
   341  	}
   342  
   343  	if num < 0 {
   344  		b = append(b, ro.minus[0])
   345  	}
   346  
   347  	// reverse
   348  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   349  		b[i], b[j] = b[j], b[i]
   350  	}
   351  
   352  	if int(v) < 2 {
   353  
   354  		if v == 0 {
   355  			b = append(b, ro.decimal...)
   356  		}
   357  
   358  		for i := 0; i < 2-int(v); i++ {
   359  			b = append(b, '0')
   360  		}
   361  	}
   362  
   363  	b = append(b, ro.currencyPositiveSuffix...)
   364  
   365  	b = append(b, symbol...)
   366  
   367  	return string(b)
   368  }
   369  
   370  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ro_MD'
   371  // in accounting notation.
   372  func (ro *ro_MD) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   373  
   374  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   375  	symbol := ro.currencies[currency]
   376  	l := len(s) + len(symbol) + 6 + 1*len(s[:len(s)-int(v)-1])/3
   377  	count := 0
   378  	inWhole := v == 0
   379  	b := make([]byte, 0, l)
   380  
   381  	for i := len(s) - 1; i >= 0; i-- {
   382  
   383  		if s[i] == '.' {
   384  			b = append(b, ro.decimal[0])
   385  			inWhole = true
   386  			continue
   387  		}
   388  
   389  		if inWhole {
   390  			if count == 3 {
   391  				b = append(b, ro.group[0])
   392  				count = 1
   393  			} else {
   394  				count++
   395  			}
   396  		}
   397  
   398  		b = append(b, s[i])
   399  	}
   400  
   401  	if num < 0 {
   402  
   403  		b = append(b, ro.currencyNegativePrefix[0])
   404  
   405  	}
   406  
   407  	// reverse
   408  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   409  		b[i], b[j] = b[j], b[i]
   410  	}
   411  
   412  	if int(v) < 2 {
   413  
   414  		if v == 0 {
   415  			b = append(b, ro.decimal...)
   416  		}
   417  
   418  		for i := 0; i < 2-int(v); i++ {
   419  			b = append(b, '0')
   420  		}
   421  	}
   422  
   423  	if num < 0 {
   424  		b = append(b, ro.currencyNegativeSuffix...)
   425  		b = append(b, symbol...)
   426  	} else {
   427  
   428  		b = append(b, ro.currencyPositiveSuffix...)
   429  		b = append(b, symbol...)
   430  	}
   431  
   432  	return string(b)
   433  }
   434  
   435  // FmtDateShort returns the short date representation of 't' for 'ro_MD'
   436  func (ro *ro_MD) FmtDateShort(t time.Time) string {
   437  
   438  	b := make([]byte, 0, 32)
   439  
   440  	if t.Day() < 10 {
   441  		b = append(b, '0')
   442  	}
   443  
   444  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   445  	b = append(b, []byte{0x2e}...)
   446  
   447  	if t.Month() < 10 {
   448  		b = append(b, '0')
   449  	}
   450  
   451  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   452  
   453  	b = append(b, []byte{0x2e}...)
   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  // FmtDateMedium returns the medium date representation of 't' for 'ro_MD'
   465  func (ro *ro_MD) FmtDateMedium(t time.Time) string {
   466  
   467  	b := make([]byte, 0, 32)
   468  
   469  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   470  	b = append(b, []byte{0x20}...)
   471  	b = append(b, ro.monthsAbbreviated[t.Month()]...)
   472  	b = append(b, []byte{0x20}...)
   473  
   474  	if t.Year() > 0 {
   475  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   476  	} else {
   477  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   478  	}
   479  
   480  	return string(b)
   481  }
   482  
   483  // FmtDateLong returns the long date representation of 't' for 'ro_MD'
   484  func (ro *ro_MD) FmtDateLong(t time.Time) string {
   485  
   486  	b := make([]byte, 0, 32)
   487  
   488  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   489  	b = append(b, []byte{0x20}...)
   490  	b = append(b, ro.monthsWide[t.Month()]...)
   491  	b = append(b, []byte{0x20}...)
   492  
   493  	if t.Year() > 0 {
   494  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   495  	} else {
   496  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   497  	}
   498  
   499  	return string(b)
   500  }
   501  
   502  // FmtDateFull returns the full date representation of 't' for 'ro_MD'
   503  func (ro *ro_MD) FmtDateFull(t time.Time) string {
   504  
   505  	b := make([]byte, 0, 32)
   506  
   507  	b = append(b, ro.daysWide[t.Weekday()]...)
   508  	b = append(b, []byte{0x2c, 0x20}...)
   509  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   510  	b = append(b, []byte{0x20}...)
   511  	b = append(b, ro.monthsWide[t.Month()]...)
   512  	b = append(b, []byte{0x20}...)
   513  
   514  	if t.Year() > 0 {
   515  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   516  	} else {
   517  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   518  	}
   519  
   520  	return string(b)
   521  }
   522  
   523  // FmtTimeShort returns the short time representation of 't' for 'ro_MD'
   524  func (ro *ro_MD) FmtTimeShort(t time.Time) string {
   525  
   526  	b := make([]byte, 0, 32)
   527  
   528  	if t.Hour() < 10 {
   529  		b = append(b, '0')
   530  	}
   531  
   532  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   533  	b = append(b, ro.timeSeparator...)
   534  
   535  	if t.Minute() < 10 {
   536  		b = append(b, '0')
   537  	}
   538  
   539  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   540  
   541  	return string(b)
   542  }
   543  
   544  // FmtTimeMedium returns the medium time representation of 't' for 'ro_MD'
   545  func (ro *ro_MD) FmtTimeMedium(t time.Time) string {
   546  
   547  	b := make([]byte, 0, 32)
   548  
   549  	if t.Hour() < 10 {
   550  		b = append(b, '0')
   551  	}
   552  
   553  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   554  	b = append(b, ro.timeSeparator...)
   555  
   556  	if t.Minute() < 10 {
   557  		b = append(b, '0')
   558  	}
   559  
   560  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   561  	b = append(b, ro.timeSeparator...)
   562  
   563  	if t.Second() < 10 {
   564  		b = append(b, '0')
   565  	}
   566  
   567  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   568  
   569  	return string(b)
   570  }
   571  
   572  // FmtTimeLong returns the long time representation of 't' for 'ro_MD'
   573  func (ro *ro_MD) FmtTimeLong(t time.Time) string {
   574  
   575  	b := make([]byte, 0, 32)
   576  
   577  	if t.Hour() < 10 {
   578  		b = append(b, '0')
   579  	}
   580  
   581  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   582  	b = append(b, ro.timeSeparator...)
   583  
   584  	if t.Minute() < 10 {
   585  		b = append(b, '0')
   586  	}
   587  
   588  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   589  	b = append(b, ro.timeSeparator...)
   590  
   591  	if t.Second() < 10 {
   592  		b = append(b, '0')
   593  	}
   594  
   595  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   596  	b = append(b, []byte{0x20}...)
   597  
   598  	tz, _ := t.Zone()
   599  	b = append(b, tz...)
   600  
   601  	return string(b)
   602  }
   603  
   604  // FmtTimeFull returns the full time representation of 't' for 'ro_MD'
   605  func (ro *ro_MD) FmtTimeFull(t time.Time) string {
   606  
   607  	b := make([]byte, 0, 32)
   608  
   609  	if t.Hour() < 10 {
   610  		b = append(b, '0')
   611  	}
   612  
   613  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   614  	b = append(b, ro.timeSeparator...)
   615  
   616  	if t.Minute() < 10 {
   617  		b = append(b, '0')
   618  	}
   619  
   620  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   621  	b = append(b, ro.timeSeparator...)
   622  
   623  	if t.Second() < 10 {
   624  		b = append(b, '0')
   625  	}
   626  
   627  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   628  	b = append(b, []byte{0x20}...)
   629  
   630  	tz, _ := t.Zone()
   631  
   632  	if btz, ok := ro.timezones[tz]; ok {
   633  		b = append(b, btz...)
   634  	} else {
   635  		b = append(b, tz...)
   636  	}
   637  
   638  	return string(b)
   639  }
   640  

View as plain text