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
|
(** A language table: strings to strings, nothing more.
Knows nothing about calendars, dates or rites, and never touches the
filesystem -- callers hand it text. That is what lets every command use it
without the kernel learning about presentation.
Every lookup is TOTAL. A key with no entry returns THE KEY ITSELF, never the
empty string: a partial translation must be usable from its first line, and
an untranslated day must still print something a reader can act on. This is
also why the pre-naming output (bare slugs) is exactly what an empty table
produces -- the degraded case is the old behaviour, not a blank page. *)
type t
(** Parse INI text. Never raises. [Error] on a malformed file or a missing
[\[meta\] lang]. *)
val of_string : string -> (t, string) result
val code : t -> string
val fallback_code : t -> string option
(** [with_fallback t base] resolves through [t] first, then [base], then the key. *)
val with_fallback : t -> t -> t
(** The identity table: every lookup returns its key. This is what [--raw] uses,
so raw output is one table passed around rather than a special case threaded
through every call site. *)
val raw : t
val celebration : t -> string -> string
val season : t -> string -> string
val rank : t -> string -> string
val colour : t -> string -> string
val term : t -> string -> string
(** [weekday t n], 0 = Sunday. Out-of-range [n] returns [string_of_int n]. *)
val weekday : t -> int -> string
(** [month t n], 1 = January. Out-of-range [n] returns [string_of_int n]. *)
val month : t -> int -> string
(** Every (section-qualified key, value) pair, sorted. Used by [lang --dump] and
[lang --check]. Keys are qualified as e.g. ["celebration.ef-epiphany"]. *)
val keys : t -> (string * string) list
|