aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-edit/shared/i18n-primeng-calendar.service.ts
blob: b05852ff8f74699cd90e659e65d74bb2ae8618ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { I18n } from '@ngx-translate/i18n-polyfill'
import { Injectable } from '@angular/core'

@Injectable()
export class I18nPrimengCalendarService {
  private readonly calendarLocale: any = {}

  constructor (private i18n: I18n) {
    this.calendarLocale = {
      firstDayOfWeek: 0,
      dayNames: [
        this.i18n('Sunday'),
        this.i18n('Monday'),
        this.i18n('Tuesday'),
        this.i18n('Wednesday'),
        this.i18n('Thursday'),
        this.i18n('Friday'),
        this.i18n('Saturday')
      ],

      dayNamesShort: [
        this.i18n({ value: 'Sun', description: 'Day name short' }),
        this.i18n({ value: 'Mon', description: 'Day name short' }),
        this.i18n({ value: 'Tue', description: 'Day name short' }),
        this.i18n({ value: 'Wed', description: 'Day name short' }),
        this.i18n({ value: 'Thu', description: 'Day name short' }),
        this.i18n({ value: 'Fri', description: 'Day name short' }),
        this.i18n({ value: 'Sat', description: 'Day name short' })
      ],

      dayNamesMin: [
        this.i18n({ value: 'Su', description: 'Day name min' }),
        this.i18n({ value: 'Mo', description: 'Day name min' }),
        this.i18n({ value: 'Tu', description: 'Day name min' }),
        this.i18n({ value: 'We', description: 'Day name min' }),
        this.i18n({ value: 'Th', description: 'Day name min' }),
        this.i18n({ value: 'Fr', description: 'Day name min' }),
        this.i18n({ value: 'Sa', description: 'Day name min' })
      ],

      monthNames: [
        this.i18n('January'),
        this.i18n('February'),
        this.i18n('March'),
        this.i18n('April'),
        this.i18n('May'),
        this.i18n('June'),
        this.i18n('July'),
        this.i18n('August'),
        this.i18n('September'),
        this.i18n('October'),
        this.i18n('November'),
        this.i18n('December')
      ],

      monthNamesShort: [
        this.i18n({ value: 'Jan', description: 'Month name short' }),
        this.i18n({ value: 'Feb', description: 'Month name short' }),
        this.i18n({ value: 'Mar', description: 'Month name short' }),
        this.i18n({ value: 'Apr', description: 'Month name short' }),
        this.i18n({ value: 'May', description: 'Month name short' }),
        this.i18n({ value: 'Jun', description: 'Month name short' }),
        this.i18n({ value: 'Jul', description: 'Month name short' }),
        this.i18n({ value: 'Aug', description: 'Month name short' }),
        this.i18n({ value: 'Sep', description: 'Month name short' }),
        this.i18n({ value: 'Oct', description: 'Month name short' }),
        this.i18n({ value: 'Nov', description: 'Month name short' }),
        this.i18n({ value: 'Dec', description: 'Month name short' })
      ],

      today: this.i18n('Today'),

      clear: this.i18n('Clear')
    }
  }

  getCalendarLocale () {
    return this.calendarLocale
  }

  getTimezone () {
    const gmt = new Date().toString().match(/([A-Z]+[\+-][0-9]+)/)[1]
    const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone

    return `${timezone} - ${gmt}`
  }

  getDateFormat () {
    return this.i18n({
      value: 'yy-mm-dd ',
      description: 'Date format in this locale.'
    })
  }
}