Documentation ¶
Index ¶
- Variables
- func ClosestLocale(candidates []string) (string, bool)
- func LoadJSON(locale string, r io.Reader) error
- func LoadJSONFiles(locales fs.FS) error
- func SprintNode(node Node) string
- type AfterPostProcessFunc
- type BinaryNode
- type Bool
- func (b Bool) Add(rhs Value) Value
- func (b Bool) AsBool() Bool
- func (b Bool) AsFloat() Float
- func (b Bool) AsInt() Int
- func (b Bool) AsSlice() Slice
- func (b Bool) AsString() String
- func (b Bool) Div(rhs Value) Value
- func (b Bool) Equal(rhs Value) Bool
- func (b Bool) Less(rhs Value) Bool
- func (b Bool) Mod(rhs Value) Value
- func (b Bool) Mul(rhs Value) Value
- func (b Bool) Sub(rhs Value) Value
- func (b Bool) Type() Type
- type CallNode
- type Duration
- func (d Duration) Add(rhs Value) Value
- func (d Duration) AsBool() Bool
- func (d Duration) AsFloat() Float
- func (d Duration) AsInt() Int
- func (d Duration) AsSlice() Slice
- func (d Duration) AsString() String
- func (d Duration) Div(rhs Value) Value
- func (d Duration) Equal(rhs Value) Bool
- func (d Duration) Less(rhs Value) Bool
- func (d Duration) Mod(rhs Value) Value
- func (d Duration) Mul(rhs Value) Value
- func (d Duration) Sub(rhs Value) Value
- func (d Duration) Type() Type
- type Error
- type Errors
- type Float
- func (f Float) Add(rhs Value) Value
- func (f Float) AsBool() Bool
- func (f Float) AsFloat() Float
- func (f Float) AsInt() Int
- func (f Float) AsSlice() Slice
- func (f Float) AsString() String
- func (f Float) Div(rhs Value) Value
- func (f Float) Equal(rhs Value) Bool
- func (f Float) Less(rhs Value) Bool
- func (f Float) Mod(rhs Value) Value
- func (f Float) Mul(rhs Value) Value
- func (f Float) Sub(rhs Value) Value
- func (f Float) Type() Type
- type HTMLRuntime
- type IdentNode
- type IndexNode
- type Int
- func (i Int) Add(rhs Value) Value
- func (i Int) AsBool() Bool
- func (i Int) AsFloat() Float
- func (i Int) AsInt() Int
- func (i Int) AsSlice() Slice
- func (i Int) AsString() String
- func (i Int) Div(rhs Value) Value
- func (i Int) Equal(rhs Value) Bool
- func (i Int) Less(rhs Value) Bool
- func (i Int) Mod(rhs Value) Value
- func (i Int) Mul(rhs Value) Value
- func (i Int) Sub(rhs Value) Value
- func (i Int) Type() Type
- type InvalidNode
- type JSRuntime
- type Lexer
- type LiteralNode
- type MarkdownRuntime
- func (r MarkdownRuntime) Bold(value Value) RawString
- func (r MarkdownRuntime) Fraction(value, roundingUnit Value) Float
- func (r MarkdownRuntime) Integer(value Value) Int
- func (r MarkdownRuntime) Italic(value Value) RawString
- func (r MarkdownRuntime) Join(s, sep Value) String
- func (r MarkdownRuntime) Kind() string
- func (r MarkdownRuntime) Link(label, href, target Value) RawString
- func (r MarkdownRuntime) PadLeft(value, length, padding Value) String
- func (r MarkdownRuntime) PadRight(value, length, padding Value) String
- func (r MarkdownRuntime) PostProcess(value Value, after AfterPostProcessFunc) any
- func (r MarkdownRuntime) Split(s, sep Value) Slice
- func (r MarkdownRuntime) T(key Value, locale string, value, opt Value) String
- func (r MarkdownRuntime) TrimLeft(value, trim Value) String
- func (r MarkdownRuntime) TrimRight(value, trim Value) String
- type Message
- type Node
- type OptNode
- type Parser
- type RawString
- func (s RawString) Add(rhs Value) Value
- func (s RawString) AsBool() Bool
- func (s RawString) AsFloat() Float
- func (s RawString) AsInt() Int
- func (s RawString) AsSlice() Slice
- func (s RawString) AsString() String
- func (s RawString) Div(rhs Value) Value
- func (s RawString) Equal(rhs Value) Bool
- func (s RawString) Less(rhs Value) Bool
- func (s RawString) Mod(rhs Value) Value
- func (s RawString) Mul(rhs Value) Value
- func (s RawString) Sub(rhs Value) Value
- func (s RawString) Type() Type
- type Resource
- type RootNode
- type Rule
- type Runtime
- type SelectNode
- type Slice
- func (s Slice) Add(rhs Value) Value
- func (s Slice) AsBool() Bool
- func (s Slice) AsFloat() Float
- func (s Slice) AsInt() Int
- func (s Slice) AsSlice() Slice
- func (s Slice) AsString() String
- func (s Slice) Div(rhs Value) Value
- func (s Slice) Equal(rhs Value) Bool
- func (s Slice) Less(rhs Value) Bool
- func (s Slice) Mod(rhs Value) Value
- func (s Slice) Mul(rhs Value) Value
- func (s Slice) Sub(rhs Value) Value
- func (s Slice) Type() Type
- type SliceNode
- type String
- func (s String) Add(rhs Value) Value
- func (s String) AsBool() Bool
- func (s String) AsFloat() Float
- func (s String) AsInt() Int
- func (s String) AsSlice() Slice
- func (s String) AsString() String
- func (s String) Div(rhs Value) Value
- func (s String) Equal(rhs Value) Bool
- func (s String) Less(rhs Value) Bool
- func (s String) Mod(rhs Value) Value
- func (s String) Mul(rhs Value) Value
- func (s String) Sub(rhs Value) Value
- func (s String) Type() Type
- type Time
- func (t Time) Add(rhs Value) Value
- func (t Time) AsBool() Bool
- func (t Time) AsFloat() Float
- func (t Time) AsInt() Int
- func (t Time) AsSlice() Slice
- func (t Time) AsString() String
- func (t Time) Div(rhs Value) Value
- func (t Time) Equal(rhs Value) Bool
- func (t Time) Less(rhs Value) Bool
- func (t Time) Mod(rhs Value) Value
- func (t Time) Mul(rhs Value) Value
- func (t Time) Sub(rhs Value) Value
- func (t Time) Type() Type
- type Token
- type TokenKind
- type Translation
- type Translations
- type Type
- type UnaryNode
- type Value
- type Vars
Constants ¶
This section is empty.
Variables ¶
View Source
var ( FallbackLocale = "en-GB" ErrorLocale = FallbackLocale )
View Source
var ( DefaultHTMLRuntime HTMLRuntime DefaultJSRuntime JSRuntime DefaultMarkdownRuntime MarkdownRuntime )
View Source
var ErrNotFound = errors.New("message not found")
Functions ¶
func ClosestLocale ¶
func LoadJSONFiles ¶
func SprintNode ¶
Types ¶
type AfterPostProcessFunc ¶
type BinaryNode ¶
type Duration ¶
func NewDuration ¶
type HTMLRuntime ¶
type HTMLRuntime struct {
MarkdownRuntime
}
func (HTMLRuntime) Bold ¶
func (r HTMLRuntime) Bold(value Value) RawString
func (HTMLRuntime) Italic ¶
func (r HTMLRuntime) Italic(value Value) RawString
func (HTMLRuntime) Kind ¶
func (r HTMLRuntime) Kind() string
func (HTMLRuntime) Link ¶
func (r HTMLRuntime) Link(label, href, target Value) RawString
func (HTMLRuntime) PostProcess ¶
func (r HTMLRuntime) PostProcess(value Value, after AfterPostProcessFunc) any
type InvalidNode ¶
type JSRuntime ¶
type JSRuntime struct {
MarkdownRuntime
}
func (JSRuntime) PostProcess ¶
func (r JSRuntime) PostProcess(value Value, after AfterPostProcessFunc) any
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
func (*Lexer) Load ¶
func (l *Lexer) Load(scanner io.ByteScanner)
type LiteralNode ¶
type LiteralNode struct { Token // contains filtered or unexported fields }
type MarkdownRuntime ¶
type MarkdownRuntime struct{}
func (MarkdownRuntime) Bold ¶
func (r MarkdownRuntime) Bold(value Value) RawString
func (MarkdownRuntime) Fraction ¶
func (r MarkdownRuntime) Fraction(value, roundingUnit Value) Float
func (MarkdownRuntime) Integer ¶
func (r MarkdownRuntime) Integer(value Value) Int
func (MarkdownRuntime) Italic ¶
func (r MarkdownRuntime) Italic(value Value) RawString
func (MarkdownRuntime) Join ¶
func (r MarkdownRuntime) Join(s, sep Value) String
func (MarkdownRuntime) Kind ¶
func (r MarkdownRuntime) Kind() string
func (MarkdownRuntime) Link ¶
func (r MarkdownRuntime) Link(label, href, target Value) RawString
func (MarkdownRuntime) PadLeft ¶
func (r MarkdownRuntime) PadLeft(value, length, padding Value) String
func (MarkdownRuntime) PadRight ¶
func (r MarkdownRuntime) PadRight(value, length, padding Value) String
func (MarkdownRuntime) PostProcess ¶
func (r MarkdownRuntime) PostProcess(value Value, after AfterPostProcessFunc) any
func (MarkdownRuntime) Split ¶
func (r MarkdownRuntime) Split(s, sep Value) Slice
func (MarkdownRuntime) T ¶
func (r MarkdownRuntime) T(key Value, locale string, value, opt Value) String
func (MarkdownRuntime) TrimLeft ¶
func (r MarkdownRuntime) TrimLeft(value, trim Value) String
func (MarkdownRuntime) TrimRight ¶
func (r MarkdownRuntime) TrimRight(value, trim Value) String
type Message ¶
func (Message) WithContext ¶
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
func NewResource ¶
func NewResource() *Resource
type Runtime ¶
type Runtime interface { Kind() string Join(s, sep Value) String Split(s, sep Value) Slice Bold(value Value) RawString Italic(value Value) RawString Link(label, href, target Value) RawString PadLeft(value, length, padding Value) String PadRight(value, length, padding Value) String TrimLeft(value, trim Value) String TrimRight(value, trim Value) String Integer(value Value) Int Fraction(value, roundingUnit Value) Float T(key Value, locale string, value, opt Value) String PostProcess(value Value, after AfterPostProcessFunc) any }
type SelectNode ¶
type TokenKind ¶
type TokenKind int
const ( KindUnknown TokenKind = iota KindUnexpected KindEOF KindEnterExpr KindLeaveExpr KindInt KindFloat KindString KindText KindIdent KindOr KindAnd KindBang KindComma KindColon KindLParen KindRParen KindLBrack KindRBrack KindPlus KindMinus KindAsterisk KindSlash KindPercent KindEqual KindEqualEqual KindBangEqual KindGreater KindGreaterEqual KindLess KindLessEqual KindEqualGreater )
type Translation ¶
type Translation struct { Condition Node Value Node Group []Translation }
type Translations ¶
type Translations map[string]Translation
Click to show internal directories.
Click to hide internal directories.