-
Notifications
You must be signed in to change notification settings - Fork 26
/
Local.elm
144 lines (127 loc) · 3.03 KB
/
Local.elm
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
module Date.Local exposing (Local, Months, WeekDays, TimeZones, international)
{-| A record type to store localized time formatting information.
@docs international
@docs Local, Months, WeekDays, TimeZones
-}
import Dict exposing (Dict)
{-| A collection of strings and formats for localizing formats.
Time zones and default formats are not implemented,
but included to avoid possible version conflicts in the future.
-}
type alias Local =
{ date :
{ months : Months
, monthsAbbrev : Months
, wdays : WeekDays
, wdaysAbbrev : WeekDays
, defaultFormat :
Maybe String
-- for %x
}
, time :
{ am : String
, pm : String
, defaultFormat :
Maybe String
-- for %X
}
, timeZones :
Maybe TimeZones
-- for %Z
, defaultFormat :
Maybe String
-- for %c
}
{-| A record of names for the months of the year.
-}
type alias Months =
{ jan : String
, feb : String
, mar : String
, apr : String
, may : String
, jun : String
, jul : String
, aug : String
, sep : String
, oct : String
, nov : String
, dec : String
}
{-| A record of names for the days of the week.
-}
type alias WeekDays =
{ mon : String
, tue : String
, wed : String
, thu : String
, fri : String
, sat : String
, sun : String
}
{-| Maps from %z type string (+hhmm or -hhmm) to timezone name or abbreviation.
Not currently implemented.
-}
type alias TimeZones =
Dict String String
{-| A default set of localizations.
-}
international : Local
international =
{ date =
{ months =
{ jan = "January"
, feb = "February"
, mar = "March"
, apr = "April"
, may = "May"
, jun = "June"
, jul = "July"
, aug = "August"
, sep = "September"
, oct = "October"
, nov = "November"
, dec = "December"
}
, monthsAbbrev =
{ jan = "Jan"
, feb = "Feb"
, mar = "Mar"
, apr = "Apr"
, may = "May"
, jun = "Jun"
, jul = "Jul"
, aug = "Aug"
, sep = "Sep"
, oct = "Oct"
, nov = "Nov"
, dec = "Dec"
}
, wdays =
{ mon = "Monday"
, tue = "Tuesday"
, wed = "Wednesday"
, thu = "Thursday"
, fri = "Friday"
, sat = "Saturday"
, sun = "Sunday"
}
, wdaysAbbrev =
{ mon = "Mon"
, tue = "Tue"
, wed = "Wed"
, thu = "Thu"
, fri = "Fri"
, sat = "Sat"
, sun = "Sun"
}
, defaultFormat = Nothing
}
, time =
{ am = "am"
, pm = "pm"
, defaultFormat = Nothing
}
, timeZones = Nothing
, defaultFormat = Nothing
}