Struct crowbook_intl::Extractor [] [src]

pub struct Extractor { /* fields omitted */ }

Struct that extracts all messages from source code and can print them to a .pot file.

This file can then be used as a starting point to begin translation. It should be relatively similar to gettext generated files.

Example

use crowbook_intl::Extractor;
let mut extractor = Extractor::new();
extractor.add_messages_from_dir("src/").unwrap();
println!("{}", extractor.generate_pot_file());

Note

This struct only add messages that are considered as needing localization, that is, the first argument of calls so lformat! macro.

Methods

impl Extractor
[src]

Create a new, empty extractor

Returns a hashmap mapping the original strings (as used by lformat!) to escaped strings. Only contains strings that are different and must thus be handled.

Add all the messages contained in a source file

Add messages from all .rs files contained in a directory (walks through subdirectories)

Generate a pot-like file from the strings extracted from all files (if any)

Write a pot-like file to specified location

Trait Implementations

impl Debug for Extractor
[src]

Formats the value using the given formatter.

impl Clone for Extractor
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more