summaryrefslogtreecommitdiff
path: root/lib/naming/lang.mli
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-20 15:49:00 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-20 15:49:00 +0200
commitc02e77b73aad34fb5a672a5234a66d64f23b45ce (patch)
treebff3ae0751e8005bc4f5448cc2992c3bcad2d86b /lib/naming/lang.mli
parent987175105ead0ea78b960c0e638a81c6fd2384cf (diff)
downloadcolitur-c02e77b73aad34fb5a672a5234a66d64f23b45ce.tar.gz
colitur-c02e77b73aad34fb5a672a5234a66d64f23b45ce.zip
feat(lang): read [bible] and [sigla] sections
Lang reads a hardcoded list of section names and ignores anything else silently, so without this a [bible] section would appear to work and do nothing -- confirmed directly with a scratch executable: before this change, of_string on text containing a [bible] section parsed without error and Lang.keys came back empty, no trace of the section anywhere. Lang.bible keeps the total-lookup contract every other lookup in this module has: a miss returns the key itself, never the empty string. Lang.sigla_fields returns the [sigla] section's raw fields, values trimmed but still quoted, for Render.style_of_fields to unquote. [bible] joins the keys reference set so lang --check reports missing book names; [sigla] deliberately does not, being settings with working defaults rather than translatable names -- adding it would make --check demand five settings from every language file.
Diffstat (limited to 'lib/naming/lang.mli')
-rw-r--r--lib/naming/lang.mli27
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/naming/lang.mli b/lib/naming/lang.mli
index 34a6d5d..3c62d26 100644
--- a/lib/naming/lang.mli
+++ b/lib/naming/lang.mli
@@ -55,6 +55,13 @@ val term : t -> string -> string
degradation an unnamed slug already gets, not a special case. *)
val rite : t -> string -> string
+(** A Bible book's name, from the [\[bible\]] section. The key is
+ [<book_id>.full] or [<book_id>.abbr] (e.g. ["luke.abbr"]). A miss returns
+ the key itself, the same TOTAL-lookup contract as every other function
+ here -- callers turn that into a real fallback via
+ {!Colitur_citation.Book.default_spelling}, not this module. *)
+val bible : t -> string -> string
+
(** [weekday t n], 0 = Sunday. Out-of-range [n] returns [string_of_int n]. *)
val weekday : t -> int -> string
@@ -69,5 +76,23 @@ val month : t -> int -> string
val month_abbr : 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"]. *)
+ [lang --check]. Keys are qualified as e.g. ["celebration.ef-epiphany"].
+
+ Includes [\[bible\]] (["bible.luke.abbr"]): book names are translatable
+ text, so a file missing them is genuinely incomplete and [lang --check]
+ should say so. Deliberately EXCLUDES [\[sigla\]]: those are five citation-
+ style settings with working defaults ({!Colitur_citation.Render.default_style}),
+ not names a translator owes -- listing them here would make [--check]
+ demand five settings from every language file. *)
val keys : t -> (string * string) list
+
+(** The [\[sigla\]] section's raw fields, for
+ {!Colitur_citation.Render.style_of_fields} to read. Values come back
+ TRIMMED (whitespace at both ends) but still QUOTED if the file quoted
+ them -- unquoting is [Render]'s job, not this module's, the same reason
+ {!Colitur_kernel.Overlay_ini} (which this parses through) never unquotes
+ either. An empty (or absent) [\[sigla\]] section returns [[]]; unlike
+ every lookup above, there is no per-key TOTAL contract to keep here --
+ this is a settings bag, not a translation table, and [Render] already
+ supplies its own defaults for whatever is missing. *)
+val sigla_fields : t -> (string * string) list