Expand description
§pockingbird
Report-only library + CLI that finds duplicate translation keys across
gettext .po catalogs.
§Library entry point
The one call you need is scan — point it at a directory and a Config
and get back a Report:
use std::path::Path;
use pockingbird::{scan, Config};
let report = scan(Path::new("./locales"), &Config::default())?;
println!("{}", pockingbird::report::to_json(&report.groups, report.total_keys));§Pipeline
walk → po → index → group → reportwalk— discover.pofiles under the configured roots.po— parse each catalog (polib) into keys and per-locale values;localederives the locale id from the path.index— build theKeyId × locale → Cellmatrix;normalizeandfuzzycanonicalize cells per tier.group— tier-agnostic signature bucketing + leave-one-out over the canonical matrix →CandidateGroups.report— render the groups as text (colored) or json.
These stages are crate-internal; scan wires them together. config
holds the TOML schema and defaults that parameterize every stage.
Re-exports§
pub use config::Config;
Modules§
- cli
- CLI surface (clap derive):
find <path> [knobs]andinit [path]. Behind theclifeature. Exit code is always0(the tool reports, it does not gate). This is the thin shell around thecrate::scanfacade: it resolves config, renders progress to stderr, and writes the report to stdout — the pipeline run itself is the testable core. - config
- TOML configuration schema (
Config/Scan/Locales/Match/Normalize/Output) plus defaults. Parameterizes every pipeline stage. - report
- Render candidate groups as text (colored) or json, with identical structure.
Structs§
- Candidate
Group - A reported duplicate-candidate group over one tier.
- KeyId
- Identity of a translatable key.
domainis part of the identity, somessages.po:Xanddjango.po:Xare distinct keys. Hashable and ordered for stable, deterministic bucketing. - Report
- The run’s data result. No timings, no formatting — rendering is the shell’s job.
- Skip
- A catalog that failed to parse. Recorded, never fatal.
Enums§
- Cell
- A key’s value in one locale.
- Error
- A failed
scan: discovery, no input, or a pipeline error. - Pipeline
Error - A run that could not produce a report at all (distinct from a skipped file).
- Pipeline
Event - A progress event emitted during a run. The vocabulary is here; the rendering is the sink’s.
- PoError
- Walk
Error
Traits§
- Progress
Sink - The one-method progress seam. Implement it to render, time, or record.
Functions§
- scan
- Scan a directory tree for duplicate translation keys across its
.pocatalogs — the one-call library entry point. Discovers files underroot(overridingconfig.scan.roots), parses them, and runs the pipeline. - scan_
with - Like
scan, but drives aProgressSinkso callers can render progress.