protocol

package
Version: v0.0.0-...-a7a9960 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2015 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgCodeCorruptedData        = "corrupted-data"
	MsgCodeInvalidClassWeekday  = "invalid-class-weekday"
	MsgCodeInvalidClassTime     = "invalid-class-time"
	MsgCodeInvalidClassDuration = "invalid-class-duration"
	MsgCodeClassDataMissing     = "class-data-missing"
	MsgCodeNameMissing          = "name-missing"
	MsgCodeMissingData          = "missing-data"
	MsgCodeInvalidFormat        = "invalid-format"
)

Variables

View Source
var Translations map[string]Translation

Functions

func LoadTranslations

func LoadTranslations(dirname string) error

Types

type Message

type Message struct {
	Code  msgCode `json:"code"`
	Field string  `json:"field,omitempty"`
	Value string  `json:"value,omitempty"`
	Text  string  `json:"message,omitempty"`
}

func (*Message) Translate

func (msg *Message) Translate(language string) bool

type Messages

type Messages []Translator

func (Messages) Translate

func (m Messages) Translate(language string) bool

type MessagesHolder

type MessagesHolder struct {
	// contains filtered or unexported fields
}

func (*MessagesHolder) Add

func (m *MessagesHolder) Add(trs ...Translator)

func (*MessagesHolder) Messages

func (m *MessagesHolder) Messages() Translator

type Translation

type Translation map[msgCode]string

type Translator

type Translator interface {
	Translate(lang string) bool
}

func NewMessage

func NewMessage(code msgCode, value string) Translator

func NewMessageWithField

func NewMessageWithField(code msgCode, field string, value string) Translator

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL