catalog

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultFileName = "out.gotext.json"
)

Functions

func ParsePluralCaseKey added in v0.5.0

func ParsePluralCaseKey(key string) (real string)

Types

type BaseMessage added in v0.5.0

type BaseMessage struct {
	ID                string       `json:"id"`
	Key               string       `json:"key"`
	Message           string       `json:"message"`
	Translation       interface{}  `json:"translation"`
	TranslatorComment string       `json:"translatorComment,omitempty"`
	Placeholders      Placeholders `json:"placeholders,omitempty"`
	Fuzzy             bool         `json:"fuzzy,omitempty"`
}

type CCatalog added in v0.5.0

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

func (*CCatalog) AddCatalog added in v0.5.0

func (c *CCatalog) AddCatalog(others ...catalog.Catalog)

func (*CCatalog) AddLocalesFromFS added in v0.5.0

func (c *CCatalog) AddLocalesFromFS(defaultTag language.Tag, efs beFs.FileSystem)

func (*CCatalog) AddLocalesFromJsonBytes added in v0.5.0

func (c *CCatalog) AddLocalesFromJsonBytes(tag language.Tag, src string, contents []byte)

func (*CCatalog) LocaleTags added in v0.5.0

func (c *CCatalog) LocaleTags() (tags []language.Tag)

func (*CCatalog) LocaleTagsWithDefault added in v0.5.0

func (c *CCatalog) LocaleTagsWithDefault(d language.Tag) (tags []language.Tag)

func (*CCatalog) MakeGoTextCatalog added in v0.5.0

func (c *CCatalog) MakeGoTextCatalog() (gtc catalog.Catalog, err error)

type Catalog

type Catalog interface {
	AddCatalog(others ...catalog.Catalog)
	AddLocalesFromFS(defaultTag language.Tag, efs beFs.FileSystem)
	AddLocalesFromJsonBytes(tag language.Tag, src string, contents []byte)

	LocaleTags() (tags []language.Tag)
	LocaleTagsWithDefault(d language.Tag) (tags []language.Tag)

	MakeGoTextCatalog() (gtc catalog.Catalog, err error)
}

func New added in v0.5.0

func New() (c Catalog)

type EditGoText added in v0.5.0

type EditGoText struct {
	FSID     string     `json:"fsid"`
	Source   string     `json:"source"`
	Language string     `json:"language"`
	Messages []*Message `json:"messages"`
}

type GoText added in v0.5.0

type GoText struct {
	Language string     `json:"language"`
	Messages []*Message `json:"messages"`
}

func ParseGoText added in v0.5.0

func ParseGoText(data []byte) (gt *GoText, tag language.Tag, err error)

type Message added in v0.5.0

type Message struct {
	ID                string       `json:"id"`
	Key               string       `json:"key"`
	Message           string       `json:"message"`
	Translation       *Translation `json:"translation"`
	TranslatorComment string       `json:"translatorComment,omitempty"`
	Placeholders      Placeholders `json:"placeholders,omitempty"`
	Fuzzy             bool         `json:"fuzzy,omitempty"`
}

func MakeMessageFromKey added in v0.5.0

func MakeMessageFromKey(key, comment string, argv ...string) (m *Message)

func ParseTemplateMessages added in v0.5.0

func ParseTemplateMessages(input string) (msgs []*Message, err error)

func (*Message) Copy added in v0.5.1

func (m *Message) Copy() (copied *Message)

func (*Message) MarshalJSON added in v0.5.0

func (m *Message) MarshalJSON() (data []byte, err error)

func (*Message) UnmarshalJSON added in v0.5.0

func (m *Message) UnmarshalJSON(data []byte) (err error)

type Placeholder added in v0.5.0

type Placeholder struct {
	ID             string `json:"id"`
	String         string `json:"string"`
	Type           string `json:"type"`
	UnderlyingType string `json:"underlyingType"`
	ArgNum         int    `json:"argNum"`
	Expr           string `json:"expr"`
}

type Placeholders added in v0.5.0

type Placeholders []*Placeholder

func (Placeholders) Copy added in v0.5.1

func (p Placeholders) Copy() (copied Placeholders)

func (Placeholders) Numeric added in v0.5.0

func (p Placeholders) Numeric() (found Placeholders)

type Select added in v0.5.0

type Select struct {
	Arg     string                `json:"arg"`
	Feature string                `json:"feature"`
	Cases   map[string]SelectCase `json:"cases"`
}

type SelectCase added in v0.5.0

type SelectCase struct {
	Msg string `json:"msg"`
}

type SelectMessage added in v0.5.0

type SelectMessage struct {
	ID                string       `json:"id"`
	Key               string       `json:"key"`
	Message           string       `json:"message"`
	Translation       *Translation `json:"translation"`
	TranslatorComment string       `json:"translatorComment,omitempty"`
	Placeholders      Placeholders `json:"placeholders,omitempty"`
	Fuzzy             bool         `json:"fuzzy,omitempty"`
}

func (*SelectMessage) Make added in v0.5.0

func (s *SelectMessage) Make() (m Message)

type StringMessage added in v0.5.0

type StringMessage struct {
	ID                string       `json:"id"`
	Key               string       `json:"key"`
	Message           string       `json:"message"`
	Translation       string       `json:"translation"`
	TranslatorComment string       `json:"translatorComment,omitempty"`
	Placeholders      Placeholders `json:"placeholders,omitempty"`
	Fuzzy             bool         `json:"fuzzy,omitempty"`
}

func (*StringMessage) Make added in v0.5.0

func (s *StringMessage) Make() (m Message)

type Translation added in v0.5.0

type Translation struct {
	String string  `json:"string,omitempty"`
	Select *Select `json:"select,omitempty"`
}

Jump to

Keyboard shortcuts

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