translation

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2016 License: MIT, AGPL-3.0, Apache-2.0 Imports: 6 Imported by: 0

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{}
	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.

Jump to

Keyboard shortcuts

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