...

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

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

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

View as plain text