kielet/plurals
Utilities for plural forms.
Types
Error returned when loading the plural forms from an MO file.
pub type LoadError {
ParsingFailed(err: ParseError)
NoPluralFormsHeader
}
Constructors
-
ParsingFailed(err: ParseError)
-
NoPluralFormsHeader
Error returned when tokenizing or parsing the plural forms.
pub type ParseError {
TokenizerError(err: syntax_error.SyntaxError)
ParserError(err: List(nibble.DeadEnd(tokenizer.Token, Nil)))
}
Constructors
-
TokenizerError(err: syntax_error.SyntaxError)
-
ParserError(err: List(nibble.DeadEnd(tokenizer.Token, Nil)))
Functions
pub fn evaluate(plurals: Plurals, n: Int) -> Int
Evaluate given plurals, returning the index of the plural form to choose.
pub fn load_from_mo(mo: Mo) -> Result(Plurals, LoadError)
Load plural forms from a parsed MO file.