Expand description
Public Rust entry point for the ferrocat workspace.
This crate re-exports the primary API surface from the lower-level
ferrocat-po and ferrocat-icu crates so application code can depend on a
single package.
§Feature flags
The default feature set is full, which enables the complete current API
surface through catalog and serde.
catalogexposes high-level catalog parsing, updates, combining, audits, machine-translation metadata, plural handling, FCL storage, and runtime artifact compilation.serdeenables serde support in the re-exportedferrocat-poandferrocat-icutypes.compile,mt, andpluralsare reserved subsystem aliases. Today they implycatalog; they do not reduce or split the catalog API surface.
Use default-features = false for low-level PO and ICU parsing without the
catalog layer. Enabling compile, mt, or plurals currently has the same
dependency effect as enabling catalog.
§Examples
use ferrocat::{icu, po};
let po = po::parse_po("msgid \"Hello\"\nmsgstr \"Hallo\"\n")?;
let icu = icu::parse_icu("Hello {name}")?;
assert_eq!(po.items[0].msgid, "Hello");
assert_eq!(icu.nodes.len(), 2);use ferrocat::catalog::{
CompileSelectedCatalogArtifactOptions, CompiledCatalogIdIndex, CompiledKeyStrategy,
ParseCatalogOptions, compile_catalog_artifact_selected, parse_catalog,
};
let source = parse_catalog(
ParseCatalogOptions::new("msgid \"Hello\"\nmsgstr \"Hello\"\n", "en").with_locale("en"),
)?
.into_normalized_view()?;
let requested = parse_catalog(
ParseCatalogOptions::new("msgid \"Hello\"\nmsgstr \"Hallo\"\n", "en").with_locale("de"),
)?
.into_normalized_view()?;
let index = CompiledCatalogIdIndex::new(&[&requested, &source], CompiledKeyStrategy::FerrocatV1)?;
let compiled_ids = index.iter().map(|(id, _)| id).collect::<Vec<_>>();
let compiled = compile_catalog_artifact_selected(
&[&requested, &source],
&index,
&CompileSelectedCatalogArtifactOptions::new("de", "en", &compiled_ids),
)?;
assert_eq!(compiled.messages.len(), 1);use ferrocat::catalog::{
CatalogAuditOptions, ParseCatalogOptions, audit_catalogs, parse_catalog,
};
let source = parse_catalog(
ParseCatalogOptions::new("msgid \"Checkout\"\nmsgstr \"Checkout\"\n", "en").with_locale("en"),
)?
.into_normalized_view()?;
let target = parse_catalog(ParseCatalogOptions::new("", "en").with_locale("de"))?
.into_normalized_view()?;
let report = audit_catalogs(&[&source, &target], &CatalogAuditOptions::new("en"))?;
assert!(report.has_errors());Modules§
- catalog
catalog - High-level catalog maintenance, audit, and runtime artifact APIs.
- icu
- ICU MessageFormat parsing, analysis, compatibility, and metadata APIs.
- po
- Low-level PO parsing, serialization, and text merge APIs.
Structs§
- AiProvenance
catalog - AI provenance for a machine-managed value.
- Borrowed
Header - Borrowed header entry from the PO header block.
- Borrowed
PoFile - Borrowed PO document that reuses slices from the original input whenever possible.
- Borrowed
PoItem - Borrowed gettext message entry.
- Catalog
Audit Checks catalog - Enables or disables individual catalog audit checks.
- Catalog
Audit Diagnostic catalog - One machine-readable catalog audit diagnostic.
- Catalog
Audit IcuOptions catalog - ICU-specific options used by catalog audit checks.
- Catalog
Audit Message Ref catalog - Catalog message reference attached to audit diagnostics.
- Catalog
Audit Options catalog - Options controlling catalog audit checks.
- Catalog
Audit Report catalog - Report returned by
audit_catalogs. - Catalog
Audit Summary catalog - Summary counters for a catalog audit report.
- Catalog
Combine Input catalog - One catalog input passed to
super::combine_catalogs. - Catalog
Combine Result catalog - Result returned by catalog combine operations.
- Catalog
Combine Stats catalog - Basic counters describing a catalog combine operation.
- Catalog
Coverage Message catalog - One classified message row in a coverage report.
- Catalog
Coverage Options catalog - Options controlling catalog coverage reports.
- Catalog
Coverage Report catalog - Structured catalog coverage report.
- Catalog
File Combine Result catalog - Result returned by catalog file combine operations.
- Catalog
Locale Coverage catalog - Coverage counters for one target locale.
- Catalog
Locale Review catalog - Review details for one target locale.
- Catalog
Machine Translation Message catalog - One machine-translation metadata classification.
- Catalog
Machine Translation Review catalog - Machine-translation metadata summary for one locale.
- Catalog
Message catalog - Public message representation returned by
super::parse_catalog. - Catalog
Message Key catalog - Stable lookup key for catalog messages.
- Catalog
Origin catalog - Source origin metadata for an extracted message.
- Catalog
Review Options catalog - Options controlling catalog review reports.
- Catalog
Review Report catalog - Read-only catalog review report comparing two normalized catalog states.
- Catalog
Review Summary catalog - Aggregate counters for a catalog review report.
- Catalog
Source Change catalog - One source identity change.
- Catalog
Source Change Report catalog - Source identity add/remove summary.
- Catalog
Stats catalog - Basic counters describing an update operation.
- Catalog
Translation Change catalog - One target translation change.
- Catalog
Translation Change Report catalog - Translation change summary for one locale.
- Catalog
Update Result catalog - Result returned by catalog update operations.
- Combine
Catalog Files Options catalog - Options for combining catalog files on disk.
- Combine
Catalog Options catalog - Options for combining multiple catalogs into one deterministic catalog.
- Compile
Catalog Artifact IcuOptions catalog - ICU-specific options used while compiling catalog artifacts.
- Compile
Catalog Artifact Options catalog - Options controlling high-level compiled catalog artifact generation.
- Compile
Catalog Artifact Report Options catalog - Options controlling compiled artifact generation with a sibling provenance report.
- Compile
Catalog Options catalog - Options controlling runtime catalog compilation.
- Compile
Selected Catalog Artifact Options catalog - Options controlling selected-subset compiled catalog artifact generation.
- Compiled
Catalog catalog - Runtime-oriented lookup structure compiled from a normalized catalog.
- Compiled
Catalog Artifact catalog - Host-neutral compiled runtime artifact for one requested locale.
- Compiled
Catalog Artifact Report catalog - Result returned by
super::compile_catalog_artifact_report. - Compiled
Catalog Diagnostic catalog - Diagnostic emitted by
super::compile_catalog_artifact. - Compiled
Catalog IdDescription catalog - Metadata describing one compiled runtime ID for a specific catalog set.
- Compiled
Catalog IdIndex catalog - Stable compiled runtime ID index built from one or more normalized catalogs.
- Compiled
Catalog Missing Message catalog - Missing-message record emitted by
super::compile_catalog_artifact. - Compiled
Catalog Provenance Report catalog - Provenance metadata for one compiled requested-locale artifact.
- Compiled
Catalog Pseudolocalization Options catalog - Options controlling compiled catalog artifact pseudolocalization.
- Compiled
Catalog Resolution catalog - Provenance row for one compiled runtime message identity.
- Compiled
Catalog Unavailable Id catalog - Known compiled runtime ID that was not present in the provided catalog set.
- Compiled
Message catalog - A compiled runtime message keyed by a derived lookup key.
- Describe
Compiled IdsReport catalog - Report returned by
CompiledCatalogIdIndex::describe_compiled_ids. - Diagnostic
catalog - Non-fatal issue collected while parsing or updating catalogs.
- Diagnostic
Code catalog - Stable machine-readable diagnostic code.
- Extracted
Plural Message catalog - Structured plural message input used by catalog update operations.
- Extracted
Singular Message catalog - Structured singular message input used by catalog update operations.
- Header
- A single header entry from the PO header block.
- IcuAnalysis
- Structural summary of a parsed ICU message.
- IcuArgument
- One data argument reference discovered in an ICU message.
- IcuCompatibility
Options - Options controlling ICU source/translation compatibility checks.
- IcuCompatibility
Report - Report returned by
compare_icu_messages. - IcuDiagnostic
- One diagnostic emitted by an ICU compatibility check.
- IcuFormatter
- One formatter reference discovered in an ICU message.
- IcuMessage
- Parsed ICU message.
- IcuOption
- A selector branch inside a plural or select expression.
- IcuParse
Error - Error returned when parsing ICU messages fails.
- IcuParser
Options - Options controlling ICU parsing behavior.
- IcuPlural
Summary - One cardinal or ordinal plural expression discovered in an ICU message.
- IcuPosition
- Byte offset plus line/column location inside the original input.
- IcuPseudolocalization
Options - Options controlling ICU-aware pseudolocalization.
- IcuSelect
Summary - One select expression discovered in an ICU message.
- IcuTag
Summary - One rich-text tag discovered in an ICU message.
- Machine
Metadata catalog - Metadata for a catalog value that was set or managed by a machine.
- Merge
Message Input - Borrowed message input for the lightweight PO merge helper.
- Message
Argument Format Metadata - Formatter metadata attached to an argument.
- Message
Argument Metadata - Normalized semantic metadata for one message argument.
- Message
Metadata - Normalized semantic metadata for one source message.
- Message
Metadata Diagnostic - One diagnostic emitted while validating semantic message metadata.
- Message
Metadata Input - Authoring input for semantic message metadata.
- Message
Metadata Validation Report - Report returned by
validate_message_metadata. - Message
Origin Metadata - Extraction origin attached to semantic message metadata.
- Message
Selector Metadata - Selector metadata attached to a selecting argument.
- MsgStr
Iter - Iterator over
MsgStrvalues. - Normalized
Parsed Catalog catalog - Parsed catalog with fast key-based lookup helpers.
- Obsolete
Info catalog - Obsolete-entry payload. Presence on
CatalogMessage::obsoletemarks the entry obsolete;sincerecords when it became obsolete so hosts can age-cleanup withObsoleteStrategy::DropObsoleteBefore. - Parse
Catalog Options catalog - Options for parsing a catalog into the higher-level message model.
- Parse
Error - Error returned when parsing or unescaping PO content fails.
- Parse
Position - One-based line/column context plus the byte offset for a parse error.
- Parsed
Catalog catalog - Parsed catalog plus diagnostics and normalized headers.
- Plural
Source catalog - Source-side plural forms for structured catalog messages.
- PoFile
- An owned PO document.
- PoItem
- A single gettext message entry.
- PoVec
- Inline-capable vector for the small per-item collections (references, flags, comments, metadata) that hold a single element in the overwhelmingly common case, avoiding a heap allocation for the backing buffer.
- Render
Options catalog - Shared rendering options for catalog serialization.
- Serialize
Options - Options controlling PO serialization.
- Source
Extracted Message catalog - Source-first extractor input that lets
ferrocatinfer plural structure. - Update
Catalog File Options catalog - Options for updating a catalog file on disk.
- Update
Catalog Options catalog - Options for in-memory catalog updates.
Enums§
- ApiError
catalog - Error returned by catalog parsing and update APIs.
- Borrowed
MsgStr - Borrowed translation payload for a PO item.
- Catalog
Combine Selection catalog - Selection rule used after definitions from all inputs have been counted.
- Catalog
Conflict Strategy catalog - Strategy used when multiple catalogs define conflicting translations for one identity.
- Catalog
File Format catalog - File format used by disk-based catalog combine operations.
- Catalog
Machine Translation Status catalog - Machine-translation metadata freshness status.
- Catalog
Message Status catalog - Canonical catalog message status used by coverage and review reports.
- Catalog
Mode catalog - Valid high-level catalog mode combinations.
- Catalog
Review Translation catalog - Owned translation value used in review reports.
- Catalog
Semantics catalog - High-level semantics used by the catalog API.
- Catalog
Source Change Kind catalog - Kind of source identity change.
- Catalog
Storage Format catalog - Storage format used by the high-level catalog API.
- Catalog
Update Input catalog - Input payload accepted by catalog update operations.
- Compile
Catalog Artifact Report Selection catalog - Message selection for
super::compile_catalog_artifact_report. - Compiled
Catalog Resolution Kind catalog - How one compiled runtime message resolved for a requested-locale artifact.
- Compiled
Catalog Translation Kind catalog - High-level translation kind associated with a compiled runtime ID.
- Compiled
KeyStrategy catalog - Built-in key strategy used when compiling runtime catalogs.
- Compiled
Translation catalog - Translation value stored in a compiled runtime catalog.
- Diagnostic
Severity catalog - Severity level attached to a
Diagnostic. - Effective
Translation catalog - Owned translation value materialized from a parsed catalog.
- Effective
Translation Ref catalog - Borrowed view over a message translation.
- Extracted
Message catalog - Structured extractor input accepted by
super::update_catalogandsuper::update_catalog_file. - IcuArgument
Kind - Broad role of an ICU argument in a parsed message.
- IcuDiagnostic
Severity - Severity level attached to ICU authoring diagnostics.
- IcuError
Kind - High-level classification of ICU parse failures.
- IcuFormatter
Support - Consumer-defined support decision for an ICU formatter.
- IcuNode
- AST node emitted by the ICU parser.
- IcuPlural
Kind - Distinguishes cardinal and ordinal plural forms.
- IcuStyle
Kind - Classification of an optional formatter style segment.
- IcuSyntax
Policy catalog - ICU parser behavior used by catalog audit and runtime artifact validation.
- Message
Argument Kind - Broad argument kind used by semantic message metadata.
- Message
Argument Metadata Input - Progressive authoring input for one argument.
- Message
Format Style Kind - Classification of a message formatter style.
- Message
Selector Kind - Selector kind used by semantic message metadata.
- MsgStr
- Message translation payload for a PO item.
- Obsolete
Strategy catalog - Strategy used for messages that disappear from the extracted input.
- OrderBy
catalog - Sort order used when writing output catalogs.
- Placeholder
Comment Mode catalog - Controls whether placeholder hints are emitted as extracted comments.
- Plural
Encoding catalog - Encoding used for plural messages in PO files.
- Translation
Shape catalog - Public translation shape returned from parsed catalogs.
Constants§
- COMPILED_
CATALOG_ ARTIFACT_ SCHEMA_ VERSION catalog - JSON schema version emitted by
CompiledCatalogArtifactserialization.
Functions§
- analyze_
icu - Produces a structural summary of a parsed ICU message.
- audit_
catalogs catalog - Audits a normalized catalog set for catalog QA and authoring issues.
- combine_
catalog_ files catalog - Combines catalog files and atomically replaces the requested output path.
- combine_
catalogs catalog - Combines multiple catalogs into one deterministic catalog.
- compare_
icu_ messages - Compares source and translation ICU messages for authoring compatibility.
- compile_
catalog_ artifact catalog - Compiles one requested-locale runtime artifact from one or more normalized catalogs.
- compile_
catalog_ artifact_ report catalog - Compiles one requested-locale runtime artifact with a sibling provenance report.
- compile_
catalog_ artifact_ selected catalog - Compiles one requested-locale runtime artifact for a selected subset of compiled IDs.
- compiled_
key catalog - Derives the default stable runtime lookup key for
msgidandmsgctxt. - derive_
message_ metadata_ from_ icu - Derives normalized semantic metadata from an ICU MessageFormat v1
msgid. - escape_
string - Escapes a PO string literal payload.
- extract_
argument_ names - Extracts data argument names in first-seen order, excluding rich-text tags.
- extract_
quoted - Extracts and unescapes the first quoted PO string from
line. - extract_
quoted_ cow - Extracts and unescapes the first quoted PO string from
line, borrowing from the input when no escapes are present. - extract_
tag_ names - Extracts rich-text tag names in first-seen order.
- extract_
variables - Extracts variable names in first-seen order.
- has_
plural - Returns
truewhen the message contains a cardinal plural expression. - has_
select - Returns
truewhen the message contains a select expression. - has_
select_ ordinal - Returns
truewhen the message contains an ordinal plural expression. - has_tag
- Returns
truewhen the message contains rich-text style tags. - machine_
translation_ hash catalog - Computes the integrity-lock hash for a translation value.
- measure_
catalog_ coverage catalog - Builds a read-only completeness and coverage report for normalized catalogs.
- merge_
catalog - Merges extracted messages into an existing PO catalog while preserving the existing translation payload.
- normalize_
message_ metadata - Normalizes progressive semantic message metadata into canonical object form.
- parse_
catalog catalog - Parses catalog content into the higher-level representation used by
ferrocat’s catalog APIs. - parse_
icu - Parses ICU
MessageFormatinput with the default parser options. - parse_
icu_ with_ options - Parses ICU
MessageFormatinput with explicit parser options. - parse_
po - Parses PO content into the owned
PoFilerepresentation. - parse_
po_ borrowed - Parses PO content into a borrowed representation.
- parse_
po_ bytes - Parses UTF-8 PO bytes into the owned
PoFilerepresentation. - pseudolocalize_
compiled_ catalog_ artifact catalog - Pseudolocalizes the final runtime messages in a compiled catalog artifact.
- pseudolocalize_
icu - Pseudolocalizes an ICU message string while preserving ICU syntax.
- pseudolocalize_
icu_ message - Pseudolocalizes a parsed ICU message AST.
- review_
catalogs catalog - Compares previous and current normalized catalog states for translator review.
- stringify_
icu - Renders a parsed ICU message AST back to ICU
MessageFormattext. - stringify_
po - Serializes a
PoFileback into gettext PO text. - unescape_
string - Unescapes a PO string literal payload.
- update_
catalog catalog - Merges extracted messages into an existing catalog and returns updated catalog content.
- update_
catalog_ file catalog - Updates a catalog on disk and only writes the file when the rendered output changes.
- validate_
icu - Validates ICU
MessageFormatinput without returning the parsed AST. - validate_
icu_ formatter_ support - Validates ICU formatter usage against a consumer-provided support policy.
- validate_
icu_ formatter_ support_ from_ analysis - Validates analyzed ICU formatter usage against a consumer support policy.
- validate_
message_ metadata - Validates progressive semantic message metadata against its
msgid.
Type Aliases§
- IcuFormatter
Support Policy catalog - Callback used to validate runtime support for ICU formatters.