...

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

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

     1  package ku_TR
     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 ku_TR 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 'ku_TR' locale
    46  func New() locales.Translator {
    47  	return &ku_TR{
    48  		locale:                 "ku_TR",
    49  		pluralsCardinal:        []locales.PluralRule{2, 6},
    50  		pluralsOrdinal:         nil,
    51  		pluralsRange:           nil,
    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{"", "rêb", "reş", "ada", "avr", "gul", "pûş", "tîr", "gel", "rez", "kew", "ser", "ber"},
    64  		monthsNarrow:           []string{"", "R", "R", "A", "A", "G", "P", "T", "G", "R", "K", "S", "B"},
    65  		monthsWide:             []string{"", "rêbendanê", "reşemiyê", "adarê", "avrêlê", "gulanê", "pûşperê", "tîrmehê", "gelawêjê", "rezberê", "kewçêrê", "sermawezê", "berfanbarê"},
    66  		daysAbbreviated:        []string{"yş", "dş", "sş", "çş", "pş", "în", "ş"},
    67  		daysNarrow:             []string{"Y", "D", "S", "Ç", "P", "Î", "Ş"},
    68  		daysShort:              []string{"yş", "dş", "sş", "çş", "pş", "în", "ş"},
    69  		daysWide:               []string{"yekşem", "duşem", "sêşem", "çarşem", "pêncşem", "în", "şemî"},
    70  		periodsAbbreviated:     []string{"BN", "PN"},
    71  		periodsWide:            []string{"BN", "PN"},
    72  		erasAbbreviated:        []string{"BZ", "PZ"},
    73  		erasNarrow:             []string{"", ""},
    74  		erasWide:               []string{"berî zayînê", "piştî zayînê"},
    75  		timezones:              map[string]string{"ACDT": "ACDT", "ACST": "ACST", "ACWDT": "ACWDT", "ACWST": "ACWST", "ADT": "ADT", "AEDT": "AEDT", "AEST": "AEST", "AKDT": "AKDT", "AKST": "AKST", "ARST": "ARST", "ART": "ART", "AST": "AST", "AWDT": "AWDT", "AWST": "AWST", "BOT": "BOT", "BT": "BT", "CAT": "CAT", "CDT": "CDT", "CHADT": "CHADT", "CHAST": "CHAST", "CLST": "CLST", "CLT": "CLT", "COST": "COST", "COT": "COT", "CST": "CST", "ChST": "ChST", "EAT": "EAT", "ECT": "ECT", "EDT": "EDT", "EST": "EST", "GFT": "GFT", "GMT": "GMT", "GST": "GST", "GYT": "GYT", "HADT": "HADT", "HAST": "HAST", "HAT": "HAT", "HECU": "HECU", "HEEG": "HEEG", "HENOMX": "HENOMX", "HEOG": "HEOG", "HEPM": "HEPM", "HEPMX": "HEPMX", "HKST": "HKST", "HKT": "HKT", "HNCU": "HNCU", "HNEG": "HNEG", "HNNOMX": "HNNOMX", "HNOG": "HNOG", "HNPM": "HNPM", "HNPMX": "HNPMX", "HNT": "HNT", "IST": "IST", "JDT": "JDT", "JST": "JST", "LHDT": "LHDT", "LHST": "LHST", "MDT": "MDT", "MESZ": "MESZ", "MEZ": "MEZ", "MST": "MST", "MYT": "MYT", "NZDT": "NZDT", "NZST": "NZST", "OESZ": "OESZ", "OEZ": "OEZ", "PDT": "PDT", "PST": "PST", "SAST": "SAST", "SGT": "SGT", "SRT": "SRT", "TMST": "TMST", "TMT": "TMT", "UYST": "UYST", "UYT": "UYT", "VET": "VET", "WARST": "WARST", "WART": "WART", "WAST": "WAST", "WAT": "WAT", "WESZ": "WESZ", "WEZ": "WEZ", "WIB": "WIB", "WIT": "WIT", "WITA": "WITA", "∅∅∅": "∅∅∅"},
    76  	}
    77  }
    78  
    79  // Locale returns the current translators string locale
    80  func (ku *ku_TR) Locale() string {
    81  	return ku.locale
    82  }
    83  
    84  // PluralsCardinal returns the list of cardinal plural rules associated with 'ku_TR'
    85  func (ku *ku_TR) PluralsCardinal() []locales.PluralRule {
    86  	return ku.pluralsCardinal
    87  }
    88  
    89  // PluralsOrdinal returns the list of ordinal plural rules associated with 'ku_TR'
    90  func (ku *ku_TR) PluralsOrdinal() []locales.PluralRule {
    91  	return ku.pluralsOrdinal
    92  }
    93  
    94  // PluralsRange returns the list of range plural rules associated with 'ku_TR'
    95  func (ku *ku_TR) PluralsRange() []locales.PluralRule {
    96  	return ku.pluralsRange
    97  }
    98  
    99  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ku_TR'
   100  func (ku *ku_TR) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
   101  
   102  	n := math.Abs(num)
   103  
   104  	if n == 1 {
   105  		return locales.PluralRuleOne
   106  	}
   107  
   108  	return locales.PluralRuleOther
   109  }
   110  
   111  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ku_TR'
   112  func (ku *ku_TR) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
   113  	return locales.PluralRuleUnknown
   114  }
   115  
   116  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ku_TR'
   117  func (ku *ku_TR) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   118  	return locales.PluralRuleUnknown
   119  }
   120  
   121  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   122  func (ku *ku_TR) MonthAbbreviated(month time.Month) string {
   123  	return ku.monthsAbbreviated[month]
   124  }
   125  
   126  // MonthsAbbreviated returns the locales abbreviated months
   127  func (ku *ku_TR) MonthsAbbreviated() []string {
   128  	return ku.monthsAbbreviated[1:]
   129  }
   130  
   131  // MonthNarrow returns the locales narrow month given the 'month' provided
   132  func (ku *ku_TR) MonthNarrow(month time.Month) string {
   133  	return ku.monthsNarrow[month]
   134  }
   135  
   136  // MonthsNarrow returns the locales narrow months
   137  func (ku *ku_TR) MonthsNarrow() []string {
   138  	return ku.monthsNarrow[1:]
   139  }
   140  
   141  // MonthWide returns the locales wide month given the 'month' provided
   142  func (ku *ku_TR) MonthWide(month time.Month) string {
   143  	return ku.monthsWide[month]
   144  }
   145  
   146  // MonthsWide returns the locales wide months
   147  func (ku *ku_TR) MonthsWide() []string {
   148  	return ku.monthsWide[1:]
   149  }
   150  
   151  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   152  func (ku *ku_TR) WeekdayAbbreviated(weekday time.Weekday) string {
   153  	return ku.daysAbbreviated[weekday]
   154  }
   155  
   156  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   157  func (ku *ku_TR) WeekdaysAbbreviated() []string {
   158  	return ku.daysAbbreviated
   159  }
   160  
   161  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   162  func (ku *ku_TR) WeekdayNarrow(weekday time.Weekday) string {
   163  	return ku.daysNarrow[weekday]
   164  }
   165  
   166  // WeekdaysNarrow returns the locales narrow weekdays
   167  func (ku *ku_TR) WeekdaysNarrow() []string {
   168  	return ku.daysNarrow
   169  }
   170  
   171  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   172  func (ku *ku_TR) WeekdayShort(weekday time.Weekday) string {
   173  	return ku.daysShort[weekday]
   174  }
   175  
   176  // WeekdaysShort returns the locales short weekdays
   177  func (ku *ku_TR) WeekdaysShort() []string {
   178  	return ku.daysShort
   179  }
   180  
   181  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   182  func (ku *ku_TR) WeekdayWide(weekday time.Weekday) string {
   183  	return ku.daysWide[weekday]
   184  }
   185  
   186  // WeekdaysWide returns the locales wide weekdays
   187  func (ku *ku_TR) WeekdaysWide() []string {
   188  	return ku.daysWide
   189  }
   190  
   191  // Decimal returns the decimal point of number
   192  func (ku *ku_TR) Decimal() string {
   193  	return ku.decimal
   194  }
   195  
   196  // Group returns the group of number
   197  func (ku *ku_TR) Group() string {
   198  	return ku.group
   199  }
   200  
   201  // Group returns the minus sign of number
   202  func (ku *ku_TR) Minus() string {
   203  	return ku.minus
   204  }
   205  
   206  // FmtNumber returns 'num' with digits/precision of 'v' for 'ku_TR' and handles both Whole and Real numbers based on 'v'
   207  func (ku *ku_TR) FmtNumber(num float64, v uint64) string {
   208  
   209  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   210  	l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
   211  	count := 0
   212  	inWhole := v == 0
   213  	b := make([]byte, 0, l)
   214  
   215  	for i := len(s) - 1; i >= 0; i-- {
   216  
   217  		if s[i] == '.' {
   218  			b = append(b, ku.decimal[0])
   219  			inWhole = true
   220  			continue
   221  		}
   222  
   223  		if inWhole {
   224  			if count == 3 {
   225  				b = append(b, ku.group[0])
   226  				count = 1
   227  			} else {
   228  				count++
   229  			}
   230  		}
   231  
   232  		b = append(b, s[i])
   233  	}
   234  
   235  	if num < 0 {
   236  		b = append(b, ku.minus[0])
   237  	}
   238  
   239  	// reverse
   240  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   241  		b[i], b[j] = b[j], b[i]
   242  	}
   243  
   244  	return string(b)
   245  }
   246  
   247  // FmtPercent returns 'num' with digits/precision of 'v' for 'ku_TR' and handles both Whole and Real numbers based on 'v'
   248  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   249  func (ku *ku_TR) FmtPercent(num float64, v uint64) string {
   250  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   251  	l := len(s) + 3 + 1*len(s[:len(s)-int(v)-1])/3
   252  	count := 0
   253  	inWhole := v == 0
   254  	b := make([]byte, 0, l)
   255  
   256  	for i := len(s) - 1; i >= 0; i-- {
   257  
   258  		if s[i] == '.' {
   259  			b = append(b, ku.decimal[0])
   260  			inWhole = true
   261  
   262  			continue
   263  		}
   264  
   265  		if inWhole {
   266  			if count == 3 {
   267  				b = append(b, ku.group[0])
   268  				count = 1
   269  			} else {
   270  				count++
   271  			}
   272  		}
   273  
   274  		b = append(b, s[i])
   275  	}
   276  
   277  	if num < 0 {
   278  		b = append(b, ku.minus[0])
   279  	}
   280  
   281  	b = append(b, ku.percent[0])
   282  
   283  	// reverse
   284  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   285  		b[i], b[j] = b[j], b[i]
   286  	}
   287  
   288  	return string(b)
   289  }
   290  
   291  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ku_TR'
   292  func (ku *ku_TR) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   293  
   294  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   295  	symbol := ku.currencies[currency]
   296  	l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
   297  	count := 0
   298  	inWhole := v == 0
   299  	b := make([]byte, 0, l)
   300  
   301  	for i := len(s) - 1; i >= 0; i-- {
   302  
   303  		if s[i] == '.' {
   304  			b = append(b, ku.decimal[0])
   305  			inWhole = true
   306  			continue
   307  		}
   308  
   309  		if inWhole {
   310  			if count == 3 {
   311  				b = append(b, ku.group[0])
   312  				count = 1
   313  			} else {
   314  				count++
   315  			}
   316  		}
   317  
   318  		b = append(b, s[i])
   319  	}
   320  
   321  	if num < 0 {
   322  		b = append(b, ku.minus[0])
   323  	}
   324  
   325  	// reverse
   326  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   327  		b[i], b[j] = b[j], b[i]
   328  	}
   329  
   330  	if int(v) < 2 {
   331  
   332  		if v == 0 {
   333  			b = append(b, ku.decimal...)
   334  		}
   335  
   336  		for i := 0; i < 2-int(v); i++ {
   337  			b = append(b, '0')
   338  		}
   339  	}
   340  
   341  	b = append(b, ku.currencyPositiveSuffix...)
   342  
   343  	b = append(b, symbol...)
   344  
   345  	return string(b)
   346  }
   347  
   348  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ku_TR'
   349  // in accounting notation.
   350  func (ku *ku_TR) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   351  
   352  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   353  	symbol := ku.currencies[currency]
   354  	l := len(s) + len(symbol) + 6 + 1*len(s[:len(s)-int(v)-1])/3
   355  	count := 0
   356  	inWhole := v == 0
   357  	b := make([]byte, 0, l)
   358  
   359  	for i := len(s) - 1; i >= 0; i-- {
   360  
   361  		if s[i] == '.' {
   362  			b = append(b, ku.decimal[0])
   363  			inWhole = true
   364  			continue
   365  		}
   366  
   367  		if inWhole {
   368  			if count == 3 {
   369  				b = append(b, ku.group[0])
   370  				count = 1
   371  			} else {
   372  				count++
   373  			}
   374  		}
   375  
   376  		b = append(b, s[i])
   377  	}
   378  
   379  	if num < 0 {
   380  
   381  		b = append(b, ku.currencyNegativePrefix[0])
   382  
   383  	}
   384  
   385  	// reverse
   386  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   387  		b[i], b[j] = b[j], b[i]
   388  	}
   389  
   390  	if int(v) < 2 {
   391  
   392  		if v == 0 {
   393  			b = append(b, ku.decimal...)
   394  		}
   395  
   396  		for i := 0; i < 2-int(v); i++ {
   397  			b = append(b, '0')
   398  		}
   399  	}
   400  
   401  	if num < 0 {
   402  		b = append(b, ku.currencyNegativeSuffix...)
   403  		b = append(b, symbol...)
   404  	} else {
   405  
   406  		b = append(b, ku.currencyPositiveSuffix...)
   407  		b = append(b, symbol...)
   408  	}
   409  
   410  	return string(b)
   411  }
   412  
   413  // FmtDateShort returns the short date representation of 't' for 'ku_TR'
   414  func (ku *ku_TR) FmtDateShort(t time.Time) string {
   415  
   416  	b := make([]byte, 0, 32)
   417  
   418  	return string(b)
   419  }
   420  
   421  // FmtDateMedium returns the medium date representation of 't' for 'ku_TR'
   422  func (ku *ku_TR) FmtDateMedium(t time.Time) string {
   423  
   424  	b := make([]byte, 0, 32)
   425  
   426  	return string(b)
   427  }
   428  
   429  // FmtDateLong returns the long date representation of 't' for 'ku_TR'
   430  func (ku *ku_TR) FmtDateLong(t time.Time) string {
   431  
   432  	b := make([]byte, 0, 32)
   433  
   434  	return string(b)
   435  }
   436  
   437  // FmtDateFull returns the full date representation of 't' for 'ku_TR'
   438  func (ku *ku_TR) FmtDateFull(t time.Time) string {
   439  
   440  	b := make([]byte, 0, 32)
   441  
   442  	return string(b)
   443  }
   444  
   445  // FmtTimeShort returns the short time representation of 't' for 'ku_TR'
   446  func (ku *ku_TR) FmtTimeShort(t time.Time) string {
   447  
   448  	b := make([]byte, 0, 32)
   449  
   450  	return string(b)
   451  }
   452  
   453  // FmtTimeMedium returns the medium time representation of 't' for 'ku_TR'
   454  func (ku *ku_TR) FmtTimeMedium(t time.Time) string {
   455  
   456  	b := make([]byte, 0, 32)
   457  
   458  	return string(b)
   459  }
   460  
   461  // FmtTimeLong returns the long time representation of 't' for 'ku_TR'
   462  func (ku *ku_TR) FmtTimeLong(t time.Time) string {
   463  
   464  	b := make([]byte, 0, 32)
   465  
   466  	return string(b)
   467  }
   468  
   469  // FmtTimeFull returns the full time representation of 't' for 'ku_TR'
   470  func (ku *ku_TR) FmtTimeFull(t time.Time) string {
   471  
   472  	b := make([]byte, 0, 32)
   473  
   474  	return string(b)
   475  }
   476  

View as plain text