Skip to main content

Crate ferrocat

Crate ferrocat 

Source
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.

  • catalog exposes high-level catalog parsing, updates, combining, audits, machine-translation metadata, plural handling, FCL storage, and runtime artifact compilation.
  • serde enables serde support in the re-exported ferrocat-po and ferrocat-icu types.
  • compile, mt, and plurals are reserved subsystem aliases. Today they imply catalog; 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§

catalogcatalog
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§

AiProvenancecatalog
AI provenance for a machine-managed value.
BorrowedHeader
Borrowed header entry from the PO header block.
BorrowedPoFile
Borrowed PO document that reuses slices from the original input whenever possible.
BorrowedPoItem
Borrowed gettext message entry.
CatalogAuditCheckscatalog
Enables or disables individual catalog audit checks.
CatalogAuditDiagnosticcatalog
One machine-readable catalog audit diagnostic.
CatalogAuditIcuOptionscatalog
ICU-specific options used by catalog audit checks.
CatalogAuditMessageRefcatalog
Catalog message reference attached to audit diagnostics.
CatalogAuditOptionscatalog
Options controlling catalog audit checks.
CatalogAuditReportcatalog
Report returned by audit_catalogs.
CatalogAuditSummarycatalog
Summary counters for a catalog audit report.
CatalogCombineInputcatalog
One catalog input passed to super::combine_catalogs.
CatalogCombineResultcatalog
Result returned by catalog combine operations.
CatalogCombineStatscatalog
Basic counters describing a catalog combine operation.
CatalogCoverageMessagecatalog
One classified message row in a coverage report.
CatalogCoverageOptionscatalog
Options controlling catalog coverage reports.
CatalogCoverageReportcatalog
Structured catalog coverage report.
CatalogFileCombineResultcatalog
Result returned by catalog file combine operations.
CatalogLocaleCoveragecatalog
Coverage counters for one target locale.
CatalogLocaleReviewcatalog
Review details for one target locale.
CatalogMachineTranslationMessagecatalog
One machine-translation metadata classification.
CatalogMachineTranslationReviewcatalog
Machine-translation metadata summary for one locale.
CatalogMessagecatalog
Public message representation returned by super::parse_catalog.
CatalogMessageKeycatalog
Stable lookup key for catalog messages.
CatalogOrigincatalog
Source origin metadata for an extracted message.
CatalogReviewOptionscatalog
Options controlling catalog review reports.
CatalogReviewReportcatalog
Read-only catalog review report comparing two normalized catalog states.
CatalogReviewSummarycatalog
Aggregate counters for a catalog review report.
CatalogSourceChangecatalog
One source identity change.
CatalogSourceChangeReportcatalog
Source identity add/remove summary.
CatalogStatscatalog
Basic counters describing an update operation.
CatalogTranslationChangecatalog
One target translation change.
CatalogTranslationChangeReportcatalog
Translation change summary for one locale.
CatalogUpdateResultcatalog
Result returned by catalog update operations.
CombineCatalogFilesOptionscatalog
Options for combining catalog files on disk.
CombineCatalogOptionscatalog
Options for combining multiple catalogs into one deterministic catalog.
CompileCatalogArtifactIcuOptionscatalog
ICU-specific options used while compiling catalog artifacts.
CompileCatalogArtifactOptionscatalog
Options controlling high-level compiled catalog artifact generation.
CompileCatalogArtifactReportOptionscatalog
Options controlling compiled artifact generation with a sibling provenance report.
CompileCatalogOptionscatalog
Options controlling runtime catalog compilation.
CompileSelectedCatalogArtifactOptionscatalog
Options controlling selected-subset compiled catalog artifact generation.
CompiledCatalogcatalog
Runtime-oriented lookup structure compiled from a normalized catalog.
CompiledCatalogArtifactcatalog
Host-neutral compiled runtime artifact for one requested locale.
CompiledCatalogArtifactReportcatalog
Result returned by super::compile_catalog_artifact_report.
CompiledCatalogDiagnosticcatalog
Diagnostic emitted by super::compile_catalog_artifact.
CompiledCatalogIdDescriptioncatalog
Metadata describing one compiled runtime ID for a specific catalog set.
CompiledCatalogIdIndexcatalog
Stable compiled runtime ID index built from one or more normalized catalogs.
CompiledCatalogMissingMessagecatalog
Missing-message record emitted by super::compile_catalog_artifact.
CompiledCatalogProvenanceReportcatalog
Provenance metadata for one compiled requested-locale artifact.
CompiledCatalogPseudolocalizationOptionscatalog
Options controlling compiled catalog artifact pseudolocalization.
CompiledCatalogResolutioncatalog
Provenance row for one compiled runtime message identity.
CompiledCatalogUnavailableIdcatalog
Known compiled runtime ID that was not present in the provided catalog set.
CompiledMessagecatalog
A compiled runtime message keyed by a derived lookup key.
DescribeCompiledIdsReportcatalog
Report returned by CompiledCatalogIdIndex::describe_compiled_ids.
Diagnosticcatalog
Non-fatal issue collected while parsing or updating catalogs.
DiagnosticCodecatalog
Stable machine-readable diagnostic code.
ExtractedPluralMessagecatalog
Structured plural message input used by catalog update operations.
ExtractedSingularMessagecatalog
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.
IcuCompatibilityOptions
Options controlling ICU source/translation compatibility checks.
IcuCompatibilityReport
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.
IcuParseError
Error returned when parsing ICU messages fails.
IcuParserOptions
Options controlling ICU parsing behavior.
IcuPluralSummary
One cardinal or ordinal plural expression discovered in an ICU message.
IcuPosition
Byte offset plus line/column location inside the original input.
IcuPseudolocalizationOptions
Options controlling ICU-aware pseudolocalization.
IcuSelectSummary
One select expression discovered in an ICU message.
IcuTagSummary
One rich-text tag discovered in an ICU message.
MachineMetadatacatalog
Metadata for a catalog value that was set or managed by a machine.
MergeMessageInput
Borrowed message input for the lightweight PO merge helper.
MessageArgumentFormatMetadata
Formatter metadata attached to an argument.
MessageArgumentMetadata
Normalized semantic metadata for one message argument.
MessageMetadata
Normalized semantic metadata for one source message.
MessageMetadataDiagnostic
One diagnostic emitted while validating semantic message metadata.
MessageMetadataInput
Authoring input for semantic message metadata.
MessageMetadataValidationReport
Report returned by validate_message_metadata.
MessageOriginMetadata
Extraction origin attached to semantic message metadata.
MessageSelectorMetadata
Selector metadata attached to a selecting argument.
MsgStrIter
Iterator over MsgStr values.
NormalizedParsedCatalogcatalog
Parsed catalog with fast key-based lookup helpers.
ObsoleteInfocatalog
Obsolete-entry payload. Presence on CatalogMessage::obsolete marks the entry obsolete; since records when it became obsolete so hosts can age-cleanup with ObsoleteStrategy::DropObsoleteBefore.
ParseCatalogOptionscatalog
Options for parsing a catalog into the higher-level message model.
ParseError
Error returned when parsing or unescaping PO content fails.
ParsePosition
One-based line/column context plus the byte offset for a parse error.
ParsedCatalogcatalog
Parsed catalog plus diagnostics and normalized headers.
PluralSourcecatalog
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.
RenderOptionscatalog
Shared rendering options for catalog serialization.
SerializeOptions
Options controlling PO serialization.
SourceExtractedMessagecatalog
Source-first extractor input that lets ferrocat infer plural structure.
UpdateCatalogFileOptionscatalog
Options for updating a catalog file on disk.
UpdateCatalogOptionscatalog
Options for in-memory catalog updates.

Enums§

ApiErrorcatalog
Error returned by catalog parsing and update APIs.
BorrowedMsgStr
Borrowed translation payload for a PO item.
CatalogCombineSelectioncatalog
Selection rule used after definitions from all inputs have been counted.
CatalogConflictStrategycatalog
Strategy used when multiple catalogs define conflicting translations for one identity.
CatalogFileFormatcatalog
File format used by disk-based catalog combine operations.
CatalogMachineTranslationStatuscatalog
Machine-translation metadata freshness status.
CatalogMessageStatuscatalog
Canonical catalog message status used by coverage and review reports.
CatalogModecatalog
Valid high-level catalog mode combinations.
CatalogReviewTranslationcatalog
Owned translation value used in review reports.
CatalogSemanticscatalog
High-level semantics used by the catalog API.
CatalogSourceChangeKindcatalog
Kind of source identity change.
CatalogStorageFormatcatalog
Storage format used by the high-level catalog API.
CatalogUpdateInputcatalog
Input payload accepted by catalog update operations.
CompileCatalogArtifactReportSelectioncatalog
Message selection for super::compile_catalog_artifact_report.
CompiledCatalogResolutionKindcatalog
How one compiled runtime message resolved for a requested-locale artifact.
CompiledCatalogTranslationKindcatalog
High-level translation kind associated with a compiled runtime ID.
CompiledKeyStrategycatalog
Built-in key strategy used when compiling runtime catalogs.
CompiledTranslationcatalog
Translation value stored in a compiled runtime catalog.
DiagnosticSeveritycatalog
Severity level attached to a Diagnostic.
EffectiveTranslationcatalog
Owned translation value materialized from a parsed catalog.
EffectiveTranslationRefcatalog
Borrowed view over a message translation.
ExtractedMessagecatalog
Structured extractor input accepted by super::update_catalog and super::update_catalog_file.
IcuArgumentKind
Broad role of an ICU argument in a parsed message.
IcuDiagnosticSeverity
Severity level attached to ICU authoring diagnostics.
IcuErrorKind
High-level classification of ICU parse failures.
IcuFormatterSupport
Consumer-defined support decision for an ICU formatter.
IcuNode
AST node emitted by the ICU parser.
IcuPluralKind
Distinguishes cardinal and ordinal plural forms.
IcuStyleKind
Classification of an optional formatter style segment.
IcuSyntaxPolicycatalog
ICU parser behavior used by catalog audit and runtime artifact validation.
MessageArgumentKind
Broad argument kind used by semantic message metadata.
MessageArgumentMetadataInput
Progressive authoring input for one argument.
MessageFormatStyleKind
Classification of a message formatter style.
MessageSelectorKind
Selector kind used by semantic message metadata.
MsgStr
Message translation payload for a PO item.
ObsoleteStrategycatalog
Strategy used for messages that disappear from the extracted input.
OrderBycatalog
Sort order used when writing output catalogs.
PlaceholderCommentModecatalog
Controls whether placeholder hints are emitted as extracted comments.
PluralEncodingcatalog
Encoding used for plural messages in PO files.
TranslationShapecatalog
Public translation shape returned from parsed catalogs.

Constants§

COMPILED_CATALOG_ARTIFACT_SCHEMA_VERSIONcatalog
JSON schema version emitted by CompiledCatalogArtifact serialization.

Functions§

analyze_icu
Produces a structural summary of a parsed ICU message.
audit_catalogscatalog
Audits a normalized catalog set for catalog QA and authoring issues.
combine_catalog_filescatalog
Combines catalog files and atomically replaces the requested output path.
combine_catalogscatalog
Combines multiple catalogs into one deterministic catalog.
compare_icu_messages
Compares source and translation ICU messages for authoring compatibility.
compile_catalog_artifactcatalog
Compiles one requested-locale runtime artifact from one or more normalized catalogs.
compile_catalog_artifact_reportcatalog
Compiles one requested-locale runtime artifact with a sibling provenance report.
compile_catalog_artifact_selectedcatalog
Compiles one requested-locale runtime artifact for a selected subset of compiled IDs.
compiled_keycatalog
Derives the default stable runtime lookup key for msgid and msgctxt.
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 true when the message contains a cardinal plural expression.
has_select
Returns true when the message contains a select expression.
has_select_ordinal
Returns true when the message contains an ordinal plural expression.
has_tag
Returns true when the message contains rich-text style tags.
machine_translation_hashcatalog
Computes the integrity-lock hash for a translation value.
measure_catalog_coveragecatalog
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_catalogcatalog
Parses catalog content into the higher-level representation used by ferrocat’s catalog APIs.
parse_icu
Parses ICU MessageFormat input with the default parser options.
parse_icu_with_options
Parses ICU MessageFormat input with explicit parser options.
parse_po
Parses PO content into the owned PoFile representation.
parse_po_borrowed
Parses PO content into a borrowed representation.
parse_po_bytes
Parses UTF-8 PO bytes into the owned PoFile representation.
pseudolocalize_compiled_catalog_artifactcatalog
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_catalogscatalog
Compares previous and current normalized catalog states for translator review.
stringify_icu
Renders a parsed ICU message AST back to ICU MessageFormat text.
stringify_po
Serializes a PoFile back into gettext PO text.
unescape_string
Unescapes a PO string literal payload.
update_catalogcatalog
Merges extracted messages into an existing catalog and returns updated catalog content.
update_catalog_filecatalog
Updates a catalog on disk and only writes the file when the rendered output changes.
validate_icu
Validates ICU MessageFormat input 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§

IcuFormatterSupportPolicycatalog
Callback used to validate runtime support for ICU formatters.