localize

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context = string

Context is an alias type for string which is used by xspreak for extracting strings.

type Domain

type Domain = string

Domain is an alias type for string which is used by xspreak for extracting strings.

type Error

type Error struct {
	Translation string
	Wrapped     error
}

Error is returned when a Localizer or Locale translates an error into the target language.

func (*Error) Error

func (e *Error) Error() string

func (*Error) String

func (e *Error) String() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Localizable

type Localizable interface {
	GetMsgID() string
	GetPluralID() string
	GetContext() string
	GetVars() []interface{}
	GetCount() int
	HasDomain() bool
	GetDomain() string
}

type Message

type Message struct {
	Singular Singular
	Plural   Plural
	Context  Context
	Vars     []interface{}
	Count    int
}

Message is a simple struct representing a message without a domain. Can be converted to a translated string by Localizers or a Locale.

func (*Message) GetContext

func (m *Message) GetContext() string

func (*Message) GetCount

func (m *Message) GetCount() int

func (*Message) GetDomain

func (m *Message) GetDomain() string

func (*Message) GetMsgID

func (m *Message) GetMsgID() string

func (*Message) GetPluralID

func (m *Message) GetPluralID() string

func (*Message) GetVars

func (m *Message) GetVars() []interface{}

func (*Message) HasDomain

func (m *Message) HasDomain() bool

type MsgID

type MsgID = string

MsgID is an alias type for string which is used by xspreak for extracting strings MsgID and Singular are synonymous and both represent the ID to identify the message.

type Plural

type Plural = string

Plural is an alias type for string which is used by xspreak for extracting strings.

type Singular

type Singular = string

Singular is an alias type for string which is used by xspreak for extracting strings MsgID and Singular are synonymous and both represent the ID to identify the message.

Jump to

Keyboard shortcuts

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