pub struct CatalogAuditOptions<'a> {
pub source_locale: &'a str,
pub locales: &'a [&'a str],
pub metadata: &'a [MessageMetadataInput],
pub checks: CatalogAuditChecks,
}Expand description
Options controlling catalog audit checks.
Fields§
§source_locale: &'a strSource locale used as the expected message set.
locales: &'a [&'a str]Optional target locale filter. Empty means all non-source locales present in catalogs.
metadata: &'a [MessageMetadataInput]Optional source-side semantic metadata records.
checks: CatalogAuditChecksIndividual audit checks to run.
Implementations§
Source§impl<'a> CatalogAuditOptions<'a>
impl<'a> CatalogAuditOptions<'a>
Sourcepub fn new(source_locale: &'a str) -> CatalogAuditOptions<'a>
pub fn new(source_locale: &'a str) -> CatalogAuditOptions<'a>
Creates audit options with the required source locale set.
Examples found in repository?
examples/release_audit.rs (line 20)
16fn main() -> Result<(), Box<dyn std::error::Error>> {
17 let source = catalog("msgid \"Checkout\"\nmsgstr \"Checkout\"\n", "en")?;
18 let target = catalog("msgid \"Checkout\"\nmsgstr \"\"\n", "de")?;
19
20 let report = audit_catalogs(&[&source, &target], &CatalogAuditOptions::new("en"))?;
21
22 assert!(report.has_errors());
23 assert!(
24 report
25 .diagnostics
26 .iter()
27 .any(|diagnostic| diagnostic.code == "catalog.empty_translation")
28 );
29
30 for diagnostic in &report.diagnostics {
31 println!("{}: {}", diagnostic.code, diagnostic.message);
32 }
33
34 Ok(())
35}Trait Implementations§
Source§impl<'a> Clone for CatalogAuditOptions<'a>
impl<'a> Clone for CatalogAuditOptions<'a>
Source§fn clone(&self) -> CatalogAuditOptions<'a>
fn clone(&self) -> CatalogAuditOptions<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for CatalogAuditOptions<'a>
impl<'a> Debug for CatalogAuditOptions<'a>
Source§impl<'a> Default for CatalogAuditOptions<'a>
impl<'a> Default for CatalogAuditOptions<'a>
Source§fn default() -> CatalogAuditOptions<'a>
fn default() -> CatalogAuditOptions<'a>
Returns the “default value” for a type. Read more
impl<'a> Eq for CatalogAuditOptions<'a>
Source§impl<'a> PartialEq for CatalogAuditOptions<'a>
impl<'a> PartialEq for CatalogAuditOptions<'a>
Source§fn eq(&self, other: &CatalogAuditOptions<'a>) -> bool
fn eq(&self, other: &CatalogAuditOptions<'a>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<'a> StructuralPartialEq for CatalogAuditOptions<'a>
Auto Trait Implementations§
impl<'a> Freeze for CatalogAuditOptions<'a>
impl<'a> RefUnwindSafe for CatalogAuditOptions<'a>
impl<'a> Send for CatalogAuditOptions<'a>
impl<'a> Sync for CatalogAuditOptions<'a>
impl<'a> Unpin for CatalogAuditOptions<'a>
impl<'a> UnsafeUnpin for CatalogAuditOptions<'a>
impl<'a> UnwindSafe for CatalogAuditOptions<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more