index.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // @ts-nocheck
  2. import type { DayutsLocale, DayutsRelativeTime} from '../../../utssdk/interface'
  3. /**
  4. * 英语本地化对象。
  5. */
  6. export default {
  7. name: 'en',
  8. /**
  9. * 星期名称数组。
  10. */
  11. weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  12. /**
  13. * 月份名称数组。
  14. */
  15. months: [
  16. 'January',
  17. 'February',
  18. 'March',
  19. 'April',
  20. 'May',
  21. 'June',
  22. 'July',
  23. 'August',
  24. 'September',
  25. 'October',
  26. 'November',
  27. 'December',
  28. ],
  29. relativeTime: {
  30. future: 'in %s',
  31. past: '%s ago',
  32. s: 'a few seconds',
  33. m: 'a minute',
  34. mm: '%d minutes',
  35. h: 'an hour',
  36. hh: '%d hours',
  37. d: 'a day',
  38. dd: '%d days',
  39. M: 'a month',
  40. MM: '%d months',
  41. y: 'a year',
  42. yy: '%d years'
  43. } as DayutsRelativeTime,
  44. /**
  45. * 序数函数,用于将数字转换为带有序数后缀的字符串。
  46. *
  47. * @param {number} n - 要转换的数字。
  48. * @returns {string} 带有序数后缀的字符串。
  49. */
  50. ordinal: (n : number, _ : string) : string => {
  51. const s = ['th', 'st', 'nd', 'rd']
  52. const v = n % 100
  53. const i = (v - 20) % 10
  54. const k = i < s.length ? i : v < s.length ? v : 0
  55. return `[${n}${(s[k])}]`
  56. },
  57. } as DayutsLocale