package internal
import "github.com/nicksnyder/go-i18n/v2/internal"
Index ¶
- type Message
- type MessageFile
- type MessageTemplate
- func NewMessageTemplate(m *Message) *MessageTemplate
- func (mt *MessageTemplate) Execute(pluralForm plural.Form, data interface{}) (string, error)
- type Template
- type UnmarshalFunc
Types ¶
type Message ¶
type Message struct { // ID uniquely identifies the message. ID string // Hash uniquely identifies the content of the message // that this message was translated from. Hash string // Description describes the message to give additional // context to translators that may be relevant for translation. Description string // LeftDelim is the left Go template delimiter. LeftDelim string // RightDelim is the right Go template delimiter.`` RightDelim string // Zero is the content of the message for the CLDR plural form "zero". Zero string // One is the content of the message for the CLDR plural form "one". One string // Two is the content of the message for the CLDR plural form "two". Two string // Few is the content of the message for the CLDR plural form "few". Few string // Many is the content of the message for the CLDR plural form "many". Many string // Other is the content of the message for the CLDR plural form "other". Other string }
Message is a string that can be localized.
func MustNewMessage ¶
func MustNewMessage(data interface{}) *Message
MustNewMessage is similar to NewMessage except it panics if an error happens.
func NewMessage ¶
NewMessage parses data and returns a new message.
type MessageFile ¶
MessageFile represents a parsed message file.
func ParseMessageFileBytes ¶
func ParseMessageFileBytes(buf []byte, path string, unmarshalFuncs map[string]UnmarshalFunc) (*MessageFile, error)
ParseMessageFileBytes returns the messages parsed from file.
type MessageTemplate ¶
MessageTemplate is an executable template for a message.
func NewMessageTemplate ¶
func NewMessageTemplate(m *Message) *MessageTemplate
NewMessageTemplate returns a new message template.
func (*MessageTemplate) Execute ¶
func (mt *MessageTemplate) Execute(pluralForm plural.Form, data interface{}) (string, error)
Execute executes the template for the plural form and template data.
type Template ¶
type Template struct { Src string Template *gotemplate.Template ParseErr *error }
Template stores the template for a string.
type UnmarshalFunc ¶
UnmarshalFunc unmarshals data into v.
Source Files ¶
message.go message_template.go parse.go template.go
Directories ¶
Path | Synopsis |
---|---|
internal/plural | Package plural provides support for pluralizing messages according to CLDR rules http://cldr.unicode.org/index/cldr-spec/plural-rules |
internal/plural/codegen |
- Version
- v2.0.0-beta.2
- Published
- Apr 19, 2018
- Platform
- windows/amd64
- Imports
- 7 packages
- Last checked
- 1 hour ago –
Tools for package owners.