ja_JP.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. package ja_JP
  2. import (
  3. "math"
  4. "strconv"
  5. "time"
  6. "github.com/go-playground/locales"
  7. "github.com/go-playground/locales/currency"
  8. )
  9. type ja_JP 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. currencyNegativePrefix string
  23. currencyNegativeSuffix string
  24. monthsAbbreviated []string
  25. monthsNarrow []string
  26. monthsWide []string
  27. daysAbbreviated []string
  28. daysNarrow []string
  29. daysShort []string
  30. daysWide []string
  31. periodsAbbreviated []string
  32. periodsNarrow []string
  33. periodsShort []string
  34. periodsWide []string
  35. erasAbbreviated []string
  36. erasNarrow []string
  37. erasWide []string
  38. timezones map[string]string
  39. }
  40. // New returns a new instance of translator for the 'ja_JP' locale
  41. func New() locales.Translator {
  42. return &ja_JP{
  43. locale: "ja_JP",
  44. pluralsCardinal: []locales.PluralRule{6},
  45. pluralsOrdinal: []locales.PluralRule{6},
  46. pluralsRange: []locales.PluralRule{6},
  47. decimal: ".",
  48. group: ",",
  49. minus: "-",
  50. percent: "%",
  51. perMille: "‰",
  52. timeSeparator: ":",
  53. inifinity: "∞",
  54. 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"},
  55. currencyNegativePrefix: "(",
  56. currencyNegativeSuffix: ")",
  57. monthsAbbreviated: []string{"", "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"},
  58. monthsNarrow: []string{"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
  59. monthsWide: []string{"", "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"},
  60. daysAbbreviated: []string{"日", "月", "火", "水", "木", "金", "土"},
  61. daysNarrow: []string{"日", "月", "火", "水", "木", "金", "土"},
  62. daysShort: []string{"日", "月", "火", "水", "木", "金", "土"},
  63. daysWide: []string{"日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"},
  64. periodsAbbreviated: []string{"午前", "午後"},
  65. periodsNarrow: []string{"午前", "午後"},
  66. periodsWide: []string{"午前", "午後"},
  67. erasAbbreviated: []string{"紀元前", "西暦"},
  68. erasNarrow: []string{"BC", "AD"},
  69. erasWide: []string{"紀元前", "西暦"},
  70. timezones: map[string]string{"MESZ": "中央ヨーロッパ夏時間", "EAT": "東アフリカ時間", "GMT": "グリニッジ標準時", "HECU": "キューバ夏時間", "SAST": "南アフリカ標準時", "MYT": "マレーシア時間", "AKST": "アラスカ標準時", "ACWST": "オーストラリア中西部標準時", "CAT": "中央アフリカ時間", "MEZ": "中央ヨーロッパ標準時", "HAST": "ハワイ・アリューシャン標準時", "∅∅∅": "アマゾン夏時間", "GYT": "ガイアナ時間", "CHAST": "チャタム標準時", "WEZ": "西ヨーロッパ標準時", "BT": "ブータン時間", "HADT": "ハワイ・アリューシャン夏時間", "COT": "コロンビア標準時", "CST": "アメリカ中部標準時", "ACWDT": "オーストラリア中西部夏時間", "TMT": "トルクメニスタン標準時", "CHADT": "チャタム夏時間", "AWST": "オーストラリア西部標準時", "MDT": "アメリカ山地夏時間", "WAT": "西アフリカ標準時", "EST": "アメリカ東部標準時", "ChST": "チャモロ時間", "WIB": "インドネシア西部時間", "GFT": "仏領ギアナ時間", "IST": "インド標準時", "ARST": "アルゼンチン夏時間", "UYST": "ウルグアイ夏時間", "WAST": "西アフリカ夏時間", "AKDT": "アラスカ夏時間", "ACDT": "オーストラリア中部夏時間", "HNEG": "グリーンランド東部標準時", "PDT": "アメリカ太平洋夏時間", "NZDT": "ニュージーランド夏時間", "JST": "日本標準時", "HNNOMX": "メキシコ北西部標準時", "HENOMX": "メキシコ北西部夏時間", "WIT": "インドネシア東部時間", "BOT": "ボリビア時間", "HKT": "香港標準時", "HKST": "香港夏時間", "UYT": "ウルグアイ標準時", "WITA": "インドネシア中部時間", "CLST": "チリ夏時間", "CDT": "アメリカ中部夏時間", "AEST": "オーストラリア東部標準時", "MST": "アメリカ山地標準時", "HNOG": "グリーンランド西部標準時", "CLT": "チリ標準時", "HNPM": "サンピエール・ミクロン標準時", "HEPM": "サンピエール・ミクロン夏時間", "OEZ": "東ヨーロッパ標準時", "OESZ": "東ヨーロッパ夏時間", "ADT": "大西洋夏時間", "ECT": "エクアドル時間", "HEEG": "グリーンランド東部夏時間", "LHST": "ロードハウ標準時", "ART": "アルゼンチン標準時", "HEPMX": "メキシコ太平洋夏時間", "SGT": "シンガポール標準時", "ACST": "オーストラリア中部標準時", "HAT": "ニューファンドランド夏時間", "COST": "コロンビア夏時間", "AEDT": "オーストラリア東部夏時間", "AST": "大西洋標準時", "EDT": "アメリカ東部夏時間", "WART": "西部アルゼンチン標準時", "SRT": "スリナム時間", "WESZ": "西ヨーロッパ夏時間", "JDT": "日本夏時間", "VET": "ベネズエラ時間", "PST": "アメリカ太平洋標準時", "HNPMX": "メキシコ太平洋標準時", "NZST": "ニュージーランド標準時", "LHDT": "ロードハウ夏時間", "WARST": "西部アルゼンチン夏時間", "HNT": "ニューファンドランド標準時", "HNCU": "キューバ標準時", "AWDT": "オーストラリア西部夏時間", "HEOG": "グリーンランド西部夏時間", "TMST": "トルクメニスタン夏時間"},
  71. }
  72. }
  73. // Locale returns the current translators string locale
  74. func (ja *ja_JP) Locale() string {
  75. return ja.locale
  76. }
  77. // PluralsCardinal returns the list of cardinal plural rules associated with 'ja_JP'
  78. func (ja *ja_JP) PluralsCardinal() []locales.PluralRule {
  79. return ja.pluralsCardinal
  80. }
  81. // PluralsOrdinal returns the list of ordinal plural rules associated with 'ja_JP'
  82. func (ja *ja_JP) PluralsOrdinal() []locales.PluralRule {
  83. return ja.pluralsOrdinal
  84. }
  85. // PluralsRange returns the list of range plural rules associated with 'ja_JP'
  86. func (ja *ja_JP) PluralsRange() []locales.PluralRule {
  87. return ja.pluralsRange
  88. }
  89. // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ja_JP'
  90. func (ja *ja_JP) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
  91. return locales.PluralRuleOther
  92. }
  93. // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ja_JP'
  94. func (ja *ja_JP) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
  95. return locales.PluralRuleOther
  96. }
  97. // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ja_JP'
  98. func (ja *ja_JP) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
  99. return locales.PluralRuleOther
  100. }
  101. // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
  102. func (ja *ja_JP) MonthAbbreviated(month time.Month) string {
  103. return ja.monthsAbbreviated[month]
  104. }
  105. // MonthsAbbreviated returns the locales abbreviated months
  106. func (ja *ja_JP) MonthsAbbreviated() []string {
  107. return ja.monthsAbbreviated[1:]
  108. }
  109. // MonthNarrow returns the locales narrow month given the 'month' provided
  110. func (ja *ja_JP) MonthNarrow(month time.Month) string {
  111. return ja.monthsNarrow[month]
  112. }
  113. // MonthsNarrow returns the locales narrow months
  114. func (ja *ja_JP) MonthsNarrow() []string {
  115. return ja.monthsNarrow[1:]
  116. }
  117. // MonthWide returns the locales wide month given the 'month' provided
  118. func (ja *ja_JP) MonthWide(month time.Month) string {
  119. return ja.monthsWide[month]
  120. }
  121. // MonthsWide returns the locales wide months
  122. func (ja *ja_JP) MonthsWide() []string {
  123. return ja.monthsWide[1:]
  124. }
  125. // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
  126. func (ja *ja_JP) WeekdayAbbreviated(weekday time.Weekday) string {
  127. return ja.daysAbbreviated[weekday]
  128. }
  129. // WeekdaysAbbreviated returns the locales abbreviated weekdays
  130. func (ja *ja_JP) WeekdaysAbbreviated() []string {
  131. return ja.daysAbbreviated
  132. }
  133. // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
  134. func (ja *ja_JP) WeekdayNarrow(weekday time.Weekday) string {
  135. return ja.daysNarrow[weekday]
  136. }
  137. // WeekdaysNarrow returns the locales narrow weekdays
  138. func (ja *ja_JP) WeekdaysNarrow() []string {
  139. return ja.daysNarrow
  140. }
  141. // WeekdayShort returns the locales short weekday given the 'weekday' provided
  142. func (ja *ja_JP) WeekdayShort(weekday time.Weekday) string {
  143. return ja.daysShort[weekday]
  144. }
  145. // WeekdaysShort returns the locales short weekdays
  146. func (ja *ja_JP) WeekdaysShort() []string {
  147. return ja.daysShort
  148. }
  149. // WeekdayWide returns the locales wide weekday given the 'weekday' provided
  150. func (ja *ja_JP) WeekdayWide(weekday time.Weekday) string {
  151. return ja.daysWide[weekday]
  152. }
  153. // WeekdaysWide returns the locales wide weekdays
  154. func (ja *ja_JP) WeekdaysWide() []string {
  155. return ja.daysWide
  156. }
  157. // Decimal returns the decimal point of number
  158. func (ja *ja_JP) Decimal() string {
  159. return ja.decimal
  160. }
  161. // Group returns the group of number
  162. func (ja *ja_JP) Group() string {
  163. return ja.group
  164. }
  165. // Group returns the minus sign of number
  166. func (ja *ja_JP) Minus() string {
  167. return ja.minus
  168. }
  169. // FmtNumber returns 'num' with digits/precision of 'v' for 'ja_JP' and handles both Whole and Real numbers based on 'v'
  170. func (ja *ja_JP) FmtNumber(num float64, v uint64) string {
  171. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  172. l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  173. count := 0
  174. inWhole := v == 0
  175. b := make([]byte, 0, l)
  176. for i := len(s) - 1; i >= 0; i-- {
  177. if s[i] == '.' {
  178. b = append(b, ja.decimal[0])
  179. inWhole = true
  180. continue
  181. }
  182. if inWhole {
  183. if count == 3 {
  184. b = append(b, ja.group[0])
  185. count = 1
  186. } else {
  187. count++
  188. }
  189. }
  190. b = append(b, s[i])
  191. }
  192. if num < 0 {
  193. b = append(b, ja.minus[0])
  194. }
  195. // reverse
  196. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  197. b[i], b[j] = b[j], b[i]
  198. }
  199. return string(b)
  200. }
  201. // FmtPercent returns 'num' with digits/precision of 'v' for 'ja_JP' and handles both Whole and Real numbers based on 'v'
  202. // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
  203. func (ja *ja_JP) FmtPercent(num float64, v uint64) string {
  204. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  205. l := len(s) + 3
  206. b := make([]byte, 0, l)
  207. for i := len(s) - 1; i >= 0; i-- {
  208. if s[i] == '.' {
  209. b = append(b, ja.decimal[0])
  210. continue
  211. }
  212. b = append(b, s[i])
  213. }
  214. if num < 0 {
  215. b = append(b, ja.minus[0])
  216. }
  217. // reverse
  218. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  219. b[i], b[j] = b[j], b[i]
  220. }
  221. b = append(b, ja.percent...)
  222. return string(b)
  223. }
  224. // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ja_JP'
  225. func (ja *ja_JP) FmtCurrency(num float64, v uint64, currency currency.Type) string {
  226. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  227. symbol := ja.currencies[currency]
  228. l := len(s) + len(symbol) + 2 + 1*len(s[:len(s)-int(v)-1])/3
  229. count := 0
  230. inWhole := v == 0
  231. b := make([]byte, 0, l)
  232. for i := len(s) - 1; i >= 0; i-- {
  233. if s[i] == '.' {
  234. b = append(b, ja.decimal[0])
  235. inWhole = true
  236. continue
  237. }
  238. if inWhole {
  239. if count == 3 {
  240. b = append(b, ja.group[0])
  241. count = 1
  242. } else {
  243. count++
  244. }
  245. }
  246. b = append(b, s[i])
  247. }
  248. for j := len(symbol) - 1; j >= 0; j-- {
  249. b = append(b, symbol[j])
  250. }
  251. if num < 0 {
  252. b = append(b, ja.minus[0])
  253. }
  254. // reverse
  255. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  256. b[i], b[j] = b[j], b[i]
  257. }
  258. if int(v) < 2 {
  259. if v == 0 {
  260. b = append(b, ja.decimal...)
  261. }
  262. for i := 0; i < 2-int(v); i++ {
  263. b = append(b, '0')
  264. }
  265. }
  266. return string(b)
  267. }
  268. // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ja_JP'
  269. // in accounting notation.
  270. func (ja *ja_JP) FmtAccounting(num float64, v uint64, currency currency.Type) string {
  271. s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
  272. symbol := ja.currencies[currency]
  273. l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
  274. count := 0
  275. inWhole := v == 0
  276. b := make([]byte, 0, l)
  277. for i := len(s) - 1; i >= 0; i-- {
  278. if s[i] == '.' {
  279. b = append(b, ja.decimal[0])
  280. inWhole = true
  281. continue
  282. }
  283. if inWhole {
  284. if count == 3 {
  285. b = append(b, ja.group[0])
  286. count = 1
  287. } else {
  288. count++
  289. }
  290. }
  291. b = append(b, s[i])
  292. }
  293. if num < 0 {
  294. for j := len(symbol) - 1; j >= 0; j-- {
  295. b = append(b, symbol[j])
  296. }
  297. b = append(b, ja.currencyNegativePrefix[0])
  298. } else {
  299. for j := len(symbol) - 1; j >= 0; j-- {
  300. b = append(b, symbol[j])
  301. }
  302. }
  303. // reverse
  304. for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
  305. b[i], b[j] = b[j], b[i]
  306. }
  307. if int(v) < 2 {
  308. if v == 0 {
  309. b = append(b, ja.decimal...)
  310. }
  311. for i := 0; i < 2-int(v); i++ {
  312. b = append(b, '0')
  313. }
  314. }
  315. if num < 0 {
  316. b = append(b, ja.currencyNegativeSuffix...)
  317. }
  318. return string(b)
  319. }
  320. // FmtDateShort returns the short date representation of 't' for 'ja_JP'
  321. func (ja *ja_JP) FmtDateShort(t time.Time) string {
  322. b := make([]byte, 0, 32)
  323. if t.Year() > 0 {
  324. b = strconv.AppendInt(b, int64(t.Year()), 10)
  325. } else {
  326. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  327. }
  328. b = append(b, []byte{0x2f}...)
  329. if t.Month() < 10 {
  330. b = append(b, '0')
  331. }
  332. b = strconv.AppendInt(b, int64(t.Month()), 10)
  333. b = append(b, []byte{0x2f}...)
  334. if t.Day() < 10 {
  335. b = append(b, '0')
  336. }
  337. b = strconv.AppendInt(b, int64(t.Day()), 10)
  338. return string(b)
  339. }
  340. // FmtDateMedium returns the medium date representation of 't' for 'ja_JP'
  341. func (ja *ja_JP) FmtDateMedium(t time.Time) string {
  342. b := make([]byte, 0, 32)
  343. if t.Year() > 0 {
  344. b = strconv.AppendInt(b, int64(t.Year()), 10)
  345. } else {
  346. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  347. }
  348. b = append(b, []byte{0x2f}...)
  349. if t.Month() < 10 {
  350. b = append(b, '0')
  351. }
  352. b = strconv.AppendInt(b, int64(t.Month()), 10)
  353. b = append(b, []byte{0x2f}...)
  354. if t.Day() < 10 {
  355. b = append(b, '0')
  356. }
  357. b = strconv.AppendInt(b, int64(t.Day()), 10)
  358. return string(b)
  359. }
  360. // FmtDateLong returns the long date representation of 't' for 'ja_JP'
  361. func (ja *ja_JP) FmtDateLong(t time.Time) string {
  362. b := make([]byte, 0, 32)
  363. if t.Year() > 0 {
  364. b = strconv.AppendInt(b, int64(t.Year()), 10)
  365. } else {
  366. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  367. }
  368. b = append(b, []byte{0xe5, 0xb9, 0xb4}...)
  369. b = strconv.AppendInt(b, int64(t.Month()), 10)
  370. b = append(b, []byte{0xe6, 0x9c, 0x88}...)
  371. b = strconv.AppendInt(b, int64(t.Day()), 10)
  372. b = append(b, []byte{0xe6, 0x97, 0xa5}...)
  373. return string(b)
  374. }
  375. // FmtDateFull returns the full date representation of 't' for 'ja_JP'
  376. func (ja *ja_JP) FmtDateFull(t time.Time) string {
  377. b := make([]byte, 0, 32)
  378. if t.Year() > 0 {
  379. b = strconv.AppendInt(b, int64(t.Year()), 10)
  380. } else {
  381. b = strconv.AppendInt(b, int64(-t.Year()), 10)
  382. }
  383. b = append(b, []byte{0xe5, 0xb9, 0xb4}...)
  384. b = strconv.AppendInt(b, int64(t.Month()), 10)
  385. b = append(b, []byte{0xe6, 0x9c, 0x88}...)
  386. b = strconv.AppendInt(b, int64(t.Day()), 10)
  387. b = append(b, []byte{0xe6, 0x97, 0xa5}...)
  388. b = append(b, ja.daysWide[t.Weekday()]...)
  389. return string(b)
  390. }
  391. // FmtTimeShort returns the short time representation of 't' for 'ja_JP'
  392. func (ja *ja_JP) FmtTimeShort(t time.Time) string {
  393. b := make([]byte, 0, 32)
  394. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  395. b = append(b, ja.timeSeparator...)
  396. if t.Minute() < 10 {
  397. b = append(b, '0')
  398. }
  399. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  400. return string(b)
  401. }
  402. // FmtTimeMedium returns the medium time representation of 't' for 'ja_JP'
  403. func (ja *ja_JP) FmtTimeMedium(t time.Time) string {
  404. b := make([]byte, 0, 32)
  405. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  406. b = append(b, ja.timeSeparator...)
  407. if t.Minute() < 10 {
  408. b = append(b, '0')
  409. }
  410. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  411. b = append(b, ja.timeSeparator...)
  412. if t.Second() < 10 {
  413. b = append(b, '0')
  414. }
  415. b = strconv.AppendInt(b, int64(t.Second()), 10)
  416. return string(b)
  417. }
  418. // FmtTimeLong returns the long time representation of 't' for 'ja_JP'
  419. func (ja *ja_JP) FmtTimeLong(t time.Time) string {
  420. b := make([]byte, 0, 32)
  421. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  422. b = append(b, ja.timeSeparator...)
  423. if t.Minute() < 10 {
  424. b = append(b, '0')
  425. }
  426. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  427. b = append(b, ja.timeSeparator...)
  428. if t.Second() < 10 {
  429. b = append(b, '0')
  430. }
  431. b = strconv.AppendInt(b, int64(t.Second()), 10)
  432. b = append(b, []byte{0x20}...)
  433. tz, _ := t.Zone()
  434. b = append(b, tz...)
  435. return string(b)
  436. }
  437. // FmtTimeFull returns the full time representation of 't' for 'ja_JP'
  438. func (ja *ja_JP) FmtTimeFull(t time.Time) string {
  439. b := make([]byte, 0, 32)
  440. b = strconv.AppendInt(b, int64(t.Hour()), 10)
  441. b = append(b, []byte{0xe6, 0x99, 0x82}...)
  442. if t.Minute() < 10 {
  443. b = append(b, '0')
  444. }
  445. b = strconv.AppendInt(b, int64(t.Minute()), 10)
  446. b = append(b, []byte{0xe5, 0x88, 0x86}...)
  447. if t.Second() < 10 {
  448. b = append(b, '0')
  449. }
  450. b = strconv.AppendInt(b, int64(t.Second()), 10)
  451. b = append(b, []byte{0xe7, 0xa7, 0x92, 0x20}...)
  452. tz, _ := t.Zone()
  453. if btz, ok := ja.timezones[tz]; ok {
  454. b = append(b, btz...)
  455. } else {
  456. b = append(b, tz...)
  457. }
  458. return string(b)
  459. }