package js_of_ocaml

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file intl.ml

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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
(* Js_of_ocaml library
 * http://www.ocsigen.org/js_of_ocaml/
 * Copyright (C) 2018 Stéphane Legrand
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, with linking exception;
 * either version 2.1 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *)
open! Import

module type Shared = sig
  class type object_options =
    object
      method localeMatcher : Js.js_string Js.t Js.prop
    end

  val object_options : unit -> object_options Js.t

  class type _object =
    object
      method supportedLocalesOf :
           Js.js_string Js.t Js.js_array Js.t
        -> object_options Js.t Js.optdef
        -> Js.js_string Js.t Js.js_array Js.t Js.meth
    end
end

module Shared : Shared = struct
  class type object_options =
    object
      method localeMatcher : Js.js_string Js.t Js.prop
    end

  let object_options () =
    object%js
      val mutable localeMatcher = Js.string "best fit"
    end

  class type _object =
    object
      method supportedLocalesOf :
           Js.js_string Js.t Js.js_array Js.t
        -> object_options Js.t Js.optdef
        -> Js.js_string Js.t Js.js_array Js.t Js.meth
    end
end

module Collator = struct
  include Shared

  class type resolved_options =
    object
      method locale : Js.js_string Js.t Js.readonly_prop

      method usage : Js.js_string Js.t Js.readonly_prop

      method sensitivity : Js.js_string Js.t Js.readonly_prop

      method ignorePunctuation : bool Js.t Js.readonly_prop

      method collation : Js.js_string Js.t Js.readonly_prop

      method numeric : bool Js.t Js.readonly_prop

      method caseFirst : Js.js_string Js.t Js.readonly_prop
    end

  class type options =
    object
      method localeMatcher : Js.js_string Js.t Js.prop

      method usage : Js.js_string Js.t Js.prop

      method sensitivity : Js.js_string Js.t Js.prop

      method ignorePunctuation : bool Js.t Js.prop

      method numeric : bool Js.t Js.prop

      method caseFirst : Js.js_string Js.t Js.prop
    end

  let options () =
    object%js
      val mutable localeMatcher = Js.string "best fit"

      val mutable usage = Js.string "sort"

      val mutable sensitivity = Js.string "variant"

      val mutable ignorePunctuation = Js._false

      val mutable numeric = Js._false

      val mutable caseFirst = Js.string "false"
    end

  class type t =
    object
      method compare : (Js.js_string Js.t -> Js.js_string Js.t -> int) Js.readonly_prop

      method resolvedOptions : unit -> resolved_options Js.t Js.meth
    end
end

module DateTimeFormat = struct
  include Shared

  class type resolved_options =
    object
      method locale : Js.js_string Js.t Js.readonly_prop

      method calendar : Js.js_string Js.t Js.readonly_prop

      method numberingSystem : Js.js_string Js.t Js.readonly_prop

      method timeZone : Js.js_string Js.t Js.readonly_prop

      method hour12 : bool Js.t Js.readonly_prop

      method weekday : Js.js_string Js.t Js.optdef_prop

      method era : Js.js_string Js.t Js.optdef_prop

      method year : Js.js_string Js.t Js.optdef_prop

      method month : Js.js_string Js.t Js.optdef_prop

      method day : Js.js_string Js.t Js.optdef_prop

      method hour : Js.js_string Js.t Js.optdef_prop

      method minute : Js.js_string Js.t Js.optdef_prop

      method second : Js.js_string Js.t Js.optdef_prop

      method timeZoneName : Js.js_string Js.t Js.optdef_prop
    end

  class type options =
    object
      method dateStyle : Js.js_string Js.t Js.optdef Js.prop

      method timeStyle : Js.js_string Js.t Js.optdef Js.prop

      method calendar : Js.js_string Js.t Js.optdef Js.prop

      method dayPeriod : Js.js_string Js.t Js.optdef Js.prop

      method numberingSystem : Js.js_string Js.t Js.optdef Js.prop

      method localeMatcher : Js.js_string Js.t Js.prop

      method timeZone : Js.js_string Js.t Js.optdef Js.prop

      method hour12 : bool Js.t Js.optdef Js.prop

      method hourCycle : Js.js_string Js.t Js.optdef Js.prop

      method formatMatcher : Js.js_string Js.t Js.prop

      method weekday : Js.js_string Js.t Js.optdef Js.prop

      method era : Js.js_string Js.t Js.optdef Js.prop

      method year : Js.js_string Js.t Js.optdef Js.prop

      method month : Js.js_string Js.t Js.optdef Js.prop

      method day : Js.js_string Js.t Js.optdef Js.prop

      method hour : Js.js_string Js.t Js.optdef Js.prop

      method minute : Js.js_string Js.t Js.optdef Js.prop

      method second : Js.js_string Js.t Js.optdef Js.prop

      method fractionalSecondDigits : int Js.optdef Js.prop

      method timeZoneName : Js.js_string Js.t Js.optdef Js.prop
    end

  let options () : options Js.t =
    object%js
      val mutable dateStyle = Js.undefined

      val mutable timeStyle = Js.undefined

      val mutable calendar = Js.undefined

      val mutable dayPeriod = Js.undefined

      val mutable numberingSystem = Js.undefined

      val mutable localeMatcher = Js.string "best fit"

      val mutable timeZone = Js.undefined

      val mutable hour12 = Js.undefined

      val mutable hourCycle = Js.undefined

      val mutable formatMatcher = Js.string "best fit"

      val mutable weekday = Js.undefined

      val mutable era = Js.undefined

      val mutable year = Js.undefined

      val mutable month = Js.undefined

      val mutable day = Js.undefined

      val mutable hour = Js.undefined

      val mutable minute = Js.undefined

      val mutable second = Js.undefined

      val mutable fractionalSecondDigits = Js.undefined

      val mutable timeZoneName = Js.undefined
    end

  class type format_part =
    object
      method _type : Js.js_string Js.t Js.readonly_prop

      method _value : Js.js_string Js.t Js.readonly_prop
    end

  class type t =
    object
      method format : (Js.date Js.t -> Js.js_string Js.t) Js.readonly_prop

      method formatToParts :
        Js.date Js.t Js.optdef -> format_part Js.t Js.js_array Js.t Js.meth

      method resolvedOptions : unit -> resolved_options Js.t Js.meth
    end
end

module NumberFormat = struct
  include Shared

  class type resolved_options =
    object
      method locale : Js.js_string Js.t Js.readonly_prop

      method numberingSystem : Js.js_string Js.t Js.readonly_prop

      method style : Js.js_string Js.t Js.readonly_prop

      method currency : Js.js_string Js.t Js.optdef_prop

      method currencyDisplay : Js.js_string Js.t Js.optdef_prop

      method useGrouping : bool Js.t Js.readonly_prop

      method minimumIntegerDigits : int Js.optdef_prop

      method minimumFractionDigits : int Js.optdef_prop

      method maximumFractionDigits : int Js.optdef_prop

      method minimumSignificantDigits : int Js.optdef_prop

      method maximumSignificantDigits : int Js.optdef_prop
    end

  class type options =
    object
      method compactDisplay : Js.js_string Js.t Js.optdef Js.prop

      method currency : Js.js_string Js.t Js.optdef Js.prop

      method currencyDisplay : Js.js_string Js.t Js.optdef Js.prop

      method currencySign : Js.js_string Js.t Js.optdef Js.prop

      method localeMatcher : Js.js_string Js.t Js.prop

      method notation : Js.js_string Js.t Js.optdef Js.prop

      method numberingSystem : Js.js_string Js.t Js.optdef Js.prop

      method signDisplay : Js.js_string Js.t Js.optdef Js.prop

      method style : Js.js_string Js.t Js.prop

      method unit : Js.js_string Js.t Js.optdef Js.prop

      method unitDisplay : Js.js_string Js.t Js.optdef Js.prop

      method useGrouping : bool Js.t Js.prop

      method roundingMode : Js.js_string Js.t Js.optdef Js.prop

      method roundingPriority : Js.js_string Js.t Js.optdef Js.prop

      method roundingIncrement : Js.js_string Js.t Js.optdef Js.prop

      method trailingZeroDisplay : Js.js_string Js.t Js.optdef Js.prop

      method minimumIntegerDigits : int Js.optdef Js.prop

      method minimumFractionDigits : int Js.optdef Js.prop

      method maximumFractionDigits : int Js.optdef Js.prop

      method minimumSignificantDigits : int Js.optdef Js.prop

      method maximumSignificantDigits : int Js.optdef Js.prop
    end

  let options () : options Js.t =
    object%js
      val mutable compactDisplay = Js.undefined

      val mutable currency = Js.undefined

      val mutable currencyDisplay = Js.undefined

      val mutable currencySign = Js.undefined

      val mutable localeMatcher = Js.string "best fit"

      val mutable notation = Js.undefined

      val mutable numberingSystem = Js.undefined

      val mutable signDisplay = Js.undefined

      val mutable style = Js.string "decimal"

      val mutable unit = Js.undefined

      val mutable unitDisplay = Js.undefined

      val mutable useGrouping = Js._true

      val mutable roundingMode = Js.undefined

      val mutable roundingPriority = Js.undefined

      val mutable roundingIncrement = Js.undefined

      val mutable trailingZeroDisplay = Js.undefined

      val mutable minimumIntegerDigits = Js.undefined

      val mutable minimumFractionDigits = Js.undefined

      val mutable maximumFractionDigits = Js.undefined

      val mutable minimumSignificantDigits = Js.undefined

      val mutable maximumSignificantDigits = Js.undefined
    end

  class type format_part =
    object
      method _type : Js.js_string Js.t Js.readonly_prop

      method _value : Js.js_string Js.t Js.readonly_prop
    end

  class type t =
    object
      method format : (Js.number Js.t -> Js.js_string Js.t) Js.readonly_prop

      method formatToParts :
        Js.number Js.t Js.optdef -> format_part Js.t Js.js_array Js.t Js.meth

      method resolvedOptions : unit -> resolved_options Js.t Js.meth
    end
end

module PluralRules = struct
  include Shared

  class type resolved_options =
    object
      method locale : Js.js_string Js.t Js.readonly_prop

      method pluralCategories : Js.js_string Js.t Js.js_array Js.t Js.readonly_prop

      method _type : Js.js_string Js.t Js.readonly_prop

      method minimumIntegerDigits : int Js.optdef_prop

      method minimumFractionDigits : int Js.optdef_prop

      method maximumFractionDigits : int Js.optdef_prop

      method minimumSignificantDigits : int Js.optdef_prop

      method maximumSignificantDigits : int Js.optdef_prop
    end

  class type options =
    object
      method localeMatcher : Js.js_string Js.t Js.prop

      method _type : Js.js_string Js.t Js.prop
    end

  let options () : options Js.t =
    object%js
      val mutable localeMatcher = Js.string "best fit"

      val mutable _type = Js.string "cardinal"
    end

  class type t =
    object
      method select : Js.number Js.t -> Js.js_string Js.t Js.meth

      method resolvedOptions : unit -> resolved_options Js.t Js.meth
    end
end

class type intl =
  object
    method _Collator : Collator._object Js.t Js.readonly_prop

    method _DateTimeFormat : DateTimeFormat._object Js.t Js.readonly_prop

    method _NumberFormat : NumberFormat._object Js.t Js.readonly_prop

    method _PluralRules : PluralRules._object Js.t Js.readonly_prop

    method getCanonicalLocales :
      Js.js_string Js.t Js.js_array Js.t -> Js.js_string Js.t Js.js_array Js.t Js.meth
  end

let intl = Js.Unsafe.global##._Intl

let collator_constr = Js.Unsafe.global##._Intl##._Collator

let dateTimeFormat_constr = Js.Unsafe.global##._Intl##._DateTimeFormat

let numberFormat_constr = Js.Unsafe.global##._Intl##._NumberFormat

let pluralRules_constr = Js.Unsafe.global##._Intl##._PluralRules

let is_supported () = Js.Optdef.test intl
OCaml

Innovation. Community. Security.