[go: up one dir, main page]

fluent 0.4.3

A localization library designed to unleash the entire expressive power of natural language translations.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use fluent_syntax::ast;
use fluent_syntax::parser::errors::ParserError;
use fluent_syntax::parser::parse;

pub struct FluentResource {
    pub ast: ast::Resource,
}

impl FluentResource {
    pub fn from_string(source: &str) -> Result<Self, (Self, Vec<ParserError>)> {
        match parse(source) {
            Ok(ast) => Ok(FluentResource { ast }),
            Err((ast, errors)) => Err((FluentResource { ast }, errors)),
        }
    }
}