kn_IN.go 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. package kn_IN
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type kn_IN struct {
  10. locale string
  11. pluralsCardinal []locales.PluralRule
  12. pluralsOrdinal []locales.PluralRule
  13. pluralsRange []locales.PluralRule
  14. decimal string
  15. group string
  16. minus string
  17. percent string
  18. perMille string
  19. timeSeparator string
  20. inifinity string
  21. currencies []string // idx = enum of currency code
  22. monthsAbbreviated []string
  23. monthsNarrow []string
  24. monthsWide []string
  25. daysAbbreviated []string
  26. daysNarrow []string
  27. daysShort []string
  28. daysWide []string
  29. periodsAbbreviated []string
  30. periodsNarrow []string
  31. periodsShort []string
  32. periodsWide []string
  33. erasAbbreviated []string
  34. erasNarrow []string
  35. erasWide []string
  36. timezones map[string]string
  37. }
  38. // New returns a new instance of translator for the 'kn_IN' locale
  39. func New() locales.Translator {
  40. return &kn_IN{
  41. locale: "kn_IN",
  42. pluralsCardinal: []locales.PluralRule{2, 6},
  43. pluralsOrdinal: []locales.PluralRule{6},
  44. pluralsRange: []locales.PluralRule{2, 6},
  45. decimal: ".",
  46. group: ",",
  47. minus: "-",
  48. percent: "%",
  49. perMille: "‰",
  50. timeSeparator: ":",
  51. inifinity: "∞",
  52. 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", "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", "UZS", "VEB", "VEF", "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"},
  53. monthsAbbreviated: []string{"", "ಜನವರಿ", "ಫೆಬ್ರವರಿ", "ಮಾರ್ಚ್", "ಏಪ್ರಿ", "ಮೇ", "ಜೂನ್", "ಜುಲೈ", "ಆಗ", "ಸೆಪ್ಟೆಂ", "ಅಕ್ಟೋ", "ನವೆಂ", "ಡಿಸೆಂ"},
  54. monthsNarrow: []string{"", "ಜ", "ಫೆ", "ಮಾ", "ಏ", "ಮೇ", "ಜೂ", "ಜು", "ಆ", "ಸೆ", "ಅ", "ನ", "ಡಿ"},
  55. monthsWide: []string{"", "ಜನವರಿ", "ಫೆಬ್ರವರಿ", "ಮಾರ್ಚ್", "ಏಪ್ರಿಲ್", "ಮೇ", "ಜೂನ್", "ಜುಲೈ", "ಆಗಸ್ಟ್", "ಸೆಪ್ಟೆಂಬರ್", "ಅಕ್ಟೋಬರ್", "ನವೆಂಬರ್", "ಡಿಸೆಂಬರ್"},
  56. daysAbbreviated: []string{"ಭಾನು", "ಸೋಮ", "ಮಂಗಳ", "ಬುಧ", "ಗುರು", "ಶುಕ್ರ", "ಶನಿ"},
  57. daysNarrow: []string{"ಭಾ", "ಸೋ", "ಮಂ", "ಬು", "ಗು", "ಶು", "ಶ"},
  58. daysShort: []string{"ಭಾನು", "ಸೋಮ", "ಮಂಗಳ", "ಬುಧ", "ಗುರು", "ಶುಕ್ರ", "ಶನಿ"},
  59. daysWide: []string{"ಭಾನುವಾರ", "ಸೋಮವಾರ", "ಮಂಗಳವಾರ", "ಬುಧವಾರ", "ಗುರುವಾರ", "ಶುಕ್ರವಾರ", "ಶನಿವಾರ"},
  60. periodsAbbreviated: []string{"ಪೂರ್ವಾಹ್ನ", "ಅಪರಾಹ್ನ"},
  61. periodsNarrow: []string{"ಪೂ", "ಅ"},
  62. periodsWide: []string{"ಪೂರ್ವಾಹ್ನ", "ಅಪರಾಹ್ನ"},
  63. erasAbbreviated: []string{"ಕ್ರಿ.ಪೂ", "ಕ್ರಿ.ಶ"},
  64. erasNarrow: []string{"", ""},
  65. erasWide: []string{"ಕ್ರಿಸ್ತ ಪೂರ್ವ", "ಕ್ರಿಸ್ತ ಶಕ"},
  66. timezones: map[string]string{"ADT": "ಅಟ್ಲಾಂಟಿಕ್ ದಿನದ ಸಮಯ", "SAST": "ದಕ್ಷಿಣ ಆಫ್ರಿಕಾ ಪ್ರಮಾಣಿತ ಸಮಯ", "IST": "ಭಾರತೀಯ ಪ್ರಮಾಣಿತ ಸಮಯ", "CLT": "ಚಿಲಿ ಪ್ರಮಾಣಿತ ಸಮಯ", "ChST": "ಚಮೋರೋ ಪ್ರಮಾಣಿತ ಸಮಯ", "AEST": "ಆಸ್ಟ್ರೇಲಿಯಾದ ಪೂರ್ವ ಪ್ರಮಾಣಿತ ಸಮಯ", "AKDT": "\u200cಅಲಾಸ್ಕಾ ಹಗಲು ಸಮಯ", "HNOG": "ಪಶ್ಚಿಮ ಗ್ರೀನ್\u200cಲ್ಯಾಂಡ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "OESZ": "ಪೂರ್ವ ಯುರೋಪಿಯನ್ ಬೇಸಿಗೆ ಸಮಯ", "ART": "ಅರ್ಜೆಂಟೀನಾ ಪ್ರಮಾಣಿತ ಸಮಯ", "MESZ": "ಮಧ್ಯ ಯುರೋಪಿಯನ್ ಬೇಸಿಗೆ ಸಮಯ", "LHST": "ಲಾರ್ಡ್ ಹೋವ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "VET": "ವೆನಿಜುವೆಲಾ ಸಮಯ", "HNCU": "ಕ್ಯೂಬಾ ಪ್ರಮಾಣಿತ ಸಮಯ", "MST": "ಉತ್ತರ ಅಮೆರಿಕದ ಪರ್ವತ ಪ್ರಮಾಣಿತ ಸಮಯ", "BT": "ಭೂತಾನ್ ಸಮಯ", "SGT": "ಸಿಂಗಾಪುರ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "HEOG": "ಪಶ್ಚಿಮ ಗ್ರೀನ್\u200cಲ್ಯಾಂಡ್ ಬೇಸಿಗೆ ಸಮಯ", "HEPM": "ಸೇಂಟ್ ಪಿಯರ್ ಮತ್ತು ಮಿಕ್ವೆಲನ್ ಹಗಲು ಸಮಯ", "EAT": "ಪೂರ್ವ ಆಫ್ರಿಕಾ ಸಮಯ", "HEPMX": "ಮೆಕ್ಸಿಕನ್ ಪೆಸಿಫಿಕ್ ಹಗಲು ಸಮಯ", "WAST": "ಪಶ್ಚಿಮ ಆಫ್ರಿಕಾ ಬೇಸಿಗೆ ಸಮಯ", "JDT": "ಜಪಾನ್ ಹಗಲು ಸಮಯ", "AKST": "ಅಲಸ್ಕಾ ಪ್ರಮಾಣಿತ ಸಮಯ", "LHDT": "ಲಾರ್ಡ್ ಹೋವ್ ಬೆಳಗಿನ ಸಮಯ", "AWDT": "ಆಸ್ಟ್ರೇಲಿಯಾದ ಪಶ್ಚಿಮ ಹಗಲು ಸಮಯ", "HNT": "ನ್ಯೂಫೌಂಡ್\u200cಲ್ಯಾಂಡ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "HECU": "ಕ್ಯೂಬಾ ದಿನದ ಸಮಯ", "HNPM": "ಸೇಂಟ್ ಪಿಯರ್ ಮತ್ತು ಮಿಕ್ವೆಲನ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "HNNOMX": "ವಾಯವ್ಯ ಮೆಕ್ಸಿಕೊ ಪ್ರಮಾಣಿತ ಸಮಯ", "CLST": "ಚಿಲಿ ಬೇಸಿಗೆ ಸಮಯ", "GMT": "ಗ್ರೀನ್\u200cವಿಚ್ ಸರಾಸರಿ ಕಾಲಮಾನ", "CDT": "ಉತ್ತರ ಅಮೆರಿಕದ ಕೇಂದ್ರೀಯ ದಿನದ ಸಮಯ", "MDT": "ಉತ್ತರ ಅಮೆರಿಕದ ಪರ್ವತ ದಿನದ ಸಮಯ", "WARST": "ಪಶ್ಚಿಮ ಅರ್ಜೆಂಟೀನಾ ಬೇಸಿಗೆ ಸಮಯ", "HADT": "ಹವಾಯಿ-ಅಲ್ಯುಟಿಯನ್ ಹಗಲು ಸಮಯ", "GYT": "ಗಯಾನಾ ಸಮಯ", "∅∅∅": "ಬ್ರೆಸಿಲಿಯಾ ಬೇಸಿಗೆ ಸಮಯ", "ACWST": "ಆಸ್ಟ್ರೇಲಿಯಾದ ಕೇಂದ್ರ ಪಶ್ಚಿಮ ಪ್ರಮಾಣಿತ ಸಮಯ", "TMST": "ತುರ್ಕ್\u200cಮೇನಿಸ್ತಾನ್ ಬೇಸಿಗೆ ಸಮಯ", "OEZ": "ಪೂರ್ವ ಯುರೋಪಿಯನ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "HAST": "ಹವಾಯಿ-ಅಲ್ಯುಟಿಯನ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "HKT": "ಹಾಂಗ್ ಕಾಂಗ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "WART": "ಪಶ್ಚಿಮ ಅರ್ಜೆಂಟೀನಾ ಪ್ರಮಾಣಿತ ಸಮಯ", "SRT": "ಸುರಿನೇಮ್ ಸಮಯ", "GFT": "ಫ್ರೆಂಚ್ ಗಯಾನಾ ಸಮಯ", "NZST": "ನ್ಯೂಜಿಲ್ಯಾಂಡ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "MYT": "ಮಲೇಷಿಯಾ ಸಮಯ", "ACST": "ಆಸ್ಟ್ರೇಲಿಯಾದ ಕೇಂದ್ರ ಪ್ರಮಾಣಿತ ಸಮಯ", "ACWDT": "ಆಸ್ಟ್ರೇಲಿಯಾದ ಕೇಂದ್ರ ಪಶ್ಚಿಮ ಹಗಲು ಸಮಯ", "WESZ": "ಪಶ್ಚಿಮ ಯುರೋಪಿಯನ್ ಬೇಸಿಗೆ ಸಮಯ", "TMT": "ತುರ್ಕ್\u200cಮೇನಿಸ್ತಾನ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "COST": "ಕೊಲಂಬಿಯಾ ಬೇಸಿಗೆ ಸಮಯ", "PDT": "ಉತ್ತರ ಅಮೆರಿಕದ ಪೆಸಿಫಿಕ್ ದಿನದ ಸಮಯ", "ACDT": "ಆಸ್ಟ್ರೇಲಿಯಾದ ಕೇಂದ್ರ ಹಗಲು ಸಮಯ", "HEEG": "ಪೂರ್ವ ಗ್ರೀನ್\u200cಲ್ಯಾಂಡ್ ಬೇಸಿಗೆ ಸಮಯ", "MEZ": "ಮಧ್ಯ ಯುರೋಪಿಯನ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "HENOMX": "ವಾಯವ್ಯ ಮೆಕ್ಸಿಕೊ ಹಗಲು ಸಮಯ", "HNPMX": "ಮೆಕ್ಸಿಕನ್ ಪೆಸಿಫಿಕ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "WEZ": "ಪಶ್ಚಿಮ ಯುರೋಪಿಯನ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "ECT": "ಈಕ್ವೆಡಾರ್ ಸಮಯ", "UYST": "ಉರುಗ್ವೇ ಬೇಸಿಗೆ ಸಮಯ", "CAT": "ಮಧ್ಯ ಆಫ್ರಿಕಾ ಸಮಯ", "PST": "ಉತ್ತರ ಅಮೆರಿಕದ ಪೆಸಿಫಿಕ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "BOT": "ಬೊಲಿವಿಯಾ ಸಮಯ", "HNEG": "ಪೂರ್ವ ಗ್ರೀನ್\u200cಲ್ಯಾಂಡ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "HAT": "ನ್ಯೂಫೌಂಡ್\u200cಲ್ಯಾಂಡ್ ದಿನದ ಸಮಯ", "WITA": "ಮಧ್ಯ ಇಂಡೋನೇಷಿಯಾ ಸಮಯ", "NZDT": "ನ್ಯೂಜಿಲ್ಯಾಂಡ್ ಹಗಲು ಸಮಯ", "EDT": "ಉತ್ತರ ಅಮೆರಿಕದ ಪೂರ್ವದ ದಿನದ ಸಮಯ", "HKST": "ಹಾಂಗ್ ಕಾಂಗ್ ಬೇಸಿಗೆ ಸಮಯ", "CHAST": "ಚಥಾಮ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "CHADT": "ಚಥಾಮ್ ಹಗಲು ಸಮಯ", "CST": "ಉತ್ತರ ಅಮೆರಿಕದ ಕೇಂದ್ರ ಪ್ರಮಾಣಿತ ಸಮಯ", "AWST": "ಆಸ್ಟ್ರೇಲಿಯಾದ ಪಶ್ಚಿಮ ಪ್ರಮಾಣಿತ ಸಮಯ", "AEDT": "ಪೂರ್ವ ಆಸ್ಟ್ರೇಲಿಯಾದ ಹಗಲು ಸಮಯ", "UYT": "ಉರುಗ್ವೇ ಪ್ರಮಾಣಿತ ಸಮಯ", "AST": "ಅಟ್ಲಾಂಟಿಕ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "WAT": "ಪಶ್ಚಿಮ ಆಫ್ರಿಕಾ ಪ್ರಮಾಣಿತ ಸಮಯ", "WIB": "ಪಶ್ಚಿಮ ಇಂಡೋನೇಷಿಯ ಸಮಯ", "COT": "ಕೊಲಂಬಿಯಾ ಪ್ರಮಾಣಿತ ಸಮಯ", "JST": "ಜಪಾನ್ ಪ್ರಮಾಣಿತ ಸಮಯ", "EST": "ಉತ್ತರ ಅಮೆರಿಕದ ಪೂರ್ವದ ಪ್ರಮಾಣಿತ ಸಮಯ", "WIT": "ಪೂರ್ವ ಇಂಡೋನೇಷಿಯಾ ಸಮಯ", "ARST": "ಅರ್ಜೆಂಟಿನಾ ಬೇಸಿಗೆ ಸಮಯ"},
  67. }
  68. }
  69. // Locale returns the current translators string locale
  70. func (kn *kn_IN) Locale() string {
  71. return kn.locale
  72. }
  73. // PluralsCardinal returns the list of cardinal plural rules associated with 'kn_IN'
  74. func (kn *kn_IN) PluralsCardinal() []locales.PluralRule {
  75. return kn.pluralsCardinal
  76. }
  77. // PluralsOrdinal returns the list of ordinal plural rules associated with 'kn_IN'
  78. func (kn *kn_IN) PluralsOrdinal() []locales.PluralRule {
  79. return kn.pluralsOrdinal
  80. }
  81. // PluralsRange returns the list of range plural rules associated with 'kn_IN'
  82. func (kn *kn_IN) PluralsRange() []locales.PluralRule {
  83. return kn.pluralsRange
  84. }
  85. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'kn_IN'
  86. func (kn *kn_IN) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  87. n := math.Abs(num)
  88. i := int64(n)
  89. if (i == 0) || (n == 1) {
  90. return locales.PluralRuleOne
  91. }
  92. return locales.PluralRuleOther
  93. }
  94. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'kn_IN'
  95. func (kn *kn_IN) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  96. return locales.PluralRuleOther
  97. }
  98. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'kn_IN'
  99. func (kn *kn_IN) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  100. start := kn.CardinalPluralRule(num1, v1)
  101. end := kn.CardinalPluralRule(num2, v2)
  102. if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
  103. return locales.PluralRuleOne
  104. } else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
  105. return locales.PluralRuleOther
  106. }
  107. return locales.PluralRuleOther
  108. }
  109. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  110. func (kn *kn_IN) MonthAbbreviated(month time.Month) string {
  111. return kn.monthsAbbreviated[month]
  112. }
  113. // MonthsAbbreviated returns the locales abbreviated months
  114. func (kn *kn_IN) MonthsAbbreviated() []string {
  115. return kn.monthsAbbreviated[1:]
  116. }
  117. // MonthNarrow returns the locales narrow month given the 'month' provided
  118. func (kn *kn_IN) MonthNarrow(month time.Month) string {
  119. return kn.monthsNarrow[month]
  120. }
  121. // MonthsNarrow returns the locales narrow months
  122. func (kn *kn_IN) MonthsNarrow() []string {
  123. return kn.monthsNarrow[1:]
  124. }
  125. // MonthWide returns the locales wide month given the 'month' provided
  126. func (kn *kn_IN) MonthWide(month time.Month) string {
  127. return kn.monthsWide[month]
  128. }
  129. // MonthsWide returns the locales wide months
  130. func (kn *kn_IN) MonthsWide() []string {
  131. return kn.monthsWide[1:]
  132. }
  133. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  134. func (kn *kn_IN) WeekdayAbbreviated(weekday time.Weekday) string {
  135. return kn.daysAbbreviated[weekday]
  136. }
  137. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  138. func (kn *kn_IN) WeekdaysAbbreviated() []string {
  139. return kn.daysAbbreviated
  140. }
  141. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  142. func (kn *kn_IN) WeekdayNarrow(weekday time.Weekday) string {
  143. return kn.daysNarrow[weekday]
  144. }
  145. // WeekdaysNarrow returns the locales narrow weekdays
  146. func (kn *kn_IN) WeekdaysNarrow() []string {
  147. return kn.daysNarrow
  148. }
  149. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  150. func (kn *kn_IN) WeekdayShort(weekday time.Weekday) string {
  151. return kn.daysShort[weekday]
  152. }
  153. // WeekdaysShort returns the locales short weekdays
  154. func (kn *kn_IN) WeekdaysShort() []string {
  155. return kn.daysShort
  156. }
  157. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  158. func (kn *kn_IN) WeekdayWide(weekday time.Weekday) string {
  159. return kn.daysWide[weekday]
  160. }
  161. // WeekdaysWide returns the locales wide weekdays
  162. func (kn *kn_IN) WeekdaysWide() []string {
  163. return kn.daysWide
  164. }
  165. // Decimal returns the decimal point of number
  166. func (kn *kn_IN) Decimal() string {
  167. return kn.decimal
  168. }
  169. // Group returns the group of number
  170. func (kn *kn_IN) Group() string {
  171. return kn.group
  172. }
  173. // Group returns the minus sign of number
  174. func (kn *kn_IN) Minus() string {
  175. return kn.minus
  176. }
  177. // FmtNumber returns 'num' with digits/precision of 'v' for 'kn_IN' and handles both Whole and Real numbers based on 'v'
  178. func (kn *kn_IN) FmtNumber(num float64, v uint64) string {
  179. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  180. l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  181. count := 0
  182. inWhole := v == 0
  183. b := make([]byte, 0, l)
  184. for i := len(s) - 1; i >= 0; i-- {
  185. if s[i] == '.' {
  186. b = append(b, kn.decimal[0])
  187. inWhole = true
  188. continue
  189. }
  190. if inWhole {
  191. if count == 3 {
  192. b = append(b, kn.group[0])
  193. count = 1
  194. } else {
  195. count++
  196. }
  197. }
  198. b = append(b, s[i])
  199. }
  200. if num < 0 {
  201. b = append(b, kn.minus[0])
  202. }
  203. // reverse
  204. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  205. b[i], b[j] = b[j], b[i]
  206. }
  207. return string(b)
  208. }
  209. // FmtPercent returns 'num' with digits/precision of 'v' for 'kn_IN' and handles both Whole and Real numbers based on 'v'
  210. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  211. func (kn *kn_IN) FmtPercent(num float64, v uint64) string {
  212. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  213. l := len(s) + 3
  214. b := make([]byte, 0, l)
  215. for i := len(s) - 1; i >= 0; i-- {
  216. if s[i] == '.' {
  217. b = append(b, kn.decimal[0])
  218. continue
  219. }
  220. b = append(b, s[i])
  221. }
  222. if num < 0 {
  223. b = append(b, kn.minus[0])
  224. }
  225. // reverse
  226. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  227. b[i], b[j] = b[j], b[i]
  228. }
  229. b = append(b, kn.percent...)
  230. return string(b)
  231. }
  232. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'kn_IN'
  233. func (kn *kn_IN) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  234. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  235. symbol := kn.currencies[currency]
  236. l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  237. count := 0
  238. inWhole := v == 0
  239. b := make([]byte, 0, l)
  240. for i := len(s) - 1; i >= 0; i-- {
  241. if s[i] == '.' {
  242. b = append(b, kn.decimal[0])
  243. inWhole = true
  244. continue
  245. }
  246. if inWhole {
  247. if count == 3 {
  248. b = append(b, kn.group[0])
  249. count = 1
  250. } else {
  251. count++
  252. }
  253. }
  254. b = append(b, s[i])
  255. }
  256. for j := len(symbol) - 1; j >= 0; j-- {
  257. b = append(b, symbol[j])
  258. }
  259. if num < 0 {
  260. b = append(b, kn.minus[0])
  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. if int(v) < 2 {
  267. if v == 0 {
  268. b = append(b, kn.decimal...)
  269. }
  270. for i := 0; i < 2-int(v); i++ {
  271. b = append(b, '0')
  272. }
  273. }
  274. return string(b)
  275. }
  276. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kn_IN'
  277. // in accounting notation.
  278. func (kn *kn_IN) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  279. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  280. symbol := kn.currencies[currency]
  281. l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  282. count := 0
  283. inWhole := v == 0
  284. b := make([]byte, 0, l)
  285. for i := len(s) - 1; i >= 0; i-- {
  286. if s[i] == '.' {
  287. b = append(b, kn.decimal[0])
  288. inWhole = true
  289. continue
  290. }
  291. if inWhole {
  292. if count == 3 {
  293. b = append(b, kn.group[0])
  294. count = 1
  295. } else {
  296. count++
  297. }
  298. }
  299. b = append(b, s[i])
  300. }
  301. if num < 0 {
  302. for j := len(symbol) - 1; j >= 0; j-- {
  303. b = append(b, symbol[j])
  304. }
  305. b = append(b, kn.minus[0])
  306. } else {
  307. for j := len(symbol) - 1; j >= 0; j-- {
  308. b = append(b, symbol[j])
  309. }
  310. }
  311. // reverse
  312. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  313. b[i], b[j] = b[j], b[i]
  314. }
  315. if int(v) < 2 {
  316. if v == 0 {
  317. b = append(b, kn.decimal...)
  318. }
  319. for i := 0; i < 2-int(v); i++ {
  320. b = append(b, '0')
  321. }
  322. }
  323. return string(b)
  324. }
  325. // FmtDateShort returns the short date representation of 't' for 'kn_IN'
  326. func (kn *kn_IN) FmtDateShort(t time.Time) string {
  327. b := make([]byte, 0, 32)
  328. b = strconv.AppendInt(b, int64(t.Day()), 10)
  329. b = append(b, []byte{0x2f}...)
  330. b = strconv.AppendInt(b, int64(t.Month()), 10)
  331. b = append(b, []byte{0x2f}...)
  332. if t.Year() > 9 {
  333. b = append(b, strconv.Itoa(t.Year())[2:]...)
  334. } else {
  335. b = append(b, strconv.Itoa(t.Year())[1:]...)
  336. }
  337. return string(b)
  338. }
  339. // FmtDateMedium returns the medium date representation of 't' for 'kn_IN'
  340. func (kn *kn_IN) FmtDateMedium(t time.Time) string {
  341. b := make([]byte, 0, 32)
  342. b = append(b, kn.monthsAbbreviated[t.Month()]...)
  343. b = append(b, []byte{0x20}...)
  344. b = strconv.AppendInt(b, int64(t.Day()), 10)
  345. b = append(b, []byte{0x2c, 0x20}...)
  346. if t.Year() > 0 {
  347. b = strconv.AppendInt(b, int64(t.Year()), 10)
  348. } else {
  349. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  350. }
  351. return string(b)
  352. }
  353. // FmtDateLong returns the long date representation of 't' for 'kn_IN'
  354. func (kn *kn_IN) FmtDateLong(t time.Time) string {
  355. b := make([]byte, 0, 32)
  356. b = append(b, kn.monthsWide[t.Month()]...)
  357. b = append(b, []byte{0x20}...)
  358. b = strconv.AppendInt(b, int64(t.Day()), 10)
  359. b = append(b, []byte{0x2c, 0x20}...)
  360. if t.Year() > 0 {
  361. b = strconv.AppendInt(b, int64(t.Year()), 10)
  362. } else {
  363. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  364. }
  365. return string(b)
  366. }
  367. // FmtDateFull returns the full date representation of 't' for 'kn_IN'
  368. func (kn *kn_IN) FmtDateFull(t time.Time) string {
  369. b := make([]byte, 0, 32)
  370. b = append(b, kn.daysWide[t.Weekday()]...)
  371. b = append(b, []byte{0x2c, 0x20}...)
  372. b = append(b, kn.monthsWide[t.Month()]...)
  373. b = append(b, []byte{0x20}...)
  374. b = strconv.AppendInt(b, int64(t.Day()), 10)
  375. b = append(b, []byte{0x2c, 0x20}...)
  376. if t.Year() > 0 {
  377. b = strconv.AppendInt(b, int64(t.Year()), 10)
  378. } else {
  379. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  380. }
  381. return string(b)
  382. }
  383. // FmtTimeShort returns the short time representation of 't' for 'kn_IN'
  384. func (kn *kn_IN) FmtTimeShort(t time.Time) string {
  385. b := make([]byte, 0, 32)
  386. h := t.Hour()
  387. if h > 12 {
  388. h -= 12
  389. }
  390. if h < 10 {
  391. b = append(b, '0')
  392. }
  393. b = strconv.AppendInt(b, int64(h), 10)
  394. b = append(b, kn.timeSeparator...)
  395. if t.Minute() < 10 {
  396. b = append(b, '0')
  397. }
  398. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  399. b = append(b, []byte{0x20}...)
  400. if t.Hour() < 12 {
  401. b = append(b, kn.periodsAbbreviated[0]...)
  402. } else {
  403. b = append(b, kn.periodsAbbreviated[1]...)
  404. }
  405. return string(b)
  406. }
  407. // FmtTimeMedium returns the medium time representation of 't' for 'kn_IN'
  408. func (kn *kn_IN) FmtTimeMedium(t time.Time) string {
  409. b := make([]byte, 0, 32)
  410. h := t.Hour()
  411. if h > 12 {
  412. h -= 12
  413. }
  414. if h < 10 {
  415. b = append(b, '0')
  416. }
  417. b = strconv.AppendInt(b, int64(h), 10)
  418. b = append(b, kn.timeSeparator...)
  419. if t.Minute() < 10 {
  420. b = append(b, '0')
  421. }
  422. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  423. b = append(b, kn.timeSeparator...)
  424. if t.Second() < 10 {
  425. b = append(b, '0')
  426. }
  427. b = strconv.AppendInt(b, int64(t.Second()), 10)
  428. b = append(b, []byte{0x20}...)
  429. if t.Hour() < 12 {
  430. b = append(b, kn.periodsAbbreviated[0]...)
  431. } else {
  432. b = append(b, kn.periodsAbbreviated[1]...)
  433. }
  434. return string(b)
  435. }
  436. // FmtTimeLong returns the long time representation of 't' for 'kn_IN'
  437. func (kn *kn_IN) FmtTimeLong(t time.Time) string {
  438. b := make([]byte, 0, 32)
  439. h := t.Hour()
  440. if h > 12 {
  441. h -= 12
  442. }
  443. if h < 10 {
  444. b = append(b, '0')
  445. }
  446. b = strconv.AppendInt(b, int64(h), 10)
  447. b = append(b, kn.timeSeparator...)
  448. if t.Minute() < 10 {
  449. b = append(b, '0')
  450. }
  451. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  452. b = append(b, kn.timeSeparator...)
  453. if t.Second() < 10 {
  454. b = append(b, '0')
  455. }
  456. b = strconv.AppendInt(b, int64(t.Second()), 10)
  457. b = append(b, []byte{0x20}...)
  458. if t.Hour() < 12 {
  459. b = append(b, kn.periodsAbbreviated[0]...)
  460. } else {
  461. b = append(b, kn.periodsAbbreviated[1]...)
  462. }
  463. b = append(b, []byte{0x20}...)
  464. tz, _ := t.Zone()
  465. b = append(b, tz...)
  466. return string(b)
  467. }
  468. // FmtTimeFull returns the full time representation of 't' for 'kn_IN'
  469. func (kn *kn_IN) FmtTimeFull(t time.Time) string {
  470. b := make([]byte, 0, 32)
  471. h := t.Hour()
  472. if h > 12 {
  473. h -= 12
  474. }
  475. if h < 10 {
  476. b = append(b, '0')
  477. }
  478. b = strconv.AppendInt(b, int64(h), 10)
  479. b = append(b, kn.timeSeparator...)
  480. if t.Minute() < 10 {
  481. b = append(b, '0')
  482. }
  483. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  484. b = append(b, kn.timeSeparator...)
  485. if t.Second() < 10 {
  486. b = append(b, '0')
  487. }
  488. b = strconv.AppendInt(b, int64(t.Second()), 10)
  489. b = append(b, []byte{0x20}...)
  490. if t.Hour() < 12 {
  491. b = append(b, kn.periodsAbbreviated[0]...)
  492. } else {
  493. b = append(b, kn.periodsAbbreviated[1]...)
  494. }
  495. b = append(b, []byte{0x20}...)
  496. tz, _ := t.Zone()
  497. if btz, ok := kn.timezones[tz]; ok {
  498. b = append(b, btz...)
  499. } else {
  500. b = append(b, tz...)
  501. }
  502. return string(b)
  503. }