Documentation
¶
Index ¶
- Constants
- type Comment
- type DefaultPluralRulesNotFoundError
- type Document
- type DocumentHeader
- type DocumentHeaderParseError
- type DocumentLineParseError
- type DocumentMissingHeaderError
- type DocumentParseError
- type Entry
- type EntryHeader
- type EntryKey
- type EntryLineParseError
- type EntryParseError
- type Keyword
- type Line
- type LineParseError
- type LineValue
- type PluralRuleOperation
- type PluralRuleValidationError
- type PluralRules
- type PluralRulesDefinition
- type PluralType
Constants ¶
View Source
const ( PluralTypeZero = PluralType(iota) PluralTypeOne PluralTypeTwo PluralTypeFew PluralTypeMany PluralTypeOther )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultPluralRulesNotFoundError ¶
type DefaultPluralRulesNotFoundError struct {
Locale string
}
func (DefaultPluralRulesNotFoundError) Error ¶
func (e DefaultPluralRulesNotFoundError) Error() string
type Document ¶
type Document struct {
Header DocumentHeader
Entries []Entry
}
func CreateDocument ¶
func ParseDocumentString ¶
type DocumentHeader ¶
type DocumentHeader struct {
Tag language.Tag
PluralRules PluralRules
}
func CreateHeaderFromEntry ¶
func CreateHeaderFromEntry(entry Entry) (DocumentHeader, error)
type DocumentHeaderParseError ¶
func (DocumentHeaderParseError) Error ¶
func (e DocumentHeaderParseError) Error() string
type DocumentLineParseError ¶
func (DocumentLineParseError) Error ¶
func (e DocumentLineParseError) Error() string
type DocumentMissingHeaderError ¶
type DocumentMissingHeaderError struct{}
func (DocumentMissingHeaderError) Error ¶
func (e DocumentMissingHeaderError) Error() string
type DocumentParseError ¶
func (DocumentParseError) Error ¶
func (e DocumentParseError) Error() string
type Entry ¶
type Entry struct {
EntryKey
Header EntryHeader
IsObsolete bool
Value string
PluralValues []string
Lines []Line
}
func ParseEntry ¶
the original c# implementation has a keyword->value map, which makes this method a bit more maintainable when supporting new keywords but in practice, this doesn't happen, and hard-coded keywords provide a simpler implementation
type EntryHeader ¶
func ExtractEntryHeader ¶
func ExtractEntryHeader(lines []Line) EntryHeader
type EntryLineParseError ¶
func (EntryLineParseError) Error ¶
func (e EntryLineParseError) Error() string
type EntryParseError ¶
type EntryParseError struct {
Reason string
}
func (EntryParseError) Error ¶
func (e EntryParseError) Error() string
type Line ¶
type Line struct {
Keyword Keyword
Value LineValue
Comment Comment
RawLine string
IsCommentOrWhiteSpace, IsWhiteSpace, IsComment, IsMarkedObsolete bool
}
func CommentLine ¶
func KeywordedValueLine ¶
type LineParseError ¶
type LineParseError struct {
Line string
}
func (LineParseError) Error ¶
func (err LineParseError) Error() string
type PluralRuleOperation ¶
type PluralRuleValidationError ¶
func (PluralRuleValidationError) Error ¶
func (e PluralRuleValidationError) Error() string
type PluralRules ¶
type PluralRules struct {
// contains filtered or unexported fields
}
func (*PluralRules) Evaluate ¶
func (p *PluralRules) Evaluate(d decimal.Decimal) PluralType
type PluralRulesDefinition ¶
type PluralRulesDefinition struct {
Zero, One, Two, Few, Many, Other string
}
func GetDefaultPluralRulesDefinition ¶
func GetDefaultPluralRulesDefinition(localeCode string) (PluralRulesDefinition, error)
func (*PluralRulesDefinition) Parse ¶
func (d *PluralRulesDefinition) Parse() PluralRules
type PluralType ¶
type PluralType int
func (PluralType) String ¶
func (t PluralType) String() string
Click to show internal directories.
Click to hide internal directories.