pub fn extract(
    buf: Vec<u8>,
    path: &str,
    rules: ExtractionRules
) -> Result<Vec<String>, Box<dyn Error>>
Expand description

Given a file, path and a set of extraction rules, this method will extract all the sections of translatable text from the file. E.g. paragraphs from word documents, values from json files, untranslated source segments from xliff, etc.

The default implementation of extraction rules can be used, but custom extraction rules can also be defined for files types that are not supported. (See extraction rules)

Examples

let mut file = File::open(&path).unwrap();
let mut ciphertext = Vec::new();
file.read_to_end(&mut ciphertext).unwrap();  

let texts = extract(ciphertext, &path, ExtractionRules::default()).unwrap();

Errors

ExtractionError: No rule matched the file and/or path