package ezjs_extension

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

Source file i18n_chrome_common.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
open Ezjs_min

class type language_percent = object
  method language : js_string t prop
  method percentage : int prop
end

class type language_detection = object
  method isReliable : bool t prop
  method languages : language_percent t js_array t prop
end

class type i18n = object
  method getAcceptLanguages : (js_string t js_array t -> unit) callback -> unit meth
  method getMessage : js_string t -> js_string t js_array t optdef -> js_string t meth
  method getUILanguage : js_string t meth
  method detectLanguage : js_string t -> (language_detection t -> unit) callback -> unit meth
end

let i18n = Unsafe.global##.chrome##.i18n

let getMessage ?substitutions message =
  to_string (i18n##getMessage (string message) (optdef (of_listf string) substitutions))
let getUILanguage () = i18n##getUILanguage
OCaml

Innovation. Community. Security.