In Rust, format Duration into string like "1 hour ago" or "01hou".
Currently it does not take the calendar into account and assumes each month is about 30.4 days long.
Parsing such string back to a Duration
is out of scope for this crate. Maybe see the chrono-english
crate instead.
Simplified API excerpt (pseudocode):
```rust
pub struct Formatter
impl Formatter {
pub fn new() -> Formatter
pub fn convert(&self, d: Duration) -> String;
pub fn convert_chrono(&self, from: chrono::DateTime, to: chrono::DateTime) -> String;
}
pub fn from_isolang(x : isolang::Language) -> Option
pub fn format_5chars(d: Duration) -> String; ```
A Language
can be constructed from isolang::Language.
If you checked some language and certify that it's allright, submit a pull request that removes "(unchecked)" or "(contributed)" in the list above.
There is a helper command line tool that allows easier experimenting when adding a new translation:
$ cargo run --features isolang en
Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
Running `target/debug/timeago en`
60
1 minute ago
7200
2 hours ago