GettextTs.Catalog (gettext_ts v0.2.0)

Copy Markdown View Source

Reads the Gettext tree into a nested locale → domain → msgid → msgstr structure. Nesting is the collision fix: the same msgid may legitimately carry different translations in different domains.

Summary

Functions

All domains, derived from the .pot files, sorted.

All locale directories under the gettext path, sorted.

Msgids per domain from the POT files: %{domain => [msgid]}, sorted.

%{locale => %{domain => %{msgid => msgstr}}} for every locale on disk, plus the source locale synthesized as identity (msgid == msgstr) from the POT files — the source language needs no PO catalog.

Functions

domains(root \\ Config.gettext_path())

All domains, derived from the .pot files, sorted.

locales(root \\ Config.gettext_path())

All locale directories under the gettext path, sorted.

pot_index(root \\ Config.gettext_path())

Msgids per domain from the POT files: %{domain => [msgid]}, sorted.

read(root \\ Config.gettext_path(), opts \\ [])

%{locale => %{domain => %{msgid => msgstr}}} for every locale on disk, plus the source locale synthesized as identity (msgid == msgstr) from the POT files — the source language needs no PO catalog.

Options

  • :include_source (default true) — synthesize the source locale. Pass false when identity is not worth materializing: createT falls back to the msgid, so an identity catalog is the copy handed back to itself. A source locale that DOES have PO files on disk is read from them either way; the option only governs the synthesis.