-
Notifications
You must be signed in to change notification settings - Fork 0
/
en.ts
64 lines (63 loc) · 1.69 KB
/
en.ts
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
import { createMessages } from 'intl-ts'
export const messages = createMessages({
$: 'English',
welcome: 'Welcome here!',
displayTime: (date: string, time: string) => `We are ${date}, and it is ${time}.`,
selectLanguage: 'Select a language:',
enterName: 'Enter you name:',
hello: (name: string) => `Hello ${name}!`,
showNameSize: (size: number) => {
switch (size) {
case 0: {
return 'You did not give a name yet.'
}
case 1: {
return 'Your name has one single letter.'
}
default: {
return `Your name has ${size} letters.`
}
}
},
serverReady: 'Server ready',
convertDate: (date: Date) => {
return (
['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][date.getDay()] +
', ' +
[
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December',
][date.getMonth()] +
` ${date.getDate()}, ${date.getFullYear()}`
)
},
convertTime: (date: Date) => {
let time = ''
if (date.getHours() === 0 && date.getMinutes() === 0) {
time = 'midnight'
} else if (date.getHours() === 12 && date.getMinutes() === 0) {
time = 'noon'
} else {
time += ((date.getHours() + 11) % 12) + 1
time += date.getMinutes() === 0 ? '' : ':' + ('0' + date.getMinutes()).slice(-2)
time += date.getHours() >= 12 ? ' p.m.' : ' a.m.'
}
if (date.getSeconds() !== 0) {
time += ` and ${date.getSeconds()} second`
if (date.getSeconds() > 1) {
time += 's'
}
}
return time
},
})