Documentation ¶
Overview ¶
Package translation defines the interface for a translation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SortableByID ¶
type SortableByID []Translation
SortableByID implements sort.Interface for a slice of translations.
func (SortableByID) Len ¶
func (a SortableByID) Len() int
func (SortableByID) Less ¶
func (a SortableByID) Less(i, j int) bool
func (SortableByID) Swap ¶
func (a SortableByID) Swap(i, j int)
type Translation ¶
type Translation interface { // MarshalInterface returns the object that should be used // to serialize the translation. MarshalInterface() interface{} MarshalFlatInterface() interface{} ID() string Template(language.Plural) *template UntranslatedCopy() Translation Normalize(language *language.Language) Translation Backfill(src Translation) Translation Merge(Translation) Translation Incomplete(l *language.Language) bool }
Translation is the interface that represents a translated string.
func NewTranslation ¶
func NewTranslation(data map[string]interface{}) (Translation, error)
NewTranslation reflects on data to create a new Translation.
data["id"] must be a string and data["translation"] must be either a string for a non-plural translation or a map[string]interface{} for a plural translation.
func NewTranslationFromArgs ¶ added in v1.11.2
func NewTranslationFromArgs(id string, translation interface{}) (Translation, error)
NewTranslationFromArgs reflects on translation to create a new Translation.
translation must be either a string for a non-plural translation or a map[string]interface{} for a plural translation.
Click to show internal directories.
Click to hide internal directories.